From a6f081e0db2f4c07698d02d3d6eccc4a5fbd6848 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Mon, 15 Aug 2005 14:46:31 +0000 Subject: [PATCH] Fix AlphaBlend() to extract the right part of the source DIB. --- dlls/x11drv/xrender.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/dlls/x11drv/xrender.c b/dlls/x11drv/xrender.c index f27cca68ee0..b7f1bceebb0 100644 --- a/dlls/x11drv/xrender.c +++ b/dlls/x11drv/xrender.c @@ -1628,8 +1628,8 @@ BOOL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT widthDst, XImage *image; GC gc; XGCValues gcv; - char *dstbits, *data; - int y; + BYTE *dstbits, *data; + int y, y2; POINT pts[2]; BOOL top_down = FALSE; @@ -1682,8 +1682,15 @@ BOOL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT widthDst, if(dib.dsBmih.biHeight < 0) { /* top-down dib */ top_down = TRUE; dstbits += widthSrc * (heightSrc - 1) * 4; + y2 = ySrc; + y = y2 + heightSrc; } - for(y = ySrc + heightSrc - 1; y >= ySrc; y--) { + else + { + y = dib.dsBmih.biHeight - ySrc - 1; + y2 = y - heightSrc; + } + for(; y > y2; y--) { memcpy(dstbits, (char *)dib.dsBm.bmBits + y * dib.dsBm.bmWidthBytes + xSrc * 4, widthSrc * 4); dstbits += (top_down ? -1 : 1) * widthSrc * 4; @@ -1734,7 +1741,7 @@ BOOL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT widthDst, } #endif pXRenderComposite(gdi_display, PictOpOver, src_pict, 0, dst_pict, - xSrc, ySrc, 0, 0, + 0, 0, 0, 0, xDst + devDst->org.x, yDst + devDst->org.y, widthDst, heightDst); -- 2.11.4.GIT