Better palette generating algorithm.
authorFilip Navara <filip.navara@gmail.com>
Tue, 13 Jan 2004 19:45:31 +0000 (19:45 +0000)
committerFilip Navara <filip.navara@gmail.com>
Tue, 13 Jan 2004 19:45:31 +0000 (19:45 +0000)
svn path=/trunk/; revision=7614

reactos/drivers/video/displays/framebuf/palette.c

index b054621..7e6272e 100644 (file)
@@ -63,7 +63,6 @@ IntInitDefaultPalette(
 {
    ULONG ColorLoop;
    PPALETTEENTRY PaletteEntryPtr;
-   BYTE Red = 0, Green = 0, Blue = 0;
 
    if (ppdev->BitsPerPixel > 8)
    {
@@ -73,8 +72,7 @@ IntInitDefaultPalette(
    }
    else
    {       
-      ppdev->PaletteEntries = EngAllocMem(FL_ZERO_MEMORY,
-         sizeof(PALETTEENTRY) << 8, ALLOC_TAG);
+      ppdev->PaletteEntries = EngAllocMem(0, sizeof(PALETTEENTRY) << 8, ALLOC_TAG);
       if (ppdev->PaletteEntries == NULL)
       {
          return FALSE;
@@ -84,14 +82,10 @@ IntInitDefaultPalette(
            ColorLoop != 0;
            ColorLoop--, PaletteEntryPtr++)
       {
-         PaletteEntryPtr->peRed = Red;
-         PaletteEntryPtr->peGreen = Green;
-         PaletteEntryPtr->peBlue = Blue;
+         PaletteEntryPtr->peRed = ((ColorLoop >> 5) & 7) * 255 / 7;
+         PaletteEntryPtr->peGreen = ((ColorLoop >> 3) & 3) * 255 / 3;
+         PaletteEntryPtr->peBlue = (ColorLoop & 7) * 255 / 7;
          PaletteEntryPtr->peFlags = 0;
-
-         if (!(Red += 32))
-            if (!(Green += 32))
-               Blue += 64;
       }
 
       memcpy(ppdev->PaletteEntries, BASEPALETTE, 10 * sizeof(PALETTEENTRY));