From: Frank Huang <frankr.hu...@amd.com>

*Add a maskflag variable to record if the type is COMP_TYPE_MASK
*Add the calculation of the rendering region if there is a mask
picture

Signed-off-by: Frank Huang <frankr.hu...@amd.com>
---
 src/lx_exa.c |   43 +++++++++++++++++++++++++++++++++++--------
 1 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/src/lx_exa.c b/src/lx_exa.c
index 2dd0d48..29c8056 100644
--- a/src/lx_exa.c
+++ b/src/lx_exa.c
@@ -947,6 +947,8 @@ lx_do_composite(PixmapPtr pxDst, int srcX, int srcY, int 
maskX,
 
     unsigned int dstOffset, srcOffset = 0;
 
+    int maskflag = 0;
+
     xPointFixed srcPoint;
 
     int opX = dstX;
@@ -1007,13 +1009,29 @@ lx_do_composite(PixmapPtr pxDst, int srcX, int srcY, 
int maskX,
        srcPoint.y = F(0);
     }
 
+    /* Get the source point offset position */
+
     srcOffset = GetSrcOffset(I(srcPoint.x), I(srcPoint.y));
 
-    if (exaScratch.srcWidth < opWidth)
-       opWidth = exaScratch.srcWidth;
+    /* When mask exists, exaScratch.srcWidth and exaScratch.srcHeight are
+     * the source width and source height; Otherwise, they are mask width
+     * and mask height */
+    /* exaScratch.repeat is the source repeat attribute
+     * exaScratch.maskrepeat is the mask repeat attribute */
+    /* if type is COMP_TYPE_MASK, maskX and maskY are not zero, we should
+     * minus them to do the opeartion in the correct region */
 
-    if (exaScratch.srcHeight < opHeight)
-       opHeight = exaScratch.srcHeight;
+    if (exaScratch.type == COMP_TYPE_MASK) {
+       if ((exaScratch.srcWidth - maskX) < opWidth)
+           opWidth = exaScratch.srcWidth - 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;
+    }
 
     while (1) {
 
@@ -1025,6 +1043,7 @@ lx_do_composite(PixmapPtr pxDst, int srcX, int srcY, int 
maskX,
                int direction =
                    (opPtr->channel == CIMGP_CHANNEL_A_SOURCE) ? 0 : 1;
 
+               maskflag = 1;
                if (direction == 1) {
                    dstOffset =
                        GetPixmapOffset(exaScratch.srcPixmap, opX, opY);
@@ -1065,10 +1084,18 @@ lx_do_composite(PixmapPtr pxDst, int srcX, int srcY, 
int maskX,
                break;
        }
 
-       opWidth = ((dstX + width) - opX) > exaScratch.srcWidth ?
-           exaScratch.srcWidth : (dstX + width) - opX;
-       opHeight = ((dstY + height) - opY) > exaScratch.srcHeight ?
-           exaScratch.srcHeight : (dstY + height) - opY;
+       if (maskflag == 1) {
+           opWidth = ((dstX + width) - opX) > (exaScratch.srcWidth - maskX)
+               ? (exaScratch.srcWidth - maskX) : (dstX + width) - opX;
+            opHeight = ((dstY + height) - opY) > (exaScratch.srcHeight - maskY)
+               ? (exaScratch.srcHeight - maskY) : (dstY + height) - opY;
+       } else {
+           opWidth = ((dstX + width) - opX) > exaScratch.srcWidth ?
+               exaScratch.srcWidth : (dstX + width) - opX;
+           opHeight = ((dstY + height) - opY) > exaScratch.srcHeight ?
+               exaScratch.srcHeight : (dstY + height) - opY;
+       }
+
     }
 }
 
-- 
1.7.1


_______________________________________________
Xorg-driver-geode mailing list
Xorg-driver-geode@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-geode

Reply via email to