Module: wine Branch: master Commit: 2d1f55cce285f75f72393e699acd725ffe177bb1 URL: http://source.winehq.org/git/wine.git/?a=commit;h=2d1f55cce285f75f72393e699a...
Author: Roderick Colenbrander thunderbird2k@gmail.com Date: Thu Sep 10 15:00:17 2009 +0200
winex11: Fix a null pointer bug in ToLogical in case of 8-bit. Move the code to the place where the shifts are needed.
---
dlls/winex11.drv/palette.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/dlls/winex11.drv/palette.c b/dlls/winex11.drv/palette.c index 2f3600f..81bb73b 100644 --- a/dlls/winex11.drv/palette.c +++ b/dlls/winex11.drv/palette.c @@ -791,10 +791,6 @@ BOOL X11DRV_IsSolidColor( COLORREF color ) COLORREF X11DRV_PALETTE_ToLogical(X11DRV_PDEVICE *physDev, int pixel) { XColor color; - ColorShifts *shifts = &X11DRV_PALETTE_default_shifts; - - if(physDev->color_shifts) - shifts = physDev->color_shifts;
#if 0 /* truecolor visual */ @@ -806,6 +802,11 @@ COLORREF X11DRV_PALETTE_ToLogical(X11DRV_PDEVICE *physDev, int pixel)
if ( (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_FIXED) && !X11DRV_PALETTE_Graymax ) { + ColorShifts *shifts = &X11DRV_PALETTE_default_shifts; + + if(physDev->color_shifts) + shifts = physDev->color_shifts; + color.red = (pixel >> shifts->logicalRed.shift) & shifts->logicalRed.max; if (shifts->logicalRed.scale<8) color.red= color.red << (8-shifts->logicalRed.scale) |