xlib/shm: Simplify uploading of SHM image data

Make sure that we simply copy from the SHM segment into the target
drawable, and not inadvertently stage it through another SHM buffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2013-01-29 03:49:56 +00:00
parent c006b886d2
commit 9b92625151

View file

@ -250,15 +250,16 @@ draw_image_boxes (void *_dst,
cairo_int_status_t status;
int i;
if (image->base.device == dst->base.device &&
image->depth != dst->depth)
return CAIRO_INT_STATUS_UNSUPPORTED;
if (image->base.device == dst->base.device) {
if (image->depth != dst->depth)
return CAIRO_INT_STATUS_UNSUPPORTED;
if (image->base.device == dst->base.device &&
image->depth == dst->depth &&
_cairo_xlib_shm_surface_get_pixmap (&image->base))
if (_cairo_xlib_shm_surface_get_pixmap (&image->base))
return copy_image_boxes (dst, image, boxes, dx, dy);
goto draw_image_boxes;
}
shm = NULL;
if (boxes_cover_surface (boxes, dst))
shm = (cairo_image_surface_t *) _cairo_xlib_surface_get_shm (dst, TRUE);
@ -356,6 +357,7 @@ draw_image_boxes (void *_dst,
}
}
draw_image_boxes:
status = CAIRO_STATUS_SUCCESS;
for (chunk = &boxes->chunks; chunk; chunk = chunk->next) {
for (i = 0; i < chunk->count; i++) {
@ -364,10 +366,10 @@ draw_image_boxes (void *_dst,
int y1 = _cairo_fixed_integer_part (b->p1.y);
int x2 = _cairo_fixed_integer_part (b->p2.x);
int y2 = _cairo_fixed_integer_part (b->p2.y);
if ( _cairo_xlib_surface_draw_image (dst, image,
x1 + dx, y1 + dy,
x2 - x1, y2 - y1,
x1, y1)) {
if (_cairo_xlib_surface_draw_image (dst, image,
x1 + dx, y1 + dy,
x2 - x1, y2 - y1,
x1, y1)) {
status = CAIRO_INT_STATUS_UNSUPPORTED;
goto out;
}