diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c index 587c7c7b29b..bf1851959fc 100644 --- a/dlls/winex11.drv/dib.c +++ b/dlls/winex11.drv/dib.c @@ -371,7 +371,7 @@ static int *X11DRV_DIB_GenColorMap( X11DRV_PDEVICE *physDev, int *colorMapping, } else 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->rgbBlue)); } @@ -395,7 +395,7 @@ static int *X11DRV_DIB_GenColorMap( X11DRV_PDEVICE *physDev, int *colorMapping, } else 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->rgbtBlue)); } diff --git a/dlls/winex11.drv/palette.c b/dlls/winex11.drv/palette.c index cbdf2d152aa..adff6c1d4e3 100644 --- a/dlls/winex11.drv/palette.c +++ b/dlls/winex11.drv/palette.c @@ -1026,7 +1026,7 @@ int X11DRV_PALETTE_ToPhysical( X11DRV_PDEVICE *physDev, COLORREF color ) /*********************************************************************** * X11DRV_PALETTE_LookupPixel */ -int X11DRV_PALETTE_LookupPixel(COLORREF color ) +int X11DRV_PALETTE_LookupPixel(ColorShifts *shifts, COLORREF color ) { unsigned char spec_type = color >> 24; @@ -1048,7 +1048,9 @@ int X11DRV_PALETTE_LookupPixel(COLORREF color ) } 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 */ if (shifts->physicalRed.scale < 8) 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 ) { - 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 */ diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 9be93c611af..03b3750a4cc 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -491,7 +491,7 @@ extern BOOL X11DRV_IsSolidColor(COLORREF color); extern COLORREF X11DRV_PALETTE_ToLogical(X11DRV_PDEVICE *physDev, int pixel); 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 unsigned int depth_to_bpp( unsigned int depth );