From d3e7e214e2546b84a79ebfd53c16effd10b328ea Mon Sep 17 00:00:00 2001 From: Ove Kaaven Date: Thu, 18 May 2000 00:03:09 +0000 Subject: [PATCH] Made X11DRV_DIB_MapColor map back to the original color index if the XImage pixel's physical color is still the same. --- graphics/x11drv/dib.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/graphics/x11drv/dib.c b/graphics/x11drv/dib.c index db8e083b0e3..c90776ca0c8 100644 --- a/graphics/x11drv/dib.c +++ b/graphics/x11drv/dib.c @@ -158,10 +158,13 @@ int *X11DRV_DIB_BuildColorMap( DC *dc, WORD coloruse, WORD depth, /*********************************************************************** * X11DRV_DIB_MapColor */ -int X11DRV_DIB_MapColor( int *physMap, int nPhysMap, int phys ) +int X11DRV_DIB_MapColor( int *physMap, int nPhysMap, int phys, int oldcol ) { int color; + if ((oldcol < nPhysMap) && (physMap[oldcol] == phys)) + return oldcol; + for (color = 0; color < nPhysMap; color++) if (physMap[color] == phys) return color; @@ -778,13 +781,13 @@ static void X11DRV_DIB_GetImageBits_4( int lines, BYTE *dstbits, for (h = lines-1; h >= 0; h--) { for (x = 0; x < dstwidth/2; x++) { *bits++ = (X11DRV_DIB_MapColor((int *)colors, 16, - XGetPixel( bmpImage, x++, h )) << 4) + XGetPixel( bmpImage, x++, h ), 0) << 4) | (X11DRV_DIB_MapColor((int *)colors, 16, - XGetPixel( bmpImage, x++, h )) & 0x0f); + XGetPixel( bmpImage, x++, h ), 0) & 0x0f); } if (dstwidth & 1) *bits = (X11DRV_DIB_MapColor((int *)colors, 16, - XGetPixel( bmpImage, x++, h )) << 4); + XGetPixel( bmpImage, x++, h ), 0) << 4); bits = (dstbits += linebytes); } break; @@ -1166,7 +1169,7 @@ static void X11DRV_DIB_GetImageBits_8( int lines, BYTE *dstbits, for (h = lines - 1; h >= 0; h--) { for (x = 0; x < dstwidth; x++, bits++) { *bits = X11DRV_DIB_MapColor((int *)colors, 256, - XGetPixel( bmpImage, x, h ) ); + XGetPixel( bmpImage, x, h ), *bits); } bits = (dstbits += linebytes); }