sna: Clip GetImage to drawable so that damage migration is within bounds
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
b1fba5e853
commit
dd5e90adfc
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue