From f0264e4afc1d0054a594236348cd946c21c98bc2 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 17 Jan 2011 01:22:16 +0000 Subject: [PATCH] [USER32] Fix CreateIcon and CreateIconIndirect. Fixes user32_winetest:cursoricon. (Yes we execute less tests, but that is correct! wine probably only passes these tests by chance) svn path=/trunk/; revision=50408 --- reactos/dll/win32/user32/windows/cursoricon.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/reactos/dll/win32/user32/windows/cursoricon.c b/reactos/dll/win32/user32/windows/cursoricon.c index 5825d1cec6e..32b0ffde97a 100644 --- a/reactos/dll/win32/user32/windows/cursoricon.c +++ b/reactos/dll/win32/user32/windows/cursoricon.c @@ -1173,13 +1173,21 @@ HICON WINAPI CreateIcon( iinfo.fIcon = TRUE; iinfo.xHotspot = nWidth / 2; iinfo.yHotspot = nHeight / 2; - iinfo.hbmMask = CreateBitmap( nWidth, nHeight, 1, 1, lpANDbits ); - iinfo.hbmColor = CreateBitmap( nWidth, nHeight, bPlanes, bBitsPixel, lpXORbits ); + if (bPlanes * bBitsPixel > 1) + { + iinfo.hbmColor = CreateBitmap( nWidth, nHeight, bPlanes, bBitsPixel, lpXORbits ); + iinfo.hbmMask = CreateBitmap( nWidth, nHeight, 1, 1, lpANDbits ); + } + else + { + iinfo.hbmMask = CreateBitmap( nWidth, nHeight * 2, 1, 1, lpANDbits ); + iinfo.hbmColor = NULL; + } hIcon = CreateIconIndirect( &iinfo ); DeleteObject( iinfo.hbmMask ); - DeleteObject( iinfo.hbmColor ); + if (iinfo.hbmColor) DeleteObject( iinfo.hbmColor ); return hIcon; } @@ -1498,7 +1506,7 @@ HICON WINAPI CreateIconIndirect(PICONINFO iconinfo) } else { - mask = CreateBitmap( width, height, 1, 1, NULL ); + mask = CreateBitmap( width, height * 2, 1, 1, NULL ); if(!mask) { ERR("Unable to create mask bitmap!\n");