Author: gschneider
Date: Wed Apr 15 01:30:03 2009
New Revision: 40510

URL: http://svn.reactos.org/svn/reactos?rev=40510&view=rev
Log:
- ICON_CreateCursorFromData should pass a header that fits to the bitmap data 
to SetDIBits to allow color conversion if necessary; create the color cursor if 
requested in the same function
- Winamp 2.95 now shows a custom cursor, but it's still surrounded by 
blackness, bug #4370
- Misc typo fixes, cleanup

Modified:
    trunk/reactos/dll/win32/user32/windows/bitmap.c
    trunk/reactos/dll/win32/user32/windows/icon.c

Modified: trunk/reactos/dll/win32/user32/windows/bitmap.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/bitmap.c?rev=40510&r1=40509&r2=40510&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/bitmap.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/bitmap.c [iso-8859-1] Wed Apr 15 
01:30:03 2009
@@ -56,8 +56,7 @@
 
 #include "poppack.h"
 
-/*forward declerations... actualy in user32\windows\icon.c but usful here****/
-HICON ICON_CreateCursorFromData(HDC hDC, PVOID ImageData, ICONIMAGE* 
IconImage, int cxDesired, int cyDesired, int xHotspot, int yHotspot);
+/* forward declerations... actually in user32\windows\icon.c but usful here */
 HICON ICON_CreateIconFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, 
int cxDesired, int cyDesired, int xHotspot, int yHotspot);
 CURSORICONDIRENTRY *CURSORICON_FindBestIcon( CURSORICONDIR *dir, int width, 
int height, int colors);
 CURSORICONDIRENTRY *CURSORICON_FindBestCursor( CURSORICONDIR *dir, int width, 
int height, int colors);

Modified: trunk/reactos/dll/win32/user32/windows/icon.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/icon.c?rev=40510&r1=40509&r2=40510&view=diff
==============================================================================
--- 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 
01:30:03 2009
@@ -94,9 +94,9 @@
 HICON
 ICON_CreateCursorFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int 
cxDesired, int cyDesired, int xHotspot, int yHotspot)
 {
-   /* FIXME - color cursors */
    BYTE BitmapInfoBuffer[sizeof(BITMAPINFOHEADER) + 2 * sizeof(RGBQUAD)];
    BITMAPINFO *bwBIH = (BITMAPINFO *)BitmapInfoBuffer;
+   BITMAPINFO *orgBIH = (BITMAPINFO *)IconImage;
    ICONINFO IconInfo;
    PVOID XORImageData = ImageData;
 
@@ -104,7 +104,7 @@
    IconInfo.xHotspot = xHotspot;
    IconInfo.yHotspot = yHotspot;
 
-   /* Create a BITMAPINFO header for the monocrome part of the icon */
+   /* Create a BITMAPINFO header for the monochrome part of the icon */
    bwBIH->bmiHeader.biBitCount = 1;
    bwBIH->bmiHeader.biWidth = IconImage->icHeader.biWidth;
    bwBIH->bmiHeader.biHeight = IconImage->icHeader.biHeight;
@@ -133,10 +133,24 @@
    if (IconInfo.hbmMask)
    {
       SetDIBits(hDC, IconInfo.hbmMask, 0, IconImage->icHeader.biHeight,
-                XORImageData, bwBIH, DIB_RGB_COLORS);
+                XORImageData, orgBIH, DIB_RGB_COLORS);
    }
 
-   IconInfo.hbmColor = (HBITMAP)0;
+   if (IconImage->icHeader.biBitCount == 1)
+   {
+      IconInfo.hbmColor = (HBITMAP)0;
+   }
+   else
+   {
+      /* Create the color part of the icon */
+      IconInfo.hbmColor = CreateDIBitmap(hDC, &IconImage->icHeader, 0,
+                                          XORImageData, orgBIH, 
DIB_RGB_COLORS);
+      if (IconInfo.hbmColor)
+      {
+         SetDIBits(hDC, IconInfo.hbmColor, 0, IconImage->icHeader.biHeight,
+                   XORImageData, orgBIH, DIB_RGB_COLORS);
+      }
+   }
 
    /* Create the icon based on everything we have so far */
    return NtUserCreateCursorIconHandle(&IconInfo, FALSE);

Reply via email to