Commit in reactos/subsys/win32k on ros-branch-0_2_3
include/palette.h+21.8 -> 1.8.4.1
objects/dib.c+7-81.50 -> 1.50.2.1
       /palette.c+47-51.18 -> 1.18.4.1
+56-13
3 modified files
Merge from HEAD:
- Convert between RGBQUAD and PALETTEENTRY

reactos/subsys/win32k/include
palette.h 1.8 -> 1.8.4.1
diff -u -r1.8 -r1.8.4.1
--- palette.h	9 Apr 2004 20:03:18 -0000	1.8
+++ palette.h	22 Jun 2004 20:09:57 -0000	1.8.4.1
@@ -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.50 -> 1.50.2.1
diff -u -r1.50 -r1.50.2.1
--- dib.c	30 May 2004 14:01:13 -0000	1.50
+++ dib.c	22 Jun 2004 20:09:59 -0000	1.50.2.1
@@ -1,5 +1,5 @@
 /*
- * $Id: dib.c,v 1.50 2004/05/30 14:01:13 weiden Exp $
+ * $Id: dib.c,v 1.50.2.1 2004/06/22 20:09:59 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;
@@ -1093,7 +1092,7 @@
     bm.bmBits = EngAllocUserMem(totalSize, 0);
   }
 
-/*  bm.bmBits = ExAllocatePool(NonPagedPool, totalSize); */
+/*  bm.bmBits = ExAllocatePool(PagedPool, totalSize); */
 
   if(usage == DIB_PAL_COLORS)
     memcpy(bmi->bmiColors, (UINT *)DIB_MapPaletteColors(dc, bmi), sizeof(UINT *));
@@ -1165,7 +1164,7 @@
     if(bi->biBitCount == 4) { Entries = 16; } else
     if(bi->biBitCount == 8) { Entries = 256; }
 
-    bmp->ColorMap = ExAllocatePoolWithTag(NonPagedPool, sizeof(RGBQUAD)*Entries, TAG_COLORMAP);
+    bmp->ColorMap = ExAllocatePoolWithTag(PagedPool, sizeof(RGBQUAD)*Entries, TAG_COLORMAP);
     RtlCopyMemory(bmp->ColorMap, bmi->bmiColors, sizeof(RGBQUAD)*Entries);
   }
 
@@ -1343,7 +1342,7 @@
       nNumColors = min(nNumColors, lpbmi->bmiHeader.biClrUsed);
     }
 
-  lpRGB = (RGBQUAD *)ExAllocatePoolWithTag(NonPagedPool, sizeof(RGBQUAD) * nNumColors, TAG_COLORMAP);
+  lpRGB = (RGBQUAD *)ExAllocatePoolWithTag(PagedPool, sizeof(RGBQUAD) * nNumColors, TAG_COLORMAP);
   lpIndex = (USHORT *)&lpbmi->bmiColors[0];
 
   for (i = 0; i < nNumColors; i++)
@@ -1416,7 +1415,7 @@
 
   if (PAL_INDEXED == *paletteType)
     {
-      palEntries = ExAllocatePoolWithTag(NonPagedPool, sizeof(PALETTEENTRY)*ColorCount, TAG_COLORMAP);
+      palEntries = ExAllocatePoolWithTag(PagedPool, sizeof(PALETTEENTRY)*ColorCount, TAG_COLORMAP);
       DIBColorTableToPaletteEntries(palEntries, bmi->bmiColors, ColorCount);
     }
   hPal = PALETTE_AllocPalette( *paletteType, ColorCount, (ULONG*)palEntries, 0, 0, 0 );

reactos/subsys/win32k/objects
palette.c 1.18 -> 1.18.4.1
diff -u -r1.18 -r1.18.4.1
--- palette.c	10 May 2004 17:07:20 -0000	1.18
+++ palette.c	22 Jun 2004 20:09:59 -0000	1.18.4.1
@@ -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.18 2004/05/10 17:07:20 weiden Exp $ */
+/* $Id: palette.c,v 1.18.4.1 2004/06/22 20:09:59 gvg Exp $ */
 #include <w32k.h>
 
 #ifndef NO_MAPPING
@@ -72,7 +72,7 @@
 
   if (NULL != Colors)
     {
-      PalGDI->IndexedColors = ExAllocatePoolWithTag(NonPagedPool, sizeof(PALETTEENTRY) * NumColors, TAG_PALETTE);
+      PalGDI->IndexedColors = ExAllocatePoolWithTag(PagedPool, sizeof(PALETTEENTRY) * NumColors, TAG_PALETTE);
       if (NULL == PalGDI->IndexedColors)
 	{
 	  PALETTE_UnlockPalette(NewPalette);
@@ -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)
 {
@@ -110,7 +152,7 @@
   const PALETTEENTRY* __sysPalTemplate = (const PALETTEENTRY*)COLOR_GetSystemPaletteTemplate();
 
   // create default palette (20 system colors)
-  palPtr = ExAllocatePoolWithTag(NonPagedPool, sizeof(LOGPALETTE) + (NB_RESERVED_COLORS * sizeof(PALETTEENTRY)), TAG_PALETTE);
+  palPtr = ExAllocatePoolWithTag(PagedPool, sizeof(LOGPALETTE) + (NB_RESERVED_COLORS * sizeof(PALETTEENTRY)), TAG_PALETTE);
   if (!palPtr) return FALSE;
 
   palPtr->palVersion = 0x300;
@@ -130,7 +172,7 @@
   palObj = (PALOBJ*)PALETTE_LockPalette(hpalette);
   if (palObj)
   {
-    if (!(palObj->mapping = ExAllocatePool(NonPagedPool, sizeof(int) * 20)))
+    if (!(palObj->mapping = ExAllocatePool(PagedPool, sizeof(int) * 20)))
     {
       DbgPrint("Win32k: Can not create palette mapping -- out of memory!");
       return FALSE;
@@ -199,7 +241,7 @@
   //mapping = HeapReAlloc( GetProcessHeap(), 0, palPtr->mapping,
   //                       sizeof(int)*palPtr->logpalette->palNumEntries);
   ExFreePool(palPtr->mapping);
-  mapping = ExAllocatePoolWithTag(NonPagedPool, sizeof(int)*palGDI->NumColors, TAG_PALETTEMAP);
+  mapping = ExAllocatePoolWithTag(PagedPool, sizeof(int)*palGDI->NumColors, TAG_PALETTEMAP);
 
   palPtr->mapping = mapping;
 
CVSspam 0.2.8