From 2d1f55cce285f75f72393e699acd725ffe177bb1 Mon Sep 17 00:00:00 2001 From: Roderick Colenbrander Date: Thu, 10 Sep 2009 15:00:17 +0200 Subject: [PATCH] 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 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dlls/winex11.drv/palette.c b/dlls/winex11.drv/palette.c index 2f3600fad4c..81bb73b6424 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) |