Clean up IntGdiRealizePalette by removing old and/or dead code, misleading descriptions and obsolete numbering.

svn path=/trunk/; revision=38608
This commit is contained in:
Gregor Schneider 2009-01-06 17:38:30 +00:00
parent 06332c431c
commit b85fc47c09

View file

@ -486,24 +486,20 @@ UINT FASTCALL IntGdiRealizePalette(HDC hDC)
{ {
/* /*
* This function doesn't do any real work now and there's plenty * This function doesn't do any real work now and there's plenty
* of bugs in it (calling SetPalette for high/true-color modes, * of bugs in it.
* using DEFAULT_PALETTE instead of the device palette, ...).
*/ */
PALOBJ *palPtr, *sysPtr;
PPALGDI palGDI, sysGDI; PPALGDI palGDI, sysGDI;
int realized = 0; int realized = 0;
PDC dc; PDC dc;
HPALETTE systemPalette; HPALETTE systemPalette;
//BOOLEAN success;
USHORT sysMode, palMode; USHORT sysMode, palMode;
dc = DC_LockDc(hDC); dc = DC_LockDc(hDC);
if (!dc) return 0; if (!dc) return 0;
systemPalette = NtGdiGetStockObject((INT)DEFAULT_PALETTE); systemPalette = NtGdiGetStockObject(DEFAULT_PALETTE);
palGDI = PALETTE_LockPalette(dc->DcLevel.hpal); palGDI = PALETTE_LockPalette(dc->DcLevel.hpal);
palPtr = (PALOBJ*) palGDI;
if (palGDI == NULL) if (palGDI == NULL)
{ {
@ -513,7 +509,6 @@ UINT FASTCALL IntGdiRealizePalette(HDC hDC)
} }
sysGDI = PALETTE_LockPalette(systemPalette); sysGDI = PALETTE_LockPalette(systemPalette);
sysPtr = (PALOBJ*) sysGDI;
if (sysGDI == NULL) if (sysGDI == NULL)
{ {
@ -523,35 +518,16 @@ UINT FASTCALL IntGdiRealizePalette(HDC hDC)
return 0; return 0;
} }
// Step 1: Create mapping of system palette\DC palette
#ifndef NO_MAPPING
realized = PALETTE_SetMapping(palPtr, 0, palGDI->NumColors,
(dc->DcLevel.hpal != hPrimaryPalette) ||
(dc->DcLevel.hpal == NtGdiGetStockObject(DEFAULT_PALETTE)));
#else
realized = 0;
#endif
// Step 2:
// The RealizePalette function modifies the palette for the device associated with the specified device context. If the // The RealizePalette function modifies the palette for the device associated with the specified device context. If the
// device context is a memory DC, the color table for the bitmap selected into the DC is modified. If the device // device context is a memory DC, the color table for the bitmap selected into the DC is modified. If the device
// context is a display DC, the physical palette for that device is modified. // context is a display DC, the physical palette for that device is modified.
if(dc->DC_Type == DC_TYPE_MEMORY) if(dc->DC_Type == DC_TYPE_MEMORY)
{ {
// Memory managed DC // Memory managed DC
DPRINT1("win32k: realizepalette unimplemented step 2 for DC_MEMORY\n"); DPRINT1("RealizePalette unimplemented for memory managed DCs\n");
} else { } else
DPRINT1("win32k: realizepalette commented out step 2\n"); {
/* See bug 733, keep the code for now. DPRINT1("RealizePalette unimplemented for device DCs\n");
if( ((GDIDEVICE *)dc->pPDev)->DriverFunctions.SetPalette)
{
ASSERT(palGDI->NumColors <= 256);
success = ((GDIDEVICE *)dc->pPDev)->DriverFunctions.SetPalette(
dc->PDev, palPtr, 0, 0, palGDI->NumColors);
}*/
} }
// need to pass this to IntEngCreateXlate with palettes unlocked // need to pass this to IntEngCreateXlate with palettes unlocked
@ -560,7 +536,7 @@ UINT FASTCALL IntGdiRealizePalette(HDC hDC)
PALETTE_UnlockPalette(sysGDI); PALETTE_UnlockPalette(sysGDI);
PALETTE_UnlockPalette(palGDI); PALETTE_UnlockPalette(palGDI);
// Step 3: Create the XLATEOBJ for device managed DCs // Create the XLATEOBJ for device managed DCs
if(dc->DC_Type != DC_TYPE_MEMORY) if(dc->DC_Type != DC_TYPE_MEMORY)
{ {
// Device managed DC // Device managed DC