From 4a678afdf73d6f7b2b8a532ac7024976702c8aac Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 27 Apr 2010 18:57:56 +0100 Subject: [PATCH] snapshot: Simply memcpy if the cloned image matches the original. --- src/cairo-surface-snapshot.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/cairo-surface-snapshot.c b/src/cairo-surface-snapshot.c index 4277f66d6..5e1ec749f 100644 --- a/src/cairo-surface-snapshot.c +++ b/src/cairo-surface-snapshot.c @@ -136,12 +136,16 @@ _cairo_surface_snapshot_copy_on_write (cairo_surface_t *surface) image->height, 0); if (likely (clone->base.status == CAIRO_STATUS_SUCCESS)) { - pixman_image_composite32 (PIXMAN_OP_SRC, - image->pixman_image, NULL, clone->pixman_image, - 0, 0, - 0, 0, - 0, 0, - image->width, image->height); + if (clone->stride == image->stride) { + memcpy (clone->data, image->data, image->stride * image->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; snapshot->clone = &clone->base;