From 3383fdae0a8606c4c65c9d60cb3085a3e9c85fb0 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Wed, 23 Jul 2008 18:20:32 +0000 Subject: [PATCH] - 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. svn path=/trunk/; revision=34695 --- .../subsystems/win32/win32k/objects/color.c | 37 +++++++------------ 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/reactos/subsystems/win32/win32k/objects/color.c b/reactos/subsystems/win32/win32k/objects/color.c index 5d0c0c8c1d8..3703a7ab3c7 100644 --- a/reactos/subsystems/win32/win32k/objects/color.c +++ b/reactos/subsystems/win32/win32k/objects/color.c @@ -488,7 +488,7 @@ UINT FASTCALL IntGdiRealizePalette(HDC hDC) { /* * 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 @@ UINT FASTCALL IntGdiRealizePalette(HDC hDC) 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 @@ UINT FASTCALL IntGdiRealizePalette(HDC hDC) 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 @@ UINT FASTCALL IntGdiRealizePalette(HDC hDC) 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 @@ UINT FASTCALL IntGdiRealizePalette(HDC hDC) 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);