xf86-video-intel: src/sna/sna_glyphs.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Nov 12 00:42:39 PST 2013


 src/sna/sna_glyphs.c |   28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

New commits:
commit 4493fb8d21fa013a074f7de66387e92ef23d191a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Nov 12 00:05:11 2013 +0000

    sna: Apply drawable offset to glyph bbox prior to checking for clipping
    
    This is a correction to
    
    commit ec0866e86d365ae3fd9790b1b263d49fc4981220
    Author: Chris Wilson <chris at chris-wilson.co.uk>
    Date:   Wed Oct 16 22:39:54 2013 +0100
    
        sna/glyphs: Fix computation of extents for long strings
    
    in order for us to correctly detect when we need to clip.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71191
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c
index f2c1788..759e415 100644
--- a/src/sna/sna_glyphs.c
+++ b/src/sna/sna_glyphs.c
@@ -517,18 +517,36 @@ static void apply_damage_clipped_to_dst(struct sna_composite_op *op,
 	sna_damage_add_box(op->damage, &box);
 }
 
+static inline bool region_matches_pixmap(const RegionRec *r, PixmapPtr pixmap)
+{
+	return (r->extents.x2 - r->extents.x1 >= pixmap->drawable.width &&
+		r->extents.y2 - r->extents.y1 >= pixmap->drawable.height);
+}
+
 static inline bool clipped_glyphs(PicturePtr dst, int nlist, GlyphListPtr list, GlyphPtr *glyphs)
 {
 	BoxRec box;
 
+	if (dst->pCompositeClip->data == NULL &&
+	    region_matches_pixmap(dst->pCompositeClip,
+				  get_drawable_pixmap(dst->pDrawable))) {
+		DBG(("%s: no, region matches drawable\n", __FUNCTION__));
+		return false;
+	}
+
 	glyph_extents(nlist, list, glyphs, &box);
+
+	box.x1 += dst->pDrawable->x;
+	box.x2 += dst->pDrawable->x;
+	box.y1 += dst->pDrawable->y;
+	box.y2 += dst->pDrawable->y;
+
 	DBG(("%s? glyph extents (%d, %d), (%d, %d), region (%d, %d), (%d, %d): %s\n",
 	     __FUNCTION__, box.x1, box.y1, box.x2, box.y2,
-	     dst->pCompositeClip->extents.x1, dst->pCompositeClip->extents.y1, dst->pCompositeClip->extents.x2, dst->pCompositeClip->extents.y2,
-	     (box.x1 < dst->pCompositeClip->extents.x1 ||
-	      box.y1 < dst->pCompositeClip->extents.y1 ||
-	      box.x2 > dst->pCompositeClip->extents.x2 ||
-	      box.y2 > dst->pCompositeClip->extents.y2) ? "yes" : "no"));
+	     dst->pCompositeClip->extents.x1, dst->pCompositeClip->extents.y1,
+	     dst->pCompositeClip->extents.x2, dst->pCompositeClip->extents.y2,
+	     pixman_region_contains_rectangle(dst->pCompositeClip,
+					      &box) != PIXMAN_REGION_IN ?  "yes" : "no"));
 
 	return pixman_region_contains_rectangle(dst->pCompositeClip,
 						&box) != PIXMAN_REGION_IN;


More information about the xorg-commit mailing list