Mike McCormack : comctl32: Move code assuming Nx1 into ImageList_CreateImage.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Oct 27 05:49:22 CDT 2006


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

Author: Mike McCormack <mike at codeweavers.com>
Date:   Thu Oct 26 21:12:44 2006 +0900

comctl32: Move code assuming Nx1 into ImageList_CreateImage.

---

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

diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index 0da2a90..60cde81 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -77,7 +77,7 @@ typedef struct
 
 static INTERNALDRAG InternalDrag = { 0, 0, 0, 0, 0, 0, FALSE, 0 };
 
-static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT width, UINT height);
+static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT count, UINT height);
 
 static inline BOOL is_valid(HIMAGELIST himl)
 {
@@ -123,7 +123,7 @@ IMAGELIST_InternalExpandBitmaps (HIMAGEL
     TRACE("Create expanded bitmaps : himl=%p x=%d y=%d count=%d\n", himl, nNewWidth, cy, nNewCount);
     hdcBitmap = CreateCompatibleDC (0);
 
-    hbmNewBitmap = ImageList_CreateImage(hdcBitmap, himl, nNewWidth, cy);
+    hbmNewBitmap = ImageList_CreateImage(hdcBitmap, himl, nNewCount, cy);
 
     if (hbmNewBitmap == 0)
         ERR("creating new image bitmap (x=%d y=%d)!\n", nNewWidth, cy);
@@ -609,7 +609,7 @@ ImageList_Create (INT cx, INT cy, UINT f
         himl->uBitsPixel = (UINT)GetDeviceCaps (himl->hdcImage, BITSPIXEL);
 
     if (himl->cMaxImage > 0) {
-        himl->hbmImage = ImageList_CreateImage(himl->hdcImage, himl, cx * himl->cMaxImage, cy);
+        himl->hbmImage = ImageList_CreateImage(himl->hdcImage, himl, himl->cMaxImage, cy);
 	SelectObject(himl->hdcImage, himl->hbmImage);
     } else
         himl->hbmImage = 0;
@@ -2071,7 +2071,7 @@ ImageList_Remove (HIMAGELIST himl, INT i
         for (nCount = 0; nCount < MAX_OVERLAYIMAGE; nCount++)
              himl->nOvlIdx[nCount] = -1;
 
-        hbmNewImage = ImageList_CreateImage(himl->hdcImage, himl, himl->cMaxImage * himl->cx, himl->cy);
+        hbmNewImage = ImageList_CreateImage(himl->hdcImage, himl, himl->cMaxImage, himl->cy);
         SelectObject (himl->hdcImage, hbmNewImage);
         DeleteObject (himl->hbmImage);
         himl->hbmImage = hbmNewImage;
@@ -2097,7 +2097,7 @@ ImageList_Remove (HIMAGELIST himl, INT i
         TRACE(" - Max. number of images: %d / %d (Old/New)\n",
                  himl->cMaxImage, himl->cCurImage + himl->cGrow - 1);
 
-        hbmNewImage = ImageList_CreateImage(himl->hdcImage, himl, cxNew, himl->cy);
+        hbmNewImage = ImageList_CreateImage(himl->hdcImage, himl, nCount, himl->cy);
 
         if (himl->hbmMask)
             hbmNewMask = CreateBitmap (cxNew, himl->cy, 1, 1, NULL);
@@ -2524,7 +2524,7 @@ ImageList_SetIconSize (HIMAGELIST himl,
     for (nCount = 0; nCount < MAX_OVERLAYIMAGE; nCount++)
         himl->nOvlIdx[nCount] = -1;
 
-    hbmNew = ImageList_CreateImage(himl->hdcImage, himl, himl->cMaxImage * himl->cx, himl->cy);
+    hbmNew = ImageList_CreateImage(himl->hdcImage, himl, himl->cMaxImage, himl->cy);
     SelectObject (himl->hdcImage, hbmNew);
     DeleteObject (himl->hbmImage);
     himl->hbmImage = hbmNew;
@@ -2580,7 +2580,7 @@ ImageList_SetImageCount (HIMAGELIST himl
 
     hdcBitmap = CreateCompatibleDC (0);
 
-    hbmNewBitmap = ImageList_CreateImage(hdcBitmap, himl, nNewCount * himl->cx, himl->cy);
+    hbmNewBitmap = ImageList_CreateImage(hdcBitmap, himl, nNewCount, himl->cy);
 
     if (hbmNewBitmap != 0)
     {
@@ -2825,10 +2825,11 @@ ImageList_Write (HIMAGELIST himl, LPSTRE
 }
 
 
-static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT width, UINT height)
+static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT count, UINT height)
 {
     HBITMAP hbmNewBitmap;
     UINT ilc = (himl->flags & 0xFE);
+    UINT width = count * himl->cx;
 
     if ((ilc >= ILC_COLOR4 && ilc <= ILC_COLOR32) || ilc == ILC_COLOR)
     {




More information about the wine-cvs mailing list