- 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
This commit is contained in:
Aleksey Bragin
2008-07-23 18:20:32 +00:00
parent 4246bf6783
commit 3383fdae0a
+14 -23
View File
@@ -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);