diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-11-12 00:05:11 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-11-12 08:41:49 +0000 |
commit | 4493fb8d21fa013a074f7de66387e92ef23d191a (patch) | |
tree | b98f5069e96c9eff6e63104ea1bd51cfcdbe32ae /src/sna/sna_glyphs.c | |
parent | c489934ed732ed3d5a906939381c62a6bc1c38d5 (diff) |
sna: Apply drawable offset to glyph bbox prior to checking for clipping
This is a correction to
commit ec0866e86d365ae3fd9790b1b263d49fc4981220
Author: Chris Wilson <chris@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@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_glyphs.c')
-rw-r--r-- | src/sna/sna_glyphs.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c index f2c17885..759e4159 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; |