From bf559d544bcadb324fbb8d6e6049e89b7a5662f7 Mon Sep 17 00:00:00 2001 From: Rein Klazes Date: Mon, 11 Apr 2005 14:25:26 +0000 Subject: [PATCH] Fix X11DRV_DIB_SetImageBits_RLE(4|8) when an non-zero x-offset (argument left) is specified. --- dlls/x11drv/dib.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/dlls/x11drv/dib.c b/dlls/x11drv/dib.c index 0cdd428386b..5b8d66803b6 100644 --- a/dlls/x11drv/dib.c +++ b/dlls/x11drv/dib.c @@ -1368,11 +1368,13 @@ static void X11DRV_DIB_SetImageBits_RLE4( int lines, const BYTE *bits, if (length) { /* encoded */ c = *bits++; while (length--) { - if (x >= width) break; - XPutPixel(bmpImage, x++, y, colors[c >> 4]); + if (x >= (left + width)) break; + if( x >= left) XPutPixel(bmpImage, x, y, colors[c >> 4]); + x++; if (!length--) break; - if (x >= width) break; - XPutPixel(bmpImage, x++, y, colors[c & 0xf]); + if (x >= (left + width)) break; + if( x >= left) XPutPixel(bmpImage, x, y, colors[c & 0xf]); + x++; } } else { length = *bits++; @@ -1394,9 +1396,13 @@ static void X11DRV_DIB_SetImageBits_RLE4( int lines, const BYTE *bits, default: /* absolute */ while (length--) { c = *bits++; - if (x < width) XPutPixel(bmpImage, x++, y, colors[c >> 4]); + if (x >= left && x < (left + width)) + XPutPixel(bmpImage, x, y, colors[c >> 4]); + x++; if (!length--) break; - if (x < width) XPutPixel(bmpImage, x++, y, colors[c & 0xf]); + if (x >= left && x < (left + width)) + XPutPixel(bmpImage, x, y, colors[c & 0xf]); + x++; } if ((bits - begin) & 1) bits++; @@ -1828,7 +1834,10 @@ static void X11DRV_DIB_SetImageBits_RLE8( int lines, const BYTE *bits, * [Run-Length] Encoded mode */ int color = colors[*pIn++]; - while (length-- && x < dstwidth) XPutPixel(bmpImage, x++, y, color); + while (length-- && x < (left + dstwidth)) { + if( x >= left) XPutPixel(bmpImage, x, y, color); + x++; + } } else { @@ -1861,12 +1870,13 @@ static void X11DRV_DIB_SetImageBits_RLE8( int lines, const BYTE *bits, while (length--) { int color = colors[*pIn++]; - if (x >= dstwidth) + if (x >= (left + dstwidth)) { pIn += length; break; } - XPutPixel(bmpImage, x++, y, color); + if( x >= left) XPutPixel(bmpImage, x, y, color); + x++; } /* * If you think for a moment you'll realise that the