[WIN32K]
authorKamil Hornicek <kamil.hornicek@reactos.org>
Wed, 26 Oct 2016 10:21:46 +0000 (10:21 +0000)
committerKamil Hornicek <kamil.hornicek@reactos.org>
Wed, 26 Oct 2016 10:21:46 +0000 (10:21 +0000)
- fix a typo in the default logical palette copy
- fix color table computation for 8 bpp in GreGetDIBitsInternal (formula taken from gdi32:bitmap winetest)

svn path=/trunk/; revision=73038

reactos/win32ss/gdi/ntgdi/dibobj.c

index de52d51..6b0935c 100644 (file)
@@ -48,7 +48,7 @@ static const RGBQUAD DefLogPaletteQuads[20] =   /* Copy of Default Logical Palet
     { 0xf0, 0xfb, 0xff, 0x00 },
     { 0xa4, 0xa0, 0xa0, 0x00 },
     { 0x80, 0x80, 0x80, 0x00 },
-    { 0x00, 0x00, 0xf0, 0x00 },
+    { 0x00, 0x00, 0xff, 0x00 },
     { 0x00, 0xff, 0x00, 0x00 },
     { 0x00, 0xff, 0xff, 0x00 },
     { 0xff, 0x00, 0x00, 0x00 },
@@ -794,8 +794,8 @@ GreGetDIBitsInternal(
     case 8:
         Info->bmiHeader.biClrUsed = 0;
 
-        /* If the bitmap if a DIB section and has the same format than what
-         * we're asked, go ahead! */
+        /* If the bitmap is a DIB section and has the same format as what
+         * is requested, go ahead! */
         if((psurf->hSecure) &&
                 (BitsPerFormat(psurf->SurfObj.iBitmapFormat) == bpp))
         {
@@ -863,26 +863,17 @@ GreGetDIBitsInternal(
 
                 case 8:
                 {
-                    INT r, g, b;
-                    RGBQUAD *color;
-                    memcpy(rgbQuads, DefLogPaletteQuads,
-                           10 * sizeof(RGBQUAD));
-                    memcpy(rgbQuads + 246, DefLogPaletteQuads + 10,
-                           10 * sizeof(RGBQUAD));
-                    color = rgbQuads + 10;
-                    for(r = 0; r <= 5; r++) /* FIXME */
+                    INT i;
+
+                    memcpy(rgbQuads, DefLogPaletteQuads, 10 * sizeof(RGBQUAD));
+                    memcpy(rgbQuads + 246, DefLogPaletteQuads + 10, 10 * sizeof(RGBQUAD));
+
+                    for (i = 10; i < 246; i++)
                     {
-                        for(g = 0; g <= 5; g++)
-                        {
-                            for(b = 0; b <= 5; b++)
-                            {
-                                color->rgbRed =   (r * 0xff) / 5;
-                                color->rgbGreen = (g * 0xff) / 5;
-                                color->rgbBlue =  (b * 0xff) / 5;
-                                color->rgbReserved = 0;
-                                color++;
-                            }
-                        }
+                        rgbQuads[i].rgbRed = (i & 0x07) << 5;
+                        rgbQuads[i].rgbGreen = (i & 0x38) << 2;
+                        rgbQuads[i].rgbBlue = i & 0xc0;
+                        rgbQuads[i].rgbReserved = 0;
                     }
                 }
                 }