Roderick Colenbrander : winex11: Add helper function for calculating ColorShifts.
Alexandre Julliard
julliard at winehq.org
Wed Sep 9 09:58:28 CDT 2009
Module: wine
Branch: master
Commit: 4ef7bd69438016563153bc718c5baebf9e25548a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4ef7bd69438016563153bc718c5baebf9e25548a
Author: Roderick Colenbrander <thunderbird2k at gmail.com>
Date: Sat Sep 5 16:49:05 2009 +0200
winex11: Add helper function for calculating ColorShifts.
---
dlls/winex11.drv/palette.c | 23 ++++++++++++++++-------
dlls/winex11.drv/x11drv.h | 1 +
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/dlls/winex11.drv/palette.c b/dlls/winex11.drv/palette.c
index 57174a7..2f3600f 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;
@@ -327,6 +324,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
*
* Allocate colorcells and initialize mapping tables.
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index eb84089..078b1fd 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 );
More information about the wine-cvs
mailing list