sna: GetImage is allowed to read a window's border

We need to adjust the clip to include the border pixels when migrating
damage from the backing pixmap. This also requires relaxing the
constraint that a read must be within the drawable.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-01-25 16:45:43 +00:00
parent 36425ba49e
commit d785bb7df0
1 changed files with 15 additions and 9 deletions

View File

@ -1143,7 +1143,9 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
RegionExtents(region)->x2, RegionExtents(region)->y2,
flags));
assert_drawable_contains_box(drawable, &region->extents);
if (flags & MOVE_WRITE) {
assert_drawable_contains_box(drawable, &region->extents);
}
priv = sna_pixmap(pixmap);
if (priv == NULL) {
@ -11157,15 +11159,19 @@ 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 (drawable->type == DRAWABLE_PIXMAP) {
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 (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;
} else
RegionIntersect(&region, &region,
&((WindowPtr)drawable)->borderClip);
if (!sna_drawable_move_region_to_cpu(drawable, &region, MOVE_READ))
return;