winex11: Fix a null pointer bug in ToLogical in case of 8-bit. Move the code to the place where the shifts are needed.

This commit is contained in:
Roderick Colenbrander 2009-09-10 15:00:17 +02:00 committed by Alexandre Julliard
parent da2db26dec
commit 2d1f55cce2
1 changed files with 5 additions and 4 deletions

View File

@ -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) |