[PATCH xserver 1/7] EXA: Don't call miComputeCompositeRegion() when rendering glyphs to a mask.

Michel Dänzer michel at daenzer.net
Tue May 17 06:03:23 PDT 2011


From: Michel Dänzer <daenzer at vmware.com>

We know the mask covers the glyph extents.

Signed-off-by: Michel Dänzer <daenzer at vmware.com>
---
 exa/exa_render.c |   74 ++++++++++++++++++++++++++++++-----------------------
 1 files changed, 42 insertions(+), 32 deletions(-)

diff --git a/exa/exa_render.c b/exa/exa_render.c
index 6f2af8a..535f908 100644
--- a/exa/exa_render.c
+++ b/exa/exa_render.c
@@ -442,7 +442,7 @@ exaTryDriverCompositeRects(CARD8	       op,
 					     pMaskPix, pDstPix))
 	return -1;
 
-    while (nrect--)
+    for (; nrect--; rects++)
     {
 	INT16 xDst = rects->xDst + pDst->pDrawable->x;
 	INT16 yDst = rects->yDst + pDst->pDrawable->y;
@@ -464,39 +464,49 @@ exaTryDriverCompositeRects(CARD8	       op,
 	    ySrc += pSrc->pDrawable->y;
 	}
 
-	if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
-				       xSrc, ySrc, xMask, yMask, xDst, yDst,
-				       rects->width, rects->height))
-	    goto next_rect;
+	if (pMask) {
+	    if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
+					   xSrc, ySrc, xMask, yMask, xDst, yDst,
+					   rects->width, rects->height))
+		continue;
 
-	RegionTranslate(&region, dst_off_x, dst_off_y);
+	    RegionTranslate(&region, dst_off_x, dst_off_y);
 
-	nbox = RegionNumRects(&region);
-	pbox = RegionRects(&region);
+	    nbox = RegionNumRects(&region);
+	    pbox = RegionRects(&region);
 
-	xMask = xMask + mask_off_x - xDst - dst_off_x;
-	yMask = yMask + mask_off_y - yDst - dst_off_y;
-	xSrc = xSrc + src_off_x - xDst - dst_off_x;
-	ySrc = ySrc + src_off_y - yDst - dst_off_y;
+	    xMask = xMask + mask_off_x - xDst - dst_off_x;
+	    yMask = yMask + mask_off_y - yDst - dst_off_y;
 
-	while (nbox--)
-	{
-	    (*pExaScr->info->Composite) (pDstPix,
-					 pbox->x1 + xSrc,
-					 pbox->y1 + ySrc,
-					 pbox->x1 + xMask,
-					 pbox->y1 + yMask,
-					 pbox->x1,
-					 pbox->y1,
-					 pbox->x2 - pbox->x1,
-					 pbox->y2 - pbox->y1);
-	    pbox++;
-	}
+	    xSrc = xSrc + src_off_x - xDst - dst_off_x;
+	    ySrc = ySrc + src_off_y - yDst - dst_off_y;
 
-    next_rect:
-	RegionUninit(&region);
+	    while (nbox--)
+	    {
+		(*pExaScr->info->Composite) (pDstPix,
+					     pbox->x1 + xSrc,
+					     pbox->y1 + ySrc,
+					     pbox->x1 + xMask,
+					     pbox->y1 + yMask,
+					     pbox->x1,
+					     pbox->y1,
+					     pbox->x2 - pbox->x1,
+					     pbox->y2 - pbox->y1);
+		pbox++;
+	    }
 
-	rects++;
+	    RegionUninit(&region);
+	} else {
+	    (*pExaScr->info->Composite) (pDstPix,
+					 xSrc + src_off_x,
+					 ySrc + src_off_y,
+					 xMask,
+					 yMask,
+					 xDst + dst_off_x,
+					 yDst + dst_off_y,
+					 rects->width,
+					 rects->height);
+	}
     }
 
     (*pExaScr->info->DoneComposite) (pDstPix);
-- 
1.7.5.1



More information about the xorg-devel mailing list