From 746e0c9afdcf41091c188dba1ccfc4609e702376 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Wed, 14 Jul 2010 15:42:44 +0000 Subject: [PATCH] [USER32] - WINE creates an alpha bitmap on icon creation, we do it when drawing it, so we need to create a bitmap which holds alpha information. - Add error handling to CreateIconIndirect. svn path=/trunk/; revision=48041 --- reactos/dll/win32/user32/windows/cursoricon.c | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/reactos/dll/win32/user32/windows/cursoricon.c b/reactos/dll/win32/user32/windows/cursoricon.c index d0936a93b1c..0c88734834c 100644 --- a/reactos/dll/win32/user32/windows/cursoricon.c +++ b/reactos/dll/win32/user32/windows/cursoricon.c @@ -485,8 +485,8 @@ static BOOL create_icon_bitmaps( const BITMAPINFO *bmi, int width, int height, else { if (!(*mask = CreateBitmap( width, height, 1, 1, NULL ))) goto done; - if (!(*color = CreateBitmap( width, height, GetDeviceCaps( screen_dc, PLANES ), - GetDeviceCaps( screen_dc, BITSPIXEL ), NULL ))) + if (!(*color = CreateBitmap( width, height, bmi->bmiHeader.biPlanes, + bmi->bmiHeader.biBitCount, NULL ))) { DeleteObject( *mask ); goto done; @@ -1475,10 +1475,29 @@ HICON WINAPI CreateIconIndirect(PICONINFO iconinfo) height = bmpXor.bmHeight; if (bmpXor.bmPlanes * bmpXor.bmBitsPixel != 1) { - color = CreateCompatibleBitmap( screen_dc, width, height ); + color = CreateBitmap( width, height, bmpXor.bmPlanes, bmpXor.bmBitsPixel, NULL ); + if(!color) + { + ERR("Unable to create color bitmap!\n"); + return NULL; + } mask = CreateBitmap( width, height, 1, 1, NULL ); + if(!mask) + { + ERR("Unable to create mask bitmap!\n"); + DeleteObject(color); + return NULL; + } } - else mask = CreateBitmap( width, height * 2, 1, 1, NULL ); + else + { + mask = CreateBitmap( width, height * 2, 1, 1, NULL ); + if(!mask) + { + ERR("Unable to create mask bitmap!\n"); + return NULL; + } + } } else { -- 2.17.1