summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-02-08 22:17:13 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-02-08 22:17:13 +0000
commitd4651676e1496f0354acb0ef045e8b65601edf6d (patch)
tree57f9b03aa6396ca868dbeb10e7eef7befd7c5d11
parent2d7ac9e737f37daf8490c27e6a04c65bba642645 (diff)
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 <drawoc@darkrefraction.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60519 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/win32/cairo-win32-display-surface.c10
1 files changed, 9 insertions, 1 deletions
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