diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-08-13 20:07:57 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-08-14 12:37:56 +0100 |
commit | 99fa5ff6c211b96326484f80fe91ead0860c3a23 (patch) | |
tree | 92cf942c2080bfe2217ef04382bb118b088ebe3b /src/cairo-image-surface.c | |
parent | 79aa04fd50463629b3ab2e2efbcd8084038f6c09 (diff) | |
download | cairo-99fa5ff6c211b96326484f80fe91ead0860c3a23.tar.gz |
snapshot: Defer acquisition
Fixes 'xlib-expose-event' but triggers an infinite loop in self-copy.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-image-surface.c')
-rw-r--r-- | src/cairo-image-surface.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index 7d8a303d8..7efcc7804 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -738,6 +738,36 @@ _cairo_image_surface_create_similar (void *abstract_other, } static cairo_surface_t * +_cairo_image_surface_snapshot (void *abstract_surface) +{ + cairo_image_surface_t *image = abstract_surface; + cairo_image_surface_t *clone; + + clone = (cairo_image_surface_t *) + _cairo_image_surface_create_with_pixman_format (NULL, + image->pixman_format, + image->width, + image->height, + 0); + if (unlikely (clone->base.status)) + return &clone->base; + + 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); + } + clone->base.is_clear = FALSE; + return &clone->base; +} + + +static cairo_surface_t * _cairo_image_surface_map_to_image (void *abstract_other, const cairo_rectangle_int_t *extents) { @@ -4823,8 +4853,7 @@ const cairo_surface_backend_t _cairo_image_surface_backend = { _cairo_image_surface_stroke, _cairo_image_surface_fill, _cairo_image_surface_glyphs, - NULL, /* show_text_glyphs */ - NULL, /* snapshot */ + _cairo_image_surface_snapshot, NULL, /* is_similar */ }; |