Mike McCormack : comctl32: Fix a potential regression in ImageList_ReplaceIcon().

Alexandre Julliard julliard at wine.codeweavers.com
Tue Nov 14 05:14:18 CST 2006


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

Author: Mike McCormack <mike at codeweavers.com>
Date:   Tue Nov 14 16:48:29 2006 +0900

comctl32: Fix a potential regression in ImageList_ReplaceIcon().

---

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

diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index b626584..17b267d 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -2253,6 +2253,7 @@ ImageList_ReplaceIcon (HIMAGELIST himl,
     BITMAP  bmp;
     BOOL    ret;
     POINT   pt;
+    INT     i;
 
     TRACE("(%p %d %p)\n", himl, i, hIcon);
 
@@ -2317,14 +2318,17 @@ ImageList_ReplaceIcon (HIMAGELIST himl,
     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);
+    for (i=0; i<(bmp.bmWidth/himl->cx); i++) {
 
-    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);
+        imagelist_point_from_index(himl, nIndex+i, &pt);
+        StretchBlt (himl->hdcImage, pt.x, pt.y, himl->cx, himl->cy,
+                      hdcImage, 0, 0, himl->cx*i, bmp.bmHeight, SRCCOPY);
+
+        if (himl->hbmMask) {
+            SelectObject (hdcImage, ii.hbmMask);
+            StretchBlt   (himl->hdcMask, pt.x, pt.y, himl->cx, himl->cy,
+                          hdcImage, 0, 0, himl->cx*i, bmp.bmHeight, SRCCOPY);
+        }
     }
 
     SelectObject (hdcImage, hbmOldSrc);




More information about the wine-cvs mailing list