From d4651676e1496f0354acb0ef045e8b65601edf6d Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 8 Feb 2013 22:17:13 +0000 Subject: win32: Clear the similar-image before returning to the user Our userspace API mandates that surfaces created for the user are cleared before they are returned. Make it so for the win32 similar image constructor. Reported-by: Michael Henning Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60519 Signed-off-by: Chris Wilson --- src/win32/cairo-win32-display-surface.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/win32/cairo-win32-display-surface.c b/src/win32/cairo-win32-display-surface.c index b0c2f903..ccd285d7 100644 --- a/src/win32/cairo-win32-display-surface.c +++ b/src/win32/cairo-win32-display-surface.c @@ -392,6 +392,7 @@ _cairo_win32_display_surface_create_similar_image (void *abstract_other, int height) { cairo_win32_display_surface_t *surface = abstract_other; + cairo_image_surface_t *image; surface = (cairo_win32_display_surface_t *) _cairo_win32_display_surface_create_for_dc (surface->win32.dc, @@ -399,7 +400,14 @@ _cairo_win32_display_surface_create_similar_image (void *abstract_other, if (surface->win32.base.status) return &surface->win32.base; - return surface->image; + /* And clear in order to comply with our user API semantics */ + image = (cairo_image_surface_t *) surface->image; + if (! image->base.is_clear) { + memset (image->data, 0, image->stride * height); + image->base.is_clear = TRUE; + } + + return &image->base; } static cairo_status_t -- cgit v1.2.3