From 93047e275e18298b4f885b666a54b5f7c887b8de Mon Sep 17 00:00:00 2001 From: Christian Costa Date: Mon, 7 Nov 2005 11:07:43 +0000 Subject: [PATCH] When creating black & white cursor icon, handle special case where hbmColor is null and hbmMask specify a bitmap having twice the height and formatted so the upper half is the icon AND bitmask and the lower one is the OR bitmask. --- dlls/user/cursoricon.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dlls/user/cursoricon.c b/dlls/user/cursoricon.c index d8edb6b00bc..98c093ff031 100644 --- a/dlls/user/cursoricon.c +++ b/dlls/user/cursoricon.c @@ -1807,10 +1807,10 @@ HICON WINAPI CreateIconIndirect(PICONINFO iconinfo) HICON16 hObj; int sizeXor,sizeAnd; - GetObjectA( iconinfo->hbmColor, sizeof(bmpXor), &bmpXor ); + if (iconinfo->hbmColor) GetObjectA( iconinfo->hbmColor, sizeof(bmpXor), &bmpXor ); GetObjectA( iconinfo->hbmMask, sizeof(bmpAnd), &bmpAnd ); - sizeXor = bmpXor.bmHeight * bmpXor.bmWidthBytes; + sizeXor = iconinfo->hbmColor ? (bmpXor.bmHeight * bmpXor.bmWidthBytes) : 0; sizeAnd = bmpAnd.bmHeight * bmpAnd.bmWidthBytes; hObj = GlobalAlloc16( GMEM_MOVEABLE, @@ -1833,16 +1833,16 @@ HICON WINAPI CreateIconIndirect(PICONINFO iconinfo) info->ptHotSpot.y = iconinfo->yHotspot; } - info->nWidth = bmpXor.bmWidth; - info->nHeight = bmpXor.bmHeight; - info->nWidthBytes = bmpXor.bmWidthBytes; - info->bPlanes = bmpXor.bmPlanes; - info->bBitsPerPixel = bmpXor.bmBitsPixel; + info->nWidth = bmpAnd.bmWidth; + info->nHeight = iconinfo->hbmColor ? bmpAnd.bmHeight : (bmpAnd.bmHeight / 2); + info->nWidthBytes = bmpAnd.bmWidthBytes; + info->bPlanes = bmpAnd.bmPlanes; + info->bBitsPerPixel = bmpAnd.bmBitsPixel; /* Transfer the bitmap bits to the CURSORICONINFO structure */ - GetBitmapBits( iconinfo->hbmMask ,sizeAnd,(char*)(info + 1) ); - GetBitmapBits( iconinfo->hbmColor,sizeXor,(char*)(info + 1) +sizeAnd); + GetBitmapBits( iconinfo->hbmMask, sizeAnd, (char*)(info + 1) ); + if (iconinfo->hbmColor) GetBitmapBits( iconinfo->hbmColor, sizeXor, (char*)(info + 1) + sizeAnd ); GlobalUnlock16( hObj ); } return HICON_32(hObj); -- 2.11.4.GIT