summaryrefslogtreecommitdiff
path: root/src/sna/sna_glyphs.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-05-31 20:14:38 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-05-31 20:14:38 +0100
commita34a06c4ba36b21e386b1f6371a4bd3f03ff35a1 (patch)
tree043342c97d34540c3797e940d31811a62eb9e756 /src/sna/sna_glyphs.c
parentdcc7ba8ccf95db1c265bd5492f041f94ce368b7a (diff)
sna/glyphs: Clip the damage to the drawable for unclipped glyphs-to-dst
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.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c
index 0de1f707..ca70e768 100644
--- a/src/sna/sna_glyphs.c
+++ b/src/sna/sna_glyphs.c
@@ -415,6 +415,36 @@ static void apply_damage(struct sna_composite_op *op,
sna_damage_add_box(op->damage, &box);
}
+static void apply_damage_clipped_to_dst(struct sna_composite_op *op,
+ const struct sna_composite_rectangles *r,
+ DrawablePtr dst)
+{
+ BoxRec box;
+
+ if (op->damage == NULL)
+ return;
+
+ box.x1 = r->dst.x + op->dst.x;
+ box.y1 = r->dst.y + op->dst.y;
+ box.x2 = box.x1 + r->width;
+ box.y2 = box.y1 + r->height;
+
+ if (box.x1 < dst->x)
+ box.x1 = dst->x;
+
+ if (box.x2 > op->dst.width)
+ box.x2 = op->dst.width;
+
+ if (box.y1 < dst->y)
+ box.y1 = dst->y;
+
+ if (box.y2 > op->dst.height)
+ box.y2 = op->dst.height;
+
+ assert_pixmap_contains_box(op->dst.pixmap, &box);
+ sna_damage_add_box(op->damage, &box);
+}
+
static Bool
glyphs_to_dst(struct sna *sna,
CARD8 op,
@@ -553,7 +583,7 @@ glyphs_to_dst(struct sna *sna,
r.width, r.height));
tmp.blt(sna, &tmp, &r);
- apply_damage(&tmp, &r);
+ apply_damage_clipped_to_dst(&tmp, &r, dst->pDrawable);
}
next_glyph: