From: Frank Huang <[email protected]>

This patch is used as a test:)
---
 src/lx_exa.c |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/lx_exa.c b/src/lx_exa.c
index db73088..066d8b8 100644
--- a/src/lx_exa.c
+++ b/src/lx_exa.c
@@ -544,7 +544,7 @@ lx_check_composite(int op, PicturePtr pSrc, PicturePtr 
pMsk, PicturePtr pDst)
        return FALSE;
 
     /* We need the off-screen buffer to do the multipass work */
- 
+
     if (usesPasses(op)) {
        if (pGeode->exaBfrOffset == 0 || !pMsk)
            return FALSE;
@@ -1000,6 +1000,7 @@ lx_do_composite(PixmapPtr pxDst, int srcX, int srcY, int 
maskX,
     unsigned int dstOffset, srcOffset = 0;
 
     int maskflag = 0;
+    int fail = 0;
 
     xPointFixed srcPoint;
 
@@ -1008,6 +1009,9 @@ lx_do_composite(PixmapPtr pxDst, int srcX, int srcY, int 
maskX,
     int opWidth = width;
     int opHeight = height;
 
+    if ((exaScratch.srcWidth < srcX) && (exaScratch.type != COMP_TYPE_MASK))
+       fail = 1;
+
     /* Transform the source coordinates */
 
     if (exaScratch.type == COMP_TYPE_MASK) {
@@ -1079,15 +1083,17 @@ lx_do_composite(PixmapPtr pxDst, int srcX, int srcY, 
int maskX,
        if ((exaScratch.srcHeight - maskY) < opHeight)
            opHeight = exaScratch.srcHeight - maskY;
     } else {
-       if (exaScratch.srcWidth < opWidth)
-           opWidth = exaScratch.srcWidth;
-       if (exaScratch.srcHeight < opHeight)
-           opHeight = exaScratch.srcHeight;
+       if (((exaScratch.srcWidth - srcX) < opWidth) && (exaScratch.srcWidth > 
srcX))
+           opWidth = exaScratch.srcWidth - srcX;
+       if (((exaScratch.srcHeight - srcY) < opHeight) && (exaScratch.srcHeight 
> srcY))
+           opHeight = exaScratch.srcHeight - srcY;
     }
 
     while (1) {
 
        dstOffset = GetPixmapOffset(pxDst, opX, opY);
+       if(fail == 1)
+           break;
 
        switch (exaScratch.type) {
 
@@ -1154,13 +1160,13 @@ lx_do_composite(PixmapPtr pxDst, int srcX, int srcY, 
int maskX,
                exaScratch.op = PictOpClear;
            }
            if (exaScratch.repeat && (!exaScratch.maskrepeat) &&
-               (exaScratch.op == PictOpSrc))
+               (exaScratch.op == PictOpOver))
                break;
        } else {
-           opWidth = ((dstX + width) - opX) > exaScratch.srcWidth ?
-               exaScratch.srcWidth : (dstX + width) - opX;
-           opHeight = ((dstY + height) - opY) > exaScratch.srcHeight ?
-               exaScratch.srcHeight : (dstY + height) - opY;
+           opWidth = ((dstX + width) - opX) > (exaScratch.srcWidth - srcX) ?
+               (exaScratch.srcWidth - srcX) : (dstX + width) - opX;
+           opHeight = ((dstY + height) - opY) > (exaScratch.srcHeight - srcY) ?
+               (exaScratch.srcHeight - srcY) : (dstY + height) - opY;
            if ((!exaScratch.repeat) && (exaScratch.op == PictOpSrc)) {
               exaScratch.type = COMP_TYPE_ONEPASS;
               exaScratch.op = PictOpClear;
-- 
1.7.1


_______________________________________________
Xorg-driver-geode mailing list
[email protected]
http://lists.x.org/mailman/listinfo/xorg-driver-geode

Reply via email to