From 541908524f9ee754db3bc45d2e1681d34479c1cc Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 26 Jan 2012 23:14:14 +0000 Subject: [PATCH] sna: Remove extraneous clipping from GetImage The spec says that they must wholly contained with the valid BorderClip for a Window or within the Pixmap or else a BadMatch is thrown. Rely on this behaviour and not perform the clipping ourselves. Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 39 ++++----------------------------------- 1 file changed, 4 insertions(+), 35 deletions(-) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index cad8d660..3c8f2be3 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -11154,42 +11154,15 @@ sna_get_image(DrawablePtr drawable, char *dst) { RegionRec region; - DDXPointRec origin; DBG(("%s (%d, %d, %d, %d)\n", __FUNCTION__, x, y, w, h)); - /* XXX should be clipped already according to the spec... */ - origin.x = region.extents.x1 = x + drawable->x; - origin.y = region.extents.y1 = y + drawable->y; + region.extents.x1 = x + drawable->x; + region.extents.y1 = y + drawable->y; region.extents.x2 = region.extents.x1 + w; region.extents.y2 = region.extents.y1 + h; region.data = NULL; - 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; - } else { - pixman_box16_t *c = &((WindowPtr)drawable)->borderClip.extents; - pixman_box16_t *r = ®ion.extents; - - if (r->x1 < c->x1) - r->x1 = c->x1; - if (r->x2 > c->x2) - r->x2 = c->x2; - - if (r->y1 < c->y1) - r->y1 = c->y1; - if (r->y2 > c->y2) - r->y2 = c->y2; - } - if (!sna_drawable_move_region_to_cpu(drawable, ®ion, MOVE_READ)) return; @@ -11202,17 +11175,13 @@ sna_get_image(DrawablePtr drawable, DBG(("%s: copy box (%d, %d), (%d, %d), origin (%d, %d)\n", __FUNCTION__, region.extents.x1, region.extents.y1, - region.extents.x2, region.extents.y2, - origin.x, origin.y)); + region.extents.x2, region.extents.y2)); get_drawable_deltas(drawable, pixmap, &dx, &dy); memcpy_blt(pixmap->devPrivate.ptr, dst, drawable->bitsPerPixel, pixmap->devKind, PixmapBytePad(w, drawable->depth), region.extents.x1 + dx, region.extents.y1 + dy, - region.extents.x1 - origin.x, - region.extents.y1 - origin.y, - region.extents.x2 - region.extents.x1, - region.extents.y2 - region.extents.y1); + 0, 0, w, h); } else fbGetImage(drawable, x, y, w, h, format, mask, dst); }