- Detect switched color and mask bitmaps in CreateCursorIndirect and switch them back

- Don't set the icon hotspot too early in CreateIcon
- Fixes five cursoricon winetests

svn path=/trunk/; revision=40531
This commit is contained in:
Gregor Schneider
2009-04-15 17:09:17 +00:00
parent 1c62287842
commit 32414442e2
+9 -3
View File
@@ -195,8 +195,6 @@ CreateIcon(
ICONINFO IconInfo;
IconInfo.fIcon = TRUE;
IconInfo.xHotspot = nWidth / 2;
IconInfo.yHotspot = nHeight / 2;
if (cBitsPixel == 1)
{
@@ -347,6 +345,7 @@ CreateIconIndirect(PICONINFO IconInfo)
{
BITMAP ColorBitmap;
BITMAP MaskBitmap;
HBITMAP hbmTemp;
if(!IconInfo)
{
@@ -363,13 +362,20 @@ CreateIconIndirect(PICONINFO IconInfo)
if (GetObjectW(IconInfo->hbmColor, sizeof(BITMAP), &ColorBitmap))
{
/* Compare size of color and mask bitmap*/
if(ColorBitmap.bmWidth != MaskBitmap.bmWidth ||
if (ColorBitmap.bmWidth != MaskBitmap.bmWidth ||
ColorBitmap.bmHeight != MaskBitmap.bmHeight)
{
ERR("Color and mask size are different!");
SetLastError(ERROR_INVALID_PARAMETER);
return (HICON)0;
}
/* Check if color and mask are switched and switch them back */
if (MaskBitmap.bmBitsPixel != 1 && ColorBitmap.bmBitsPixel == 1)
{
hbmTemp = IconInfo->hbmMask;
IconInfo->hbmMask = IconInfo->hbmColor;
IconInfo->hbmColor = hbmTemp;
}
}
return (HICON)NtUserCreateCursorIconHandle(IconInfo, TRUE);
}