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 <chris@chris-wilson.co.uk>
This commit is contained in:
parent
7ff40b572e
commit
541908524f
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue