ChangeSet ID: 18073 CVSROOT: /opt/cvs-commit Module name: wine Changes by: julliard@wine.codeweavers.com 2005/06/10 14:31:20 Modified files: dlls/x11drv : palette.c Log message: Glenn Wurster Adds support for the DIBINDEX type of COLORREF. Patch: http://cvs.winehq.org/patch.py?id=18073 Old revision New revision Changes Path 1.14 1.15 +14 -4 wine/dlls/x11drv/palette.c Index: wine/dlls/x11drv/palette.c diff -u -p wine/dlls/x11drv/palette.c:1.14 wine/dlls/x11drv/palette.c:1.15 --- wine/dlls/x11drv/palette.c:1.14 Fri May 24 00:28:22 2013 +++ wine/dlls/x11drv/palette.c Fri May 24 00:28:22 2013 @@ -868,15 +868,25 @@ int X11DRV_PALETTE_ToPhysical( X11DRV_PD */ unsigned long red, green, blue; - unsigned idx = 0; + unsigned idx = color & 0xffff; + RGBQUAD quad; switch(spec_type) { + case 0x10: /* DIBINDEX */ + if( X11DRV_GetDIBColorTable( physDev, idx, 1, &quad ) != 1 ) { + WARN("DIBINDEX(%lx) : idx %d is out of bounds, assuming black\n", color , idx); + GDI_ReleaseObj( hPal ); + return 0; + } + color = RGB( quad.rgbRed, quad.rgbGreen, quad.rgbBlue ); + break; + case 1: /* PALETTEINDEX */ - if( (idx = color & 0xffff) >= palPtr->logpalette.palNumEntries) + if( idx >= palPtr->logpalette.palNumEntries) { - WARN("RGB(%lx) : idx %d is out of bounds, assuming black\n", color, idx); + WARN("PALETTEINDEX(%lx) : idx %d is out of bounds, assuming black\n", color, idx); GDI_ReleaseObj( hPal ); return 0; } @@ -965,7 +975,7 @@ int X11DRV_PALETTE_ToPhysical( X11DRV_PD index = color & 0xffff; if( index >= palPtr->logpalette.palNumEntries ) - WARN("RGB(%lx) : index %i is out of bounds\n", color, index); + WARN("PALETTEINDEX(%lx) : index %i is out of bounds\n", color, index); else if( palPtr->mapping ) index = palPtr->mapping[index]; /* TRACE(palette,"PALETTEINDEX(%04x) -> pixel %i\n", (WORD)color, index);