fix decoding compressed dibs
Rein Klazes
wijn at wanadoo.nl
Thu Apr 7 06:22:16 CDT 2005
Hi,
Changelog:
dlls/x11drv : dib.c
Fix X11DRV_DIB_SetImageBits_RLE(4|8) when an non-zero x-offset (argument
left) is specified.
Rein.
-------------- next part --------------
--- wine/dlls/x11drv/dib.c 2005-04-01 13:32:29.000000000 +0200
+++ mywine/dlls/x11drv/dib.c 2005-04-07 12:48:12.000000000 +0200
@@ -1362,11 +1362,13 @@ static void X11DRV_DIB_SetImageBits_RLE4
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++;
@@ -1388,9 +1390,13 @@ static void X11DRV_DIB_SetImageBits_RLE4
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++;
@@ -1822,7 +1828,10 @@ static void X11DRV_DIB_SetImageBits_RLE8
* [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
{
@@ -1855,12 +1864,13 @@ static void X11DRV_DIB_SetImageBits_RLE8
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
More information about the wine-patches
mailing list