[WIN32K]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Wed, 9 Jun 2010 18:08:23 +0000 (18:08 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Wed, 9 Jun 2010 18:08:23 +0000 (18:08 +0000)
If pbmiSrc->bmiHeader.bV5ClrUsed is 0, calculate the number of colors from the bit depth. Fixes black taskbar icons with vbox driver on 8 bpp

svn path=/branches/reactos-yarotows/; revision=47719

subsystems/win32/win32k/objects/dibobj.c

index 44c77aa..212e6d6 100644 (file)
@@ -1951,15 +1951,21 @@ GetBMIFromBitmapV5Info(IN PBITMAPV5INFO pbmiSrc,
     else
     {
         INT i;
+        ULONG cColorsUsed;
+
+        cColorsUsed = pbmiSrc->bmiHeader.bV5ClrUsed;
+        if (cColorsUsed == 0) 
+            cColorsUsed = (1 << pbmiSrc->bmiHeader.bV5BitCount);
+
         if(dwColorUse == DIB_PAL_COLORS)
         {
             RtlCopyMemory(pbmiDst->bmiColors,
                           pbmiSrc->bmiColors,
-                          pbmiSrc->bmiHeader.bV5ClrUsed * sizeof(WORD));
+                          cColorsUsed * sizeof(WORD));
         }
         else
         {
-            for(i = 0; i < pbmiSrc->bmiHeader.bV5ClrUsed; i++)
+            for(i = 0; i < cColorsUsed; i++)
             {
                 SetBMIColor(pbmiDst, (DWORD*)pbmiSrc->bmiColors + i, i);
             }