Commit in reactos/subsys/win32k on MAIN
include/palette.h+21.8 -> 1.9
objects/dib.c+3-41.51 -> 1.52
       /palette.c+43-11.19 -> 1.20
+48-5
3 modified files
Convert between RGBQUAD and PALETTEENTRY

reactos/subsys/win32k/include
palette.h 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- palette.h	9 Apr 2004 20:03:18 -0000	1.8
+++ palette.h	22 Jun 2004 20:08:16 -0000	1.9
@@ -33,6 +33,8 @@
                                        ULONG Red,
                                        ULONG Green,
                                        ULONG Blue);
+HPALETTE FASTCALL PALETTE_AllocPaletteIndexedRGB(ULONG NumColors,
+                                                 CONST RGBQUAD *Colors);
 #define  PALETTE_FreePalette(hPalette)  GDIOBJ_FreeObj((HGDIOBJ)hPalette, GDI_OBJECT_TYPE_PALETTE, GDIOBJFLAG_DEFAULT)
 #define  PALETTE_LockPalette(hPalette) ((PPALGDI)GDIOBJ_LockObj((HGDIOBJ)hPalette, GDI_OBJECT_TYPE_PALETTE))
 #define  PALETTE_UnlockPalette(hPalette) GDIOBJ_UnlockObj((HGDIOBJ)hPalette, GDI_OBJECT_TYPE_PALETTE)

reactos/subsys/win32k/objects
dib.c 1.51 -> 1.52
diff -u -r1.51 -r1.52
--- dib.c	20 Jun 2004 00:45:37 -0000	1.51
+++ dib.c	22 Jun 2004 20:08:17 -0000	1.52
@@ -1,5 +1,5 @@
 /*
- * $Id: dib.c,v 1.51 2004/06/20 00:45:37 navaraf Exp $
+ * $Id: dib.c,v 1.52 2004/06/22 20:08:17 gvg Exp $
  *
  * ReactOS W32 Subsystem
  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
@@ -54,9 +54,8 @@
 
       /* Rebuild the palette. */
       NtGdiDeleteObject(dc->w.hPalette);
-      dc->w.hPalette = PALETTE_AllocPalette(PAL_INDEXED,
-         1 << BitmapObj->dib->dsBmih.biBitCount,
-         (PULONG)BitmapObj->ColorMap, 0, 0, 0);
+      dc->w.hPalette = PALETTE_AllocPaletteIndexedRGB(1 << BitmapObj->dib->dsBmih.biBitCount,
+                                                      BitmapObj->ColorMap);
    }
    else
       Entries = 0;

reactos/subsys/win32k/objects
palette.c 1.19 -> 1.20
diff -u -r1.19 -r1.20
--- palette.c	20 Jun 2004 00:45:37 -0000	1.19
+++ palette.c	22 Jun 2004 20:08:17 -0000	1.20
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: palette.c,v 1.19 2004/06/20 00:45:37 navaraf Exp $ */
+/* $Id: palette.c,v 1.20 2004/06/22 20:08:17 gvg Exp $ */
 #include <w32k.h>
 
 #ifndef NO_MAPPING
@@ -98,6 +98,48 @@
   return NewPalette;
 }
 
+HPALETTE FASTCALL
+PALETTE_AllocPaletteIndexedRGB(ULONG NumColors,
+                               CONST RGBQUAD *Colors)
+{
+  HPALETTE NewPalette;
+  PPALGDI PalGDI;
+  unsigned i;
+
+  NewPalette = (HPALETTE) GDIOBJ_AllocObj(sizeof(PALGDI), GDI_OBJECT_TYPE_PALETTE, (GDICLEANUPPROC) PALETTE_InternalDelete);
+  if (NULL == NewPalette)
+    {
+      return NULL;
+    }
+
+  PalGDI = PALETTE_LockPalette(NewPalette);
+  ASSERT( PalGDI );
+
+  PalGDI->Self = NewPalette;
+  PalGDI->Mode = PAL_INDEXED;
+
+  PalGDI->IndexedColors = ExAllocatePoolWithTag(PagedPool, sizeof(PALETTEENTRY) * NumColors, TAG_PALETTE);
+  if (NULL == PalGDI->IndexedColors)
+    {
+      PALETTE_UnlockPalette(NewPalette);
+      PALETTE_FreePalette(NewPalette);
+      return NULL;
+    }
+  for (i = 0; i < NumColors; i++)
+    {
+      PalGDI->IndexedColors[i].peRed = Colors[i].rgbRed;
+      PalGDI->IndexedColors[i].peGreen = Colors[i].rgbGreen;
+      PalGDI->IndexedColors[i].peBlue = Colors[i].rgbBlue;
+      PalGDI->IndexedColors[i].peFlags = 0;
+    }
+
+  PalGDI->NumColors = NumColors;
+
+  PALETTE_UnlockPalette(NewPalette);
+
+  return NewPalette;
+}
+
 // Create the system palette
 HPALETTE FASTCALL PALETTE_Init(VOID)
 {
CVSspam 0.2.8