From d785bb7df054a1f15d59db69b089deb743bbdb40 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 25 Jan 2012 16:45:43 +0000 Subject: [PATCH] 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 --- src/sna/sna_accel.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index deb39bf6..b28134c2 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -1143,7 +1143,9 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, RegionExtents(region)->x2, RegionExtents(region)->y2, flags)); - assert_drawable_contains_box(drawable, ®ion->extents); + if (flags & MOVE_WRITE) { + assert_drawable_contains_box(drawable, ®ion->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(®ion, ®ion, + &((WindowPtr)drawable)->borderClip); if (!sna_drawable_move_region_to_cpu(drawable, ®ion, MOVE_READ)) return;