Alexandre Julliard : comctl32/imagelist: Don' t select the mask bitmap into a DC, it may already be selected.

Alexandre Julliard julliard at winehq.org
Tue Jun 1 12:12:44 CDT 2010


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jun  1 16:25:47 2010 +0200

comctl32/imagelist: Don't select the mask bitmap into a DC, it may already be selected.

---

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

diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index d67672f..f699fb3 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -143,7 +143,6 @@ static BOOL add_with_alpha( HIMAGELIST himl, HDC hdc, int pos, int count,
                             int width, int height, HBITMAP hbmImage, HBITMAP hbmMask )
 {
     BOOL ret = FALSE;
-    HDC hdcMask = 0;
     BITMAP bm;
     BITMAPINFO *info, *mask_info = NULL;
     DWORD *bits = NULL;
@@ -184,8 +183,6 @@ static BOOL add_with_alpha( HIMAGELIST himl, HDC hdc, int pos, int count,
         mask_info->bmiHeader.biSizeImage = mask_width * height;
         if (!(mask_bits = HeapAlloc( GetProcessHeap(), 0, info->bmiHeader.biSizeImage ))) goto done;
         if (!GetDIBits( hdc, hbmMask, 0, height, mask_bits, mask_info, DIB_RGB_COLORS )) goto done;
-        hdcMask = CreateCompatibleDC( 0 );
-        SelectObject( hdcMask, hbmMask );
     }
 
     for (n = 0; n < count; n++)
@@ -207,8 +204,6 @@ static BOOL add_with_alpha( HIMAGELIST himl, HDC hdc, int pos, int count,
                         bits[i * bm.bmWidth + j] |= 0xff000000;
                     else
                         bits[i * bm.bmWidth + j] = 0;
-            if (hdcMask) StretchBlt( himl->hdcMask, pt.x, pt.y, himl->cx, himl->cy,
-                                     hdcMask, n * width, 0, width, height, SRCCOPY );
         }
         else
         {
@@ -222,18 +217,17 @@ static BOOL add_with_alpha( HIMAGELIST himl, HDC hdc, int pos, int count,
                             mask_bits[i * mask_width + j / 8] &= ~(0x80 >> (j % 8));
                         else
                             mask_bits[i * mask_width + j / 8] |= 0x80 >> (j % 8);
-                StretchDIBits( himl->hdcMask, pt.x, pt.y, himl->cx, himl->cy,
-                               n * width, 0, width, height, mask_bits, mask_info, DIB_RGB_COLORS, SRCCOPY );
             }
         }
         StretchDIBits( himl->hdcImage, pt.x, pt.y, himl->cx, himl->cy,
                        n * width, 0, width, height, bits, info, DIB_RGB_COLORS, SRCCOPY );
-
+        if (mask_info)
+            StretchDIBits( himl->hdcMask, pt.x, pt.y, himl->cx, himl->cy,
+                           n * width, 0, width, height, mask_bits, mask_info, DIB_RGB_COLORS, SRCCOPY );
     }
     ret = TRUE;
 
 done:
-    if (hdcMask) DeleteDC( hdcMask );
     HeapFree( GetProcessHeap(), 0, info );
     HeapFree( GetProcessHeap(), 0, mask_info );
     HeapFree( GetProcessHeap(), 0, bits );




More information about the wine-cvs mailing list