winex11: Fix palette conversion bug.

The LookupPixel code assumed we want to convert pixels to the format
corresponding the default color shifts.
This commit is contained in:
Roderick Colenbrander 2010-02-16 00:25:40 +01:00 committed by Alexandre Julliard
parent f97565191c
commit 3afa657636
3 changed files with 8 additions and 6 deletions

View File

@ -371,7 +371,7 @@ static int *X11DRV_DIB_GenColorMap( X11DRV_PDEVICE *physDev, int *colorMapping,
} }
else else
for (i = start; i < end; i++, rgb++) for (i = start; i < end; i++, rgb++)
colorMapping[i] = X11DRV_PALETTE_LookupPixel(RGB(rgb->rgbRed, colorMapping[i] = X11DRV_PALETTE_LookupPixel(physDev->color_shifts, RGB(rgb->rgbRed,
rgb->rgbGreen, rgb->rgbGreen,
rgb->rgbBlue)); rgb->rgbBlue));
} }
@ -395,7 +395,7 @@ static int *X11DRV_DIB_GenColorMap( X11DRV_PDEVICE *physDev, int *colorMapping,
} }
else else
for (i = start; i < end; i++, rgb++) for (i = start; i < end; i++, rgb++)
colorMapping[i] = X11DRV_PALETTE_LookupPixel(RGB(rgb->rgbtRed, colorMapping[i] = X11DRV_PALETTE_LookupPixel(physDev->color_shifts, RGB(rgb->rgbtRed,
rgb->rgbtGreen, rgb->rgbtGreen,
rgb->rgbtBlue)); rgb->rgbtBlue));
} }

View File

@ -1026,7 +1026,7 @@ int X11DRV_PALETTE_ToPhysical( X11DRV_PDEVICE *physDev, COLORREF color )
/*********************************************************************** /***********************************************************************
* X11DRV_PALETTE_LookupPixel * X11DRV_PALETTE_LookupPixel
*/ */
int X11DRV_PALETTE_LookupPixel(COLORREF color ) int X11DRV_PALETTE_LookupPixel(ColorShifts *shifts, COLORREF color )
{ {
unsigned char spec_type = color >> 24; unsigned char spec_type = color >> 24;
@ -1048,7 +1048,9 @@ int X11DRV_PALETTE_LookupPixel(COLORREF color )
} }
else else
{ {
ColorShifts *shifts = &X11DRV_PALETTE_default_shifts; /* No shifts are set in case of 1-bit */
if(!shifts) shifts = &X11DRV_PALETTE_default_shifts;
/* scale each individually and construct the TrueColor pixel value */ /* scale each individually and construct the TrueColor pixel value */
if (shifts->physicalRed.scale < 8) if (shifts->physicalRed.scale < 8)
red = red >> (8-shifts->physicalRed.scale); red = red >> (8-shifts->physicalRed.scale);
@ -1265,7 +1267,7 @@ UINT X11DRV_RealizePalette( X11DRV_PDEVICE *physDev, HPALETTE hpal, BOOL primary
} }
else if ( X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_VIRTUAL ) else if ( X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_VIRTUAL )
{ {
index = X11DRV_PALETTE_LookupPixel( RGB( entries[i].peRed, entries[i].peGreen, entries[i].peBlue )); index = X11DRV_PALETTE_LookupPixel( physDev->color_shifts, RGB( entries[i].peRed, entries[i].peGreen, entries[i].peBlue ));
} }
/* we have to map to existing entry in the system palette */ /* we have to map to existing entry in the system palette */

View File

@ -491,7 +491,7 @@ extern BOOL X11DRV_IsSolidColor(COLORREF color);
extern COLORREF X11DRV_PALETTE_ToLogical(X11DRV_PDEVICE *physDev, int pixel); extern COLORREF X11DRV_PALETTE_ToLogical(X11DRV_PDEVICE *physDev, int pixel);
extern int X11DRV_PALETTE_ToPhysical(X11DRV_PDEVICE *physDev, COLORREF color); extern int X11DRV_PALETTE_ToPhysical(X11DRV_PDEVICE *physDev, COLORREF color);
extern int X11DRV_PALETTE_LookupPixel(COLORREF color); extern int X11DRV_PALETTE_LookupPixel(ColorShifts *shifts, COLORREF color);
extern void X11DRV_PALETTE_ComputeColorShifts(ColorShifts *shifts, unsigned long redMask, unsigned long greenMask, unsigned long blueMask); extern void X11DRV_PALETTE_ComputeColorShifts(ColorShifts *shifts, unsigned long redMask, unsigned long greenMask, unsigned long blueMask);
extern unsigned int depth_to_bpp( unsigned int depth ); extern unsigned int depth_to_bpp( unsigned int depth );