[WIN32K]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 12 Feb 2011 20:30:09 +0000 (20:30 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 12 Feb 2011 20:30:09 +0000 (20:30 +0000)
Handle BITMAPV4HEADER and BITMAPV5HEADER, when creating a DIB palette. Detect PAL_RGB like done with PAL_BGR in PALETTE_AllocPalette (optimization).
Fixes pink icons.

svn path=/trunk/; revision=50676

reactos/subsystems/win32/win32k/objects/dibobj.c
reactos/subsystems/win32/win32k/objects/palette.c

index 6ab2f6c..1dfa534 100644 (file)
@@ -1750,9 +1750,19 @@ BuildDIBPalette(CONST BITMAPINFO *bmi)
     else if (bmi->bmiHeader.biCompression == BI_BITFIELDS)
     {
         paletteType = PAL_BITFIELDS;
-        RedMask = pdwColors[0];
-        GreenMask = pdwColors[1];
-        BlueMask = pdwColors[2];
+        if (bmi->bmiHeader.biSize >= sizeof(BITMAPV4HEADER))
+        {
+            PBITMAPV4HEADER pV4Header = (PBITMAPV4HEADER)&bmi->bmiHeader;
+            RedMask = pV4Header->bV4RedMask;
+            GreenMask = pV4Header->bV4GreenMask;
+            BlueMask = pV4Header->bV4BlueMask;
+        }
+        else
+        {
+            RedMask = pdwColors[0];
+            GreenMask = pdwColors[1];
+            BlueMask = pdwColors[2];
+        }
     }
     else
     {
index 860813c..38a4532 100644 (file)
@@ -197,6 +197,8 @@ PALETTE_AllocPalette(ULONG Mode,
             PalGDI->flFlags |= PAL_RGB16_565;
         else if (Red == 0xFF0000 && Green == 0xFF00 && Blue == 0xFF)
             PalGDI->flFlags |= PAL_BGR;
+        else if (Red == 0xFF && Green == 0xFF00 && Blue == 0xFF0000)
+            PalGDI->flFlags |= PAL_RGB;
     }
 
     PALETTE_UnlockPalette(PalGDI);