[win32k]
authorGregor Schneider <grschneider@gmail.com>
Fri, 25 Dec 2009 17:54:41 +0000 (17:54 +0000)
committerGregor Schneider <grschneider@gmail.com>
Fri, 25 Dec 2009 17:54:41 +0000 (17:54 +0000)
- IntGetDIBColorTable: return the number of actually copied color table entries
- DIB_CreateDIBSection: simplify calculation of palette entry count
- IntHandleSpecialColorType: remove leftover debug print

svn path=/trunk/; revision=44761

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

index 6b13392..0bae35a 100644 (file)
@@ -682,10 +682,6 @@ VOID IntHandleSpecialColorType(HDC hDC, COLORREF* Color)
             {
                 *Color = RGB(palEntry.peRed, palEntry.peGreen, palEntry.peBlue);            
             }
-            else
-            {
-                DPRINT1("no wai!\n");
-            }
             DC_UnlockDc(pdc);
             break;
         case 0x01: /* PALETTEINDEX */
index 6a5d404..00a5d47 100644 (file)
@@ -149,7 +149,7 @@ IntGetDIBColorTable(
     PDC dc;
     PSURFACE psurf;
     PPALETTE PalGDI;
-    UINT Index;
+    UINT Index, Count = 0;
     ULONG biBitCount;
 
     if (!(dc = DC_LockDc(hDC))) return 0;
@@ -197,15 +197,14 @@ IntGetDIBColorTable(
             Colors[Index - StartIndex].rgbGreen = PalGDI->IndexedColors[Index].peGreen;
             Colors[Index - StartIndex].rgbBlue = PalGDI->IndexedColors[Index].peBlue;
             Colors[Index - StartIndex].rgbReserved = 0;
+            Count++;
         }
         PALETTE_UnlockPalette(PalGDI);
     }
-    else
-        Entries = 0;
 
     DC_UnlockDc(dc);
 
-    return Entries;
+    return Count;
 }
 
 // Converts a DIB to a device-dependent bitmap
@@ -1509,17 +1508,14 @@ DIB_CreateDIBSection(
                   table between the DIB and the X physical device. Obviously,
                   this is left out of the ReactOS implementation. Instead,
                   we call NtGdiSetDIBColorTable. */
-    bi->biClrUsed = 0;
-    /* set number of entries in bmi.bmiColors table */
-    if (bi->biBitCount == 1) {
-        bi->biClrUsed = 2;
-    } else
-        if (bi->biBitCount == 4) {
-            bi->biClrUsed = 16;
-        } else
-            if (bi->biBitCount == 8) {
-                bi->biClrUsed = 256;
-            }
+    if (bi->biBitCount <= 8)
+    {
+        bi->biClrUsed = 1 << bi->biBitCount;
+    }
+    else
+    {
+        bi->biClrUsed = 0;
+    }
 
     bmp->hDIBSection = section;
     bmp->hSecure = hSecure;