- Allow creation of icons without color bitmap in CreateIconIndirect
authorGregor Schneider <grschneider@gmail.com>
Wed, 15 Apr 2009 12:36:37 +0000 (12:36 +0000)
committerGregor Schneider <grschneider@gmail.com>
Wed, 15 Apr 2009 12:36:37 +0000 (12:36 +0000)
- Compare color and mask size if color is present, compare height against height
- Fixes 13 user32 cursoricon winetests
- DbgPrint -> ERR or FIXME

svn path=/trunk/; revision=40526

reactos/dll/win32/user32/windows/bitmap.c
reactos/dll/win32/user32/windows/icon.c

index afe0e9c..17ff0d8 100644 (file)
@@ -285,7 +285,7 @@ LoadCursorIconImage(
 
    if (fuLoad & LR_SHARED)
    {
-      DbgPrint("FIXME: need LR_SHARED support for loading icon images from files\n");
+      FIXME("Need LR_SHARED support for loading icon images from files\n");
    }
 
    hFile = CreateFileW(lpszName, GENERIC_READ, FILE_SHARE_READ, NULL,
@@ -491,7 +491,7 @@ LoadBitmapImage(HINSTANCE hInstance, LPCWSTR lpszName, UINT fuLoad)
 
    if (Hit)
    {
-      DbgPrint("We have a thread overrun, these are already freed! pi -> %d bi -> %d\n", PrivateInfo, BitmapInfo);
+      ERR("We have a thread overrun, these are already freed! pi -> %d, bi -> %d\n", PrivateInfo, BitmapInfo);
       RtlFreeHeap(GetProcessHeap(), 0, PrivateInfo);
       if (fuLoad & LR_LOADFROMFILE)
          UnmapViewOfFile(BitmapInfo);
index e6c4ab9..65600fe 100644 (file)
@@ -345,20 +345,19 @@ CreateIconIndirect(PICONINFO IconInfo)
   {
     return (HICON)0;
   }
-  /* FIXME - does there really *have* to be a color bitmap? monochrome cursors don't have one */
-  if(/*IconInfo->hbmColor &&*/ !GetObjectW(IconInfo->hbmColor, sizeof(BITMAP), &ColorBitmap))
-  {
-    return (HICON)0;
-  }
 
-  /* FIXME - i doubt this is right (monochrome cursors */
-  /*if(ColorBitmap.bmWidth != MaskBitmap.bmWidth ||
-     ColorBitmap.bmHeight != MaskBitmap.bmWidth)
+  /* Try to get color bitmap */
+  if (GetObjectW(IconInfo->hbmColor, sizeof(BITMAP), &ColorBitmap))
   {
-    SetLastError(ERROR_INVALID_PARAMETER);
-    return (HICON)0;
-  }*/
-
+     /* Compare size of color and mask bitmap*/
+     if(ColorBitmap.bmWidth != MaskBitmap.bmWidth ||
+        ColorBitmap.bmHeight != MaskBitmap.bmHeight)
+     {
+        ERR("Color and mask size are different!");
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return (HICON)0;
+     }
+  }
   return (HICON)NtUserCreateCursorIconHandle(IconInfo, TRUE);
 }