summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-25 01:36:27 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-25 01:36:27 +0000
commitb79252efaafe2ebc998d6cf6176a425dd897e66f (patch)
treec2acf6759bacc627da13cf46179366582146db19
parent46252bc7bcc7e08e47d00cdc87d6c1ed93830fcc (diff)
sna: Apply source clipping to sna_copy_plane()
Ensure that the migration region is within bounds for both the source and destination pixmaps. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 2d838689..f52766bc 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -5038,7 +5038,33 @@ sna_copy_plane(DrawablePtr src, DrawablePtr dst, GCPtr gc,
region.extents.x2 = region.extents.x1 + w;
region.extents.y2 = region.extents.y1 + h;
region.data = NULL;
- region_maybe_clip(&region, gc->pCompositeClip);
+ RegionIntersect(&region, &region, gc->pCompositeClip);
+
+ DBG(("%s: dst extents (%d, %d), (%d, %d)\n",
+ __FUNCTION__,
+ region.extents.x1, region.extents.y1,
+ region.extents.x2, region.extents.y2));
+
+ {
+ RegionRec clip;
+
+ clip.extents.x1 = src->x - (src->x + src_x) + (dst->x + dst_x);
+ clip.extents.y1 = src->y - (src->y + src_y) + (dst->y + dst_y);
+ clip.extents.x2 = clip.extents.x1 + src->width;
+ clip.extents.y2 = clip.extents.y1 + src->height;
+ clip.data = NULL;
+
+ DBG(("%s: src extents (%d, %d), (%d, %d)\n",
+ __FUNCTION__,
+ clip.extents.x1, clip.extents.y1,
+ clip.extents.x2, clip.extents.y2));
+
+ RegionIntersect(&region, &region, &clip);
+ }
+ DBG(("%s: dst^src extents (%d, %d), (%d, %d)\n",
+ __FUNCTION__,
+ region.extents.x1, region.extents.y1,
+ region.extents.x2, region.extents.y2));
if (!RegionNotEmpty(&region))
return NULL;