Alexandre Julliard : comctl32: Use the appropriate color format when loading a DIB in ImageList_LoadImageW .

Alexandre Julliard julliard at winehq.org
Thu Oct 14 10:56:21 CDT 2010


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Oct 14 10:13:58 2010 +0200

comctl32: Use the appropriate color format when loading a DIB in ImageList_LoadImageW.

---

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

diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index 9396b95..2e1581e 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -1907,8 +1907,11 @@ ImageList_LoadImageW (HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow,
     }
 
     if (uType == IMAGE_BITMAP) {
-        BITMAP bmp;
-        GetObjectW (handle, sizeof(BITMAP), &bmp);
+        DIBSECTION dib;
+        UINT color;
+
+        if (GetObjectW (handle, sizeof(dib), &dib) == sizeof(BITMAP)) color = ILC_COLOR;
+        else color = dib.dsBm.bmBitsPixel;
 
         /* To match windows behavior, if cx is set to zero and
          the flag DI_DEFAULTSIZE is specified, cx becomes the
@@ -1919,13 +1922,12 @@ ImageList_LoadImageW (HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow,
             if (uFlags & DI_DEFAULTSIZE)
                 cx = GetSystemMetrics (SM_CXICON);
             else
-                cx = bmp.bmHeight;
+                cx = dib.dsBm.bmHeight;
         }
 
-        nImageCount = bmp.bmWidth / cx;
+        nImageCount = dib.dsBm.bmWidth / cx;
 
-        himl = ImageList_Create (cx, bmp.bmHeight, ILC_MASK | ILC_COLOR,
-                                 nImageCount, cGrow);
+        himl = ImageList_Create (cx, dib.dsBm.bmHeight, ILC_MASK | color, nImageCount, cGrow);
         if (!himl) {
             DeleteObject (handle);
             return NULL;




More information about the wine-cvs mailing list