summaryrefslogtreecommitdiff
path: root/src/cairo-xlib-surface.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-05-05 18:37:25 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-05-05 21:38:18 +0100
commit30735f790aa3cef822f132932f43a4738cd8cd95 (patch)
tree5013403f73028ce505fbc704a9dd6cdae86bfb52 /src/cairo-xlib-surface.c
parent60e38d0530443aa9c78e74e47ba5574887ae220c (diff)
[xlib] Use a similar content surface for cloning images
Simply request a surface with a similar content to the source image when uploading pixel data. Failing to do so prevents using a 16-bit (or otherwise non-standard pixman image format) window as a source - in fact it will trigger an infinite recursion.
Diffstat (limited to 'src/cairo-xlib-surface.c')
-rw-r--r--src/cairo-xlib-surface.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index d1e7391c..b56b340f 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -950,7 +950,8 @@ _draw_image_surface (cairo_xlib_surface_t *surface,
ximage.blue_mask = surface->b_mask;
ximage.xoffset = 0;
- if (image_masks.red_mask == surface->r_mask &&
+ if (image_masks.alpha_mask == surface->a_mask &&
+ image_masks.red_mask == surface->r_mask &&
image_masks.green_mask == surface->g_mask &&
image_masks.blue_mask == surface->b_mask)
{
@@ -1016,8 +1017,8 @@ _draw_image_surface (cairo_xlib_surface_t *surface,
goto BAIL;
}
- rowstride = cairo_image_surface_get_stride (&image->base) >> 2;
- row = (uint32_t *) cairo_image_surface_get_data (&image->base);
+ rowstride = image->stride >> 2;
+ row = (uint32_t *) image->data;
x0 = dst_x + surface->base.device_transform.x0;
y0 = dst_y + surface->base.device_transform.y0;
for (y = 0, y_off = y0 % ARRAY_LENGTH (dither_pattern);
@@ -1194,16 +1195,17 @@ _cairo_xlib_surface_clone_similar (void *abstract_surface,
}
} else if (_cairo_surface_is_image (src)) {
cairo_image_surface_t *image_src = (cairo_image_surface_t *)src;
-
- if (! CAIRO_FORMAT_VALID (image_src->format))
- return CAIRO_INT_STATUS_UNSUPPORTED;
+ cairo_format_t format;
if (width > XLIB_COORD_MAX || height > XLIB_COORD_MAX)
return _cairo_error (CAIRO_STATUS_INVALID_SIZE);
+ format = image_src->format;
+ if (format == CAIRO_FORMAT_INVALID)
+ format = _cairo_format_from_content (image_src->base.content);
clone = (cairo_xlib_surface_t *)
_cairo_xlib_surface_create_similar_with_format (surface,
- image_src->format,
+ format,
width, height);
if (clone == NULL)
return CAIRO_INT_STATUS_UNSUPPORTED;