Fix X11DRV_DIB_SetImageBits_RLE(4|8) when an non-zero x-offset

(argument left) is specified.
This commit is contained in:
Rein Klazes 2005-04-11 14:25:26 +00:00 committed by Alexandre Julliard
parent e4a3c2e4ee
commit bf559d544b

View File

@ -1368,11 +1368,13 @@ static void X11DRV_DIB_SetImageBits_RLE4( int lines, const BYTE *bits,
if (length) { /* encoded */ if (length) { /* encoded */
c = *bits++; c = *bits++;
while (length--) { while (length--) {
if (x >= width) break; if (x >= (left + width)) break;
XPutPixel(bmpImage, x++, y, colors[c >> 4]); if( x >= left) XPutPixel(bmpImage, x, y, colors[c >> 4]);
x++;
if (!length--) break; if (!length--) break;
if (x >= width) break; if (x >= (left + width)) break;
XPutPixel(bmpImage, x++, y, colors[c & 0xf]); if( x >= left) XPutPixel(bmpImage, x, y, colors[c & 0xf]);
x++;
} }
} else { } else {
length = *bits++; length = *bits++;
@ -1394,9 +1396,13 @@ static void X11DRV_DIB_SetImageBits_RLE4( int lines, const BYTE *bits,
default: /* absolute */ default: /* absolute */
while (length--) { while (length--) {
c = *bits++; 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 (!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) if ((bits - begin) & 1)
bits++; bits++;
@ -1828,7 +1834,10 @@ static void X11DRV_DIB_SetImageBits_RLE8( int lines, const BYTE *bits,
* [Run-Length] Encoded mode * [Run-Length] Encoded mode
*/ */
int color = colors[*pIn++]; 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 else
{ {
@ -1861,12 +1870,13 @@ static void X11DRV_DIB_SetImageBits_RLE8( int lines, const BYTE *bits,
while (length--) while (length--)
{ {
int color = colors[*pIn++]; int color = colors[*pIn++];
if (x >= dstwidth) if (x >= (left + dstwidth))
{ {
pIn += length; pIn += length;
break; 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 * If you think for a moment you'll realise that the