Commit 18265309 authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent a19defdf
...@@ -1907,8 +1907,11 @@ ImageList_LoadImageW (HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow, ...@@ -1907,8 +1907,11 @@ ImageList_LoadImageW (HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow,
} }
if (uType == IMAGE_BITMAP) { if (uType == IMAGE_BITMAP) {
BITMAP bmp; DIBSECTION dib;
GetObjectW (handle, sizeof(BITMAP), &bmp); 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 /* To match windows behavior, if cx is set to zero and
the flag DI_DEFAULTSIZE is specified, cx becomes the the flag DI_DEFAULTSIZE is specified, cx becomes the
...@@ -1919,13 +1922,12 @@ ImageList_LoadImageW (HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow, ...@@ -1919,13 +1922,12 @@ ImageList_LoadImageW (HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow,
if (uFlags & DI_DEFAULTSIZE) if (uFlags & DI_DEFAULTSIZE)
cx = GetSystemMetrics (SM_CXICON); cx = GetSystemMetrics (SM_CXICON);
else 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, himl = ImageList_Create (cx, dib.dsBm.bmHeight, ILC_MASK | color, nImageCount, cGrow);
nImageCount, cGrow);
if (!himl) { if (!himl) {
DeleteObject (handle); DeleteObject (handle);
return NULL; return NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment