Alexandre Julliard : comctl32: Fixed handling of monochrome icons in image lists.

Alexandre Julliard julliard at winehq.org
Wed Nov 14 07:31:00 CST 2007


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Nov 14 12:38:35 2007 +0100

comctl32: Fixed handling of monochrome icons in image lists.

---

 dlls/comctl32/imagelist.c |   34 +++++++++++++++++++++++-----------
 1 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index ee1ef0e..c604abc 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -2291,8 +2291,6 @@ ImageList_ReplaceIcon (HIMAGELIST himl, INT nIndex, HICON hIcon)
         return -1;
     }
 
-    if (ii.hbmColor == 0)
-	ERR("no color!\n");
     ret = GetObjectW (ii.hbmMask, sizeof(BITMAP), (LPVOID)&bmp);
     if (!ret) {
         ERR("couldn't get mask bitmap info\n");
@@ -2317,18 +2315,32 @@ ImageList_ReplaceIcon (HIMAGELIST himl, INT nIndex, HICON hIcon)
     if (hdcImage == 0)
 	ERR("invalid hdcImage!\n");
 
+    imagelist_point_from_index(himl, nIndex, &pt);
+
     SetTextColor(himl->hdcImage, RGB(0,0,0));
     SetBkColor  (himl->hdcImage, RGB(255,255,255));
-    hbmOldSrc = SelectObject (hdcImage, ii.hbmColor);
-
-    imagelist_point_from_index(himl, nIndex, &pt);
-    StretchBlt (himl->hdcImage, pt.x, pt.y, himl->cx, himl->cy,
-                  hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);
 
-    if (himl->hbmMask) {
-        SelectObject (hdcImage, ii.hbmMask);
-        StretchBlt   (himl->hdcMask, pt.x, pt.y, himl->cx, himl->cy,
-                      hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);
+    if (ii.hbmColor)
+    {
+        hbmOldSrc = SelectObject (hdcImage, ii.hbmColor);
+        StretchBlt (himl->hdcImage, pt.x, pt.y, himl->cx, himl->cy,
+                    hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);
+        if (himl->hbmMask)
+        {
+            SelectObject (hdcImage, ii.hbmMask);
+            StretchBlt (himl->hdcMask, pt.x, pt.y, himl->cx, himl->cy,
+                        hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);
+        }
+    }
+    else
+    {
+        UINT height = bmp.bmHeight / 2;
+        hbmOldSrc = SelectObject (hdcImage, ii.hbmMask);
+        StretchBlt (himl->hdcImage, pt.x, pt.y, himl->cx, himl->cy,
+                    hdcImage, 0, height, bmp.bmWidth, height, SRCCOPY);
+        if (himl->hbmMask)
+            StretchBlt (himl->hdcMask, pt.x, pt.y, himl->cx, himl->cy,
+                        hdcImage, 0, 0, bmp.bmWidth, height, SRCCOPY);
     }
 
     SelectObject (hdcImage, hbmOldSrc);




More information about the wine-cvs mailing list