PC_(EXPLICIT|NOCOLLAPSE|RESERVED) are bitflags
Glenn Wurster
gwurster at scs.carleton.ca
Thu Oct 14 23:37:26 CDT 2004
Authors:
Doug Paul <doug at elemental.ath.cx>,
Glenn Wurster <gwurster at scs.carleton.ca>
Description:
* Changed switch of PC_EXPLICIT, PC_NOCOLLAPSE, and PC_RESERVED to an
if statement, since if multiple flags are set it is not appropriate to
act as if none were set.
Changelog:
* Change reading of PC_(EXPLICIT|NOCOLLAPSE|RESERVED) to handle
multiple values
Index: dlls/x11drv/palette.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/palette.c,v
retrieving revision 1.7
diff -u -u -r1.7 palette.c
--- dlls/x11drv/palette.c 11 Aug 2004 23:45:34 -0000 1.7
+++ dlls/x11drv/palette.c 29 Sep 2004 04:46:47 -0000
@@ -1107,28 +1136,32 @@
index = -1;
flag = PC_SYS_USED;
- switch( palPtr->logpalette.palPalEntry[uStart].peFlags & 0x07 )
- {
- case PC_EXPLICIT: /* palette entries are indices into system palette */
+ /* Even though the docs say that only one flag is to be set,
+ * they are a bitmask. At least one app sets more than one at
+ * the same time. */
+ if ( palPtr->logpalette.palPalEntry[uStart].peFlags & PC_EXPLICIT ) {
+ /* palette entries are indices into system palette */
index = *(WORD*)(palPtr->logpalette.palPalEntry + uStart);
if( index > 255 || (index >= COLOR_gapStart && index <= COLOR_gapEnd) )
{
WARN("PC_EXPLICIT: idx %d out of system palette, assuming black.\n", index);
index = 0;
}
- break;
-
- case PC_RESERVED: /* forbid future mappings to this entry */
- flag |= PC_SYS_RESERVED;
+ if( X11DRV_PALETTE_PaletteToXPixel ) index = X11DRV_PALETTE_PaletteToXPixel[index];
+ } else {
+ if ( palPtr->logpalette.palPalEntry[uStart].peFlags & PC_RESERVED ) {
+ /* forbid future mappings to this entry */
+ flag |= PC_SYS_RESERVED;
+ }
+
+ if (! (palPtr->logpalette.palPalEntry[uStart].peFlags & PC_NOCOLLAPSE) ) {
+ /* try to collapse identical colors */
+ index = X11DRV_LookupSysPaletteExact(*(COLORREF*)(palPtr->logpalette.palPalEntry + uStart));
+ }
- /* fall through */
- default: /* try to collapse identical colors */
- index = X11DRV_LookupSysPaletteExact(*(COLORREF*)(palPtr->logpalette.palPalEntry + uStart));
- /* fall through */
- case PC_NOCOLLAPSE:
if( index < 0 )
{
- if( X11DRV_PALETTE_firstFree > 0 && !(X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_FIXED) )
+ if( X11DRV_PALETTE_firstFree > 0 )
{
XColor color;
index = X11DRV_PALETTE_firstFree; /* ought to be available */
@@ -1164,7 +1234,6 @@
palPtr->logpalette.palPalEntry[uStart].peFlags |= PC_SYS_USED;
if( X11DRV_PALETTE_PaletteToXPixel ) index = X11DRV_PALETTE_PaletteToXPixel[index];
- break;
}
if( !prevMapping || palPtr->mapping[uStart] != index ) iRemapped++;
More information about the wine-patches
mailing list