Alexandre Julliard : winex11: Avoid overflowing the source rectangle in StretchBlt.

Alexandre Julliard julliard at winehq.org
Mon Jul 18 12:46:56 CDT 2011


Module: wine
Branch: master
Commit: 1e2e45ce665700e74f905da1432fb61014d58289
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1e2e45ce665700e74f905da1432fb61014d58289

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jul 18 16:22:57 2011 +0200

winex11: Avoid overflowing the source rectangle in StretchBlt.

---

 dlls/winex11.drv/bitblt.c |   17 +++++------------
 1 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c
index 9ecdbc9..53f5c63 100644
--- a/dlls/winex11.drv/bitblt.c
+++ b/dlls/winex11.drv/bitblt.c
@@ -804,9 +804,7 @@ static void BITBLT_StretchImage( XImage *srcImage, XImage *dstImage,
 
             /* Retrieve a source row */
             BITBLT_GetRow( srcImage, rowSrc, (ysrc >> 16) - visRectSrc->top,
-                           hswap ? widthSrc - visRectSrc->right
-                                 : visRectSrc->left,
-                           visRectSrc->right - visRectSrc->left,
+                           visRectSrc->left, visRectSrc->right - visRectSrc->left,
                            dstImage->depth, foreground, background, pixel_mask, hswap );
 
             /* Stretch or shrink it */
@@ -814,9 +812,7 @@ static void BITBLT_StretchImage( XImage *srcImage, XImage *dstImage,
                 BITBLT_StretchRow( rowSrc, rowDst, visRectDst->left,
                                    visRectDst->right - visRectDst->left,
                                    xinc, xoff, mode );
-            else BITBLT_ShrinkRow( rowSrc, rowDst,
-                                   hswap ? widthSrc - visRectSrc->right
-                                         : visRectSrc->left,
+            else BITBLT_ShrinkRow( rowSrc, rowDst, visRectSrc->left,
                                    visRectSrc->right - visRectSrc->left,
                                    xinc, xoff, mode );
 
@@ -863,9 +859,7 @@ static void BITBLT_StretchImage( XImage *srcImage, XImage *dstImage,
 
             /* Retrieve a source row */
             BITBLT_GetRow( srcImage, rowSrc, ysrc - visRectSrc->top,
-                           hswap ? widthSrc - visRectSrc->right
-                                 : visRectSrc->left,
-                           visRectSrc->right - visRectSrc->left,
+                           visRectSrc->left, visRectSrc->right - visRectSrc->left,
                            dstImage->depth, foreground, background, pixel_mask, hswap );
 
             /* Stretch or shrink it */
@@ -873,9 +867,7 @@ static void BITBLT_StretchImage( XImage *srcImage, XImage *dstImage,
                 BITBLT_StretchRow( rowSrc, rowDst, visRectDst->left,
                                    visRectDst->right - visRectDst->left,
                                    xinc, xoff, mode );
-            else BITBLT_ShrinkRow( rowSrc, rowDst,
-                                   hswap ? widthSrc - visRectSrc->right
-                                         : visRectSrc->left,
+            else BITBLT_ShrinkRow( rowSrc, rowDst, visRectSrc->left,
                                    visRectSrc->right - visRectSrc->left,
                                    xinc, xoff, mode );
 
@@ -1474,6 +1466,7 @@ BOOL X11DRV_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
     GC tmpGC;
 
     if (IsRectEmpty( &dst->visrect )) return TRUE;
+    if (IsRectEmpty( &src->visrect )) return TRUE;
 
     fStretch = (src->width != dst->width) || (src->height != dst->height);
 




More information about the wine-cvs mailing list