xf86-video-intel: uxa/uxa-glyphs.c

Chris Wilson ickle at kemper.freedesktop.org
Sat Jun 12 10:10:38 PDT 2010


 uxa/uxa-glyphs.c |   64 ++++++++++++++++++++++++-------------------------------
 1 file changed, 29 insertions(+), 35 deletions(-)

New commits:
commit 94217ed5f5a3726db3fad6cac2132d99ed45c154
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Jun 12 17:21:44 2010 +0100

    uxa: Always clip glyphs to destination.
    
    Even if there is only a single clip rect, since the clip may be smaller
    than the drawing rectangle on the destination we need to actually
    compute the clipped glyph rectangle.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/uxa/uxa-glyphs.c b/uxa/uxa-glyphs.c
index 31bf915..68d1c22 100644
--- a/uxa/uxa-glyphs.c
+++ b/uxa/uxa-glyphs.c
@@ -663,7 +663,7 @@ uxa_glyphs_to_dst(CARD8 op,
 	uxa_screen_t *uxa_screen = uxa_get_screen(screen);
 	PixmapPtr src_pixmap, dst_pixmap;
 	PicturePtr localSrc, glyph_atlas;
-	int x, y, n, nrect;
+	int x, y, n;
 	BoxRec box;
 
 	if (uxa_screen->info->check_composite_texture &&
@@ -747,8 +747,9 @@ uxa_glyphs_to_dst(CARD8 op,
 		while (n--) {
 			GlyphPtr glyph = *glyphs++;
 			PicturePtr this_atlas;
-			int mask_x, mask_y;
+			int mask_x, mask_y, nrect;
 			struct uxa_glyph *priv;
+			BoxPtr rects;
 
 			if (glyph->info.width == 0 || glyph->info.height == 0)
 				goto next_glyph;
@@ -789,41 +790,34 @@ uxa_glyphs_to_dst(CARD8 op,
 				glyph_atlas = this_atlas;
 			}
 
+			rects = REGION_RECTS(pDst->pCompositeClip);
 			nrect = REGION_NUM_RECTS(pDst->pCompositeClip);
-			if (nrect == 1) {
-				uxa_screen->info->composite(dst_pixmap,
-							    x + src_x, y + src_y,
-							    mask_x, mask_y,
-							    x - glyph->info.x,
-							    y - glyph->info.y,
-							    glyph->info.width,
-							    glyph->info.height);
-			} else {
-				BoxPtr rects = REGION_RECTS(pDst->pCompositeClip);
-				while (nrect--) {
-					int x1 = x - glyph->info.x, dx = 0;
-					int y1 = y - glyph->info.y, dy = 0;
-					int x2 = x1 + glyph->info.width;
-					int y2 = y1 + glyph->info.height;
-
-					if (x1 < rects->x1)
-						dx = rects->x1 - x1, x1 = rects->x1;
-					if (x2 > rects->x2)
-						x2 = rects->x2;
-					if (y1 < rects->y1)
-						dy = rects->y1 - y1, y1 = rects->y1;
-					if (y2 > rects->y2)
-						y2 = rects->y2;
-
-					if (x1 < x2 && y1 < y2) {
-						uxa_screen->info->composite(dst_pixmap,
-									    x1 + src_x, y1 + src_y,
-									    dx + mask_x, dy + mask_y,
-									    x1, y1,
-									    x2 - x1, y2 - y1);
-					}
-					rects++;
+			while (nrect--) {
+				int x1 = x - glyph->info.x, dx = 0;
+				int y1 = y - glyph->info.y, dy = 0;
+				int x2 = x1 + glyph->info.width;
+				int y2 = y1 + glyph->info.height;
+
+				if (rects->y1 >= y2)
+					break;
+
+				if (x1 < rects->x1)
+					dx = rects->x1 - x1, x1 = rects->x1;
+				if (x2 > rects->x2)
+					x2 = rects->x2;
+				if (y1 < rects->y1)
+					dy = rects->y1 - y1, y1 = rects->y1;
+				if (y2 > rects->y2)
+					y2 = rects->y2;
+
+				if (x1 < x2 && y1 < y2) {
+					uxa_screen->info->composite(dst_pixmap,
+								    x1 + src_x,  y1 + src_y,
+								    dx + mask_x, dy + mask_y,
+								    x1, y1,
+								    x2 - x1, y2 - y1);
 				}
+				rects++;
 			}
 
 next_glyph:


More information about the xorg-commit mailing list