Roderick Colenbrander : winex11: Fix palette conversion bug.
Alexandre Julliard
julliard at winehq.org
Tue Feb 16 11:44:39 CST 2010
Module: wine
Branch: master
Commit: 3afa65763644d2a4aae5781c91c61ea8392f7c1d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3afa65763644d2a4aae5781c91c61ea8392f7c1d
Author: Roderick Colenbrander <thunderbird2k at gmail.com>
Date: Tue Feb 16 00:25:40 2010 +0100
winex11: Fix palette conversion bug.
The LookupPixel code assumed we want to convert pixels to the format
corresponding the default color shifts.
---
dlls/winex11.drv/dib.c | 4 ++--
dlls/winex11.drv/palette.c | 8 +++++---
dlls/winex11.drv/x11drv.h | 2 +-
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c
index 587c7c7..bf18519 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 cbdf2d1..adff6c1 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 9be93c6..03b3750 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 );
More information about the wine-cvs
mailing list