Author: gschneider
Date: Wed Apr 15 19:39:46 2009
New Revision: 40528
URL:
http://svn.reactos.org/svn/reactos?rev=40528&view=rev
Log:
- CreateIcon: create color bitmap only if bitsPixel specifies a non-monochrome icon
- CreateCursorIconHandle: set hotspot for icons based on the bitmap size
- Fixes seven user32 cursoricon winetests
Modified:
trunk/reactos/dll/win32/user32/windows/icon.c
trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
Modified: trunk/reactos/dll/win32/user32/windows/icon.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/i…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/icon.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/icon.c [iso-8859-1] Wed Apr 15 19:39:46 2009
@@ -202,11 +202,19 @@
{
return (HICON)0;
}
- IconInfo.hbmColor = CreateBitmap(nWidth, nHeight, cPlanes, cBitsPixel, XORbits);
- if(!IconInfo.hbmColor)
+
+ if (cBitsPixel == 1)
{
- DeleteObject(IconInfo.hbmMask);
- return (HICON)0;
+ IconInfo.hbmColor = (HBITMAP)0;
+ }
+ else
+ {
+ IconInfo.hbmColor = CreateBitmap(nWidth, nHeight, cPlanes, cBitsPixel, XORbits);
+ if(!IconInfo.hbmColor)
+ {
+ DeleteObject(IconInfo.hbmMask);
+ return (HICON)0;
+ }
}
return NtUserCreateCursorIconHandle(&IconInfo, FALSE);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c [iso-8859-1] Wed Apr 15
19:39:46 2009
@@ -541,6 +541,7 @@
Status = MmCopyFromCaller(&CurIcon->IconInfo, IconInfo, sizeof(ICONINFO));
if(NT_SUCCESS(Status))
{
+ /* Copy bitmaps and size info */
if(Indirect)
{
CurIcon->IconInfo.hbmMask =
BITMAP_CopyBitmap(CurIcon->IconInfo.hbmMask);
@@ -560,10 +561,17 @@
if (CurIcon->IconInfo.hbmColor == NULL)
{
CurIcon->Size.cx = psurfBmp->SurfObj.sizlBitmap.cx;
- CurIcon->Size.cy = psurfBmp->SurfObj.sizlBitmap.cy / 2;
+ CurIcon->Size.cy = psurfBmp->SurfObj.sizlBitmap.cy;
}
SURFACE_UnlockSurface(psurfBmp);
GDIOBJ_SetOwnership(CurIcon->IconInfo.hbmMask, NULL);
+ }
+
+ /* Calculate icon hotspot */
+ if (CurIcon->IconInfo.fIcon == TRUE)
+ {
+ CurIcon->IconInfo.xHotspot = CurIcon->Size.cx >> 1;
+ CurIcon->IconInfo.yHotspot = CurIcon->Size.cy >> 1;
}
}
else