[ros-diffs] [fireball] 34695: - Partly revert 24104: "I do not known if I done right in NtGdiRealizePalette step2, step2 is not tested." - if you don't know, don't do at all! Memory DC "supports drawing operations on a bitmap" according to MSDN, so why changing device's palette? I think it was not done for a reason, and if you can't test, don't touch before you have a test application. - Reformat another part of 24104, and include warning messages too, to track palette failures. - Put two mandatory debug prints to see when the code is being hit (one to memory managed DC case, and another one to the code commented out by Jim). - Tested with abiword, FF 1.5 and 2.0, openoffice 2.0 installer, in 8, 24 and 32 bit color modes, no problem arised, and no debug messages flood happened.

fireball at svn.reactos.org fireball at svn.reactos.org
Wed Jul 23 20:20:32 CEST 2008


Author: fireball
Date: Wed Jul 23 13:20:32 2008
New Revision: 34695

URL: http://svn.reactos.org/svn/reactos?rev=34695&view=rev
Log:
- Partly revert 24104: "I do not known if I done right in NtGdiRealizePalette step2, step2 is not tested." - if you don't know, don't do at all!
Memory DC "supports drawing operations on a bitmap" according to MSDN, so why changing device's palette? I think it was not done for a reason, and if you can't test, don't touch before you have a test application.
- Reformat another part of 24104, and include warning messages too, to track palette failures.
- Put two mandatory debug prints to see when the code is being hit (one to memory managed DC case, and another one to the code commented out by Jim).
- Tested with abiword, FF 1.5 and 2.0, openoffice 2.0 installer, in 8, 24 and 32 bit color modes, no problem arised, and no debug messages flood happened.

Modified:
    trunk/reactos/subsystems/win32/win32k/objects/color.c

Modified: trunk/reactos/subsystems/win32/win32k/objects/color.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/color.c?rev=34695&r1=34694&r2=34695&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/color.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/color.c [iso-8859-1] Wed Jul 23 13:20:32 2008
@@ -488,7 +488,7 @@
 {
   /*
    * This function doesn't do any real work now and there's plenty
-   * of bugd in it (calling SetPalette for high/true-color modes,
+   * of bugs in it (calling SetPalette for high/true-color modes,
    * using DEFAULT_PALETTE instead of the device palette, ...).
    */
 
@@ -497,12 +497,11 @@
   int realized = 0;
   PDC dc;
   HPALETTE systemPalette;
-  BOOLEAN success;
+  //BOOLEAN success;
   USHORT sysMode, palMode;
 
   dc = DC_LockDc(hDC);
-  if (!dc)
-  	return 0;
+  if (!dc) return 0;
 
   systemPalette = NtGdiGetStockObject((INT)DEFAULT_PALETTE);
   palGDI = PALETTE_LockPalette(dc->DcLevel.hpal);
@@ -510,12 +509,9 @@
 
   if (palGDI == NULL)
   {
-	 /* FIXME - Handle palGDI == NULL!!!!
-	    we should not unlock dc and return 0 ??
-		shall we create the pallete ??
-	 */
-     DC_UnlockDc(dc);
-	 return 0;
+    DPRINT1("IntGdiRealizePalette(): palGDI is NULL, exiting\n");
+    DC_UnlockDc(dc);
+    return 0;
   }
 
   sysGDI = PALETTE_LockPalette(systemPalette);
@@ -523,13 +519,10 @@
 
   if (sysGDI == NULL)
   {
-	 /* FIXME - Handle sysGDI == NULL!!!!!
-	    we should not unlock dc and return 0 ??
-		shall we create the pallete ??
-	 */
-     PALETTE_UnlockPalette(palGDI);
-     DC_UnlockDc(dc);
-	 return 0;
+    DPRINT1("IntGdiRealizePalette(): sysGDI is NULL, exiting\n");
+    PALETTE_UnlockPalette(palGDI);
+    DC_UnlockDc(dc);
+    return 0;
   }
 
 
@@ -551,12 +544,10 @@
   if(dc->DC_Type == DC_TYPE_MEMORY)
   {
     // Memory managed DC
-	ASSERT(sysGDI->NumColors <= 256);
-	success = ((GDIDEVICE *)dc->pPDev)->DriverFunctions.SetPalette(
-		dc->PDev, sysPtr, 0, 0, sysGDI->NumColors);
-
-/* See bug 733, keep the code for now.
-   } else {
+    DPRINT1("win32k: realizepalette unimplemented step 2 for DC_MEMORY\n");
+  } else {
+    DPRINT1("win32k: realizepalette commented out step 2\n");
+   /* See bug 733, keep the code for now.
     if( ((GDIDEVICE *)dc->pPDev)->DriverFunctions.SetPalette)
     {
       ASSERT(palGDI->NumColors <= 256);



More information about the Ros-diffs mailing list