summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cairo-xlib-source.c8
-rw-r--r--src/cairo-xlib-surface.c24
2 files changed, 18 insertions, 14 deletions
diff --git a/src/cairo-xlib-source.c b/src/cairo-xlib-source.c
index 24290f73..ca552785 100644
--- a/src/cairo-xlib-source.c
+++ b/src/cairo-xlib-source.c
@@ -1035,7 +1035,13 @@ surface_source (cairo_xlib_surface_t *dst,
status = _cairo_surface_unmap_image (&xsrc->base, image);
if (unlikely (status)) {
- cairo_surface_destroy (src);
+ cairo_surface_destroy (&xsrc->base);
+ return _cairo_surface_create_in_error (status);
+ }
+
+ status = _cairo_xlib_surface_put_shm (xsrc);
+ if (unlikely (status)) {
+ cairo_surface_destroy (&xsrc->base);
return _cairo_surface_create_in_error (status);
}
}
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index dbc677eb..ee69b66f 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -1139,26 +1139,24 @@ _cairo_xlib_surface_draw_image (cairo_xlib_surface_t *surface,
max_request_size = XMaxRequestSize (display->display);
if (max_request_size > 8192)
max_request_size = 8192;
- if (image->stride * image->height > max_request_size) {
+ if (width * height * 4 > max_request_size) {
shm_image = _cairo_xlib_surface_create_shm__image (surface,
image->pixman_format,
- image->width,
- image->height);
+ width, height);
if (shm_image && shm_image->status == CAIRO_STATUS_SUCCESS) {
cairo_image_surface_t *clone = (cairo_image_surface_t *) shm_image;
- if (clone->stride == image->stride) {
- memcpy (clone->data, image->data, clone->stride * clone->height);
- } else {
- pixman_image_composite32 (PIXMAN_OP_SRC,
- image->pixman_image, NULL, clone->pixman_image,
- 0, 0,
- 0, 0,
- 0, 0,
- image->width, image->height);
- }
+ pixman_image_composite32 (PIXMAN_OP_SRC,
+ image->pixman_image, NULL, clone->pixman_image,
+ src_x, src_y,
+ 0, 0,
+ 0, 0,
+ width, height);
ximage.obdata = _cairo_xlib_shm_surface_get_obdata (shm_image);
ximage.data = (char *)clone->data;
ximage.bytes_per_line = clone->stride;
+ ximage.width = width;
+ ximage.height = height;
+ src_x = src_y = 0;
}
}
} else