Mike McCormack : comctl32: imagelist: Remove more 1xN assumptions.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Nov 2 05:46:45 CST 2006


Module: wine
Branch: master
Commit: f97bf3e6e0edcdd809d7260ac6a1e14a199f9c29
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f97bf3e6e0edcdd809d7260ac6a1e14a199f9c29

Author: Mike McCormack <mike at codeweavers.com>
Date:   Thu Nov  2 12:15:50 2006 +0900

comctl32: imagelist: Remove more 1xN assumptions.

---

 dlls/comctl32/imagelist.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index 580d3ab..a9f829d 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -2548,8 +2548,9 @@ ImageList_SetIconSize (HIMAGELIST himl,
     himl->hbmImage = hbmNew;
 
     if (himl->hbmMask) {
-        hbmNew = CreateBitmap (himl->cMaxImage * himl->cx, himl->cy,
-                            1, 1, NULL);
+        SIZE sz;
+        imagelist_get_bitmap_size(himl, himl->cMaxImage, himl->cy, &sz);
+        hbmNew = CreateBitmap (sz.cx, sz.cy, 1, 1, NULL);
         SelectObject (himl->hdcMask, hbmNew);
         DeleteObject (himl->hbmMask);
         himl->hbmMask = hbmNew;
@@ -2847,7 +2848,9 @@ static HBITMAP ImageList_CreateImage(HDC
 {
     HBITMAP hbmNewBitmap;
     UINT ilc = (himl->flags & 0xFE);
-    UINT width = count * himl->cx;
+    SIZE sz;
+
+    imagelist_get_bitmap_size( himl, count, height, &sz );
 
     if ((ilc >= ILC_COLOR4 && ilc <= ILC_COLOR32) || ilc == ILC_COLOR)
     {
@@ -2884,8 +2887,8 @@ static HBITMAP ImageList_CreateImage(HDC
 	}
 
 	bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-	bmi->bmiHeader.biWidth = width;
-	bmi->bmiHeader.biHeight = height;
+	bmi->bmiHeader.biWidth = sz.cx;
+	bmi->bmiHeader.biHeight = sz.cy;
 	bmi->bmiHeader.biPlanes = 1;
 	bmi->bmiHeader.biBitCount = himl->uBitsPixel;
 	bmi->bmiHeader.biCompression = BI_RGB;
@@ -2903,7 +2906,7 @@ static HBITMAP ImageList_CreateImage(HDC
     {
         TRACE("Creating Bitmap: %d Bits per Pixel\n", himl->uBitsPixel);
 
-        hbmNewBitmap = CreateBitmap (width, height, 1, himl->uBitsPixel, NULL);
+        hbmNewBitmap = CreateBitmap (sz.cx, sz.cy, 1, himl->uBitsPixel, NULL);
     }
     TRACE("returning %p\n", hbmNewBitmap);
     return hbmNewBitmap;




More information about the wine-cvs mailing list