diff --git a/dlls/winex11.drv/palette.c b/dlls/winex11.drv/palette.c index 57174a73174..2f3600fad4c 100644 --- a/dlls/winex11.drv/palette.c +++ b/dlls/winex11.drv/palette.c @@ -101,7 +101,6 @@ int *X11DRV_PALETTE_XPixelToPalette = NULL; static BOOL X11DRV_PALETTE_BuildPrivateMap( const PALETTEENTRY *sys_pal_template ); static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template ); -static void X11DRV_PALETTE_ComputeShifts(unsigned long maskbits, ChannelShift *physical, ChannelShift *to_logical); static void X11DRV_PALETTE_FillDefaultColors( const PALETTEENTRY *sys_pal_template ); static void X11DRV_PALETTE_FormatSystemPalette(void); static BOOL X11DRV_PALETTE_CheckSysColor( const PALETTEENTRY *sys_pal_template, COLORREF c); @@ -223,9 +222,7 @@ int X11DRV_PALETTE_Init(void) X11DRV_PALETTE_PaletteXColormap = XCreateColormap(gdi_display, root_window, visual, AllocNone); X11DRV_PALETTE_PaletteFlags |= X11DRV_PALETTE_FIXED; - X11DRV_PALETTE_ComputeShifts(visual->red_mask, &X11DRV_PALETTE_default_shifts.physicalRed, &X11DRV_PALETTE_default_shifts.logicalRed); - X11DRV_PALETTE_ComputeShifts(visual->green_mask, &X11DRV_PALETTE_default_shifts.physicalGreen, &X11DRV_PALETTE_default_shifts.logicalGreen); - X11DRV_PALETTE_ComputeShifts(visual->blue_mask, &X11DRV_PALETTE_default_shifts.physicalBlue, &X11DRV_PALETTE_default_shifts.logicalBlue); + X11DRV_PALETTE_ComputeColorShifts(&X11DRV_PALETTE_default_shifts, visual->red_mask, visual->green_mask, visual->blue_mask); } XFree(depths); wine_tsx11_unlock(); @@ -281,11 +278,11 @@ void X11DRV_PALETTE_Cleanup(void) } /*********************************************************************** - * X11DRV_PALETTE_ComputeShifts + * X11DRV_PALETTE_ComputeChannelShift * - * Calculate conversion parameters for direct mapped visuals + * Calculate conversion parameters for a given color mask */ -static void X11DRV_PALETTE_ComputeShifts(unsigned long maskbits, ChannelShift *physical, ChannelShift *to_logical) +static void X11DRV_PALETTE_ComputeChannelShift(unsigned long maskbits, ChannelShift *physical, ChannelShift *to_logical) { int i; @@ -326,6 +323,18 @@ static void X11DRV_PALETTE_ComputeShifts(unsigned long maskbits, ChannelShift *p } } +/*********************************************************************** + * X11DRV_PALETTE_ComputeColorShifts + * + * Calculate conversion parameters for a given color + */ +void X11DRV_PALETTE_ComputeColorShifts(ColorShifts *shifts, unsigned long redMask, unsigned long greenMask, unsigned long blueMask) +{ + X11DRV_PALETTE_ComputeChannelShift(redMask, &shifts->physicalRed, &shifts->logicalRed); + X11DRV_PALETTE_ComputeChannelShift(greenMask, &shifts->physicalGreen, &shifts->logicalGreen); + X11DRV_PALETTE_ComputeChannelShift(blueMask, &shifts->physicalBlue, &shifts->logicalBlue); +} + /*********************************************************************** * X11DRV_PALETTE_BuildPrivateMap * diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index eb84089a77e..078b1fd75e6 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -493,6 +493,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 void X11DRV_PALETTE_ComputeColorShifts(ColorShifts *shifts, unsigned long redMask, unsigned long greenMask, unsigned long blueMask); extern unsigned int depth_to_bpp( unsigned int depth );