diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-01-25 01:17:49 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-01-25 01:17:49 +0000 |
commit | dd5e90adfc73870cebcb215ad9fb9b5aedd38673 (patch) | |
tree | 972dd04491b4a7d6e3b2dae5dfffca219c9d7172 | |
parent | b1fba5e8534da7fe253e21a3501854c04d82a108 (diff) |
sna: Clip GetImage to drawable so that damage migration is within bounds
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_accel.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 31a90798..613c1ed6 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -1143,7 +1143,7 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, RegionExtents(region)->x2, RegionExtents(region)->y2, flags)); - assert_pixmap_contains_box(pixmap, ®ion->extents); + assert_drawable_contains_box(drawable, ®ion->extents); priv = sna_pixmap(pixmap); if (priv == NULL) { @@ -11102,6 +11102,16 @@ sna_get_image(DrawablePtr drawable, region.extents.y2 = region.extents.y1 + h; region.data = NULL; + if (region.extents.x1 < drawable->x) + region.extents.x1 = drawable->x; + if (region.extents.x2 > drawable->x + drawable->width) + region.extents.x2 = drawable->x + drawable->width; + + if (region.extents.y1 < drawable->y) + region.extents.y1 = drawable->y; + if (region.extents.y2 > drawable->y + drawable->height) + region.extents.y2 = drawable->y + drawable->height; + if (!sna_drawable_move_region_to_cpu(drawable, ®ion, MOVE_READ)) return; |