[cairo-commit] src/win32

Chris Wilson ickle at kemper.freedesktop.org
Fri Feb 8 14:20:55 PST 2013


 src/win32/cairo-win32-display-surface.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit d4651676e1496f0354acb0ef045e8b65601edf6d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Feb 8 22:17:13 2013 +0000

    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 at darkrefraction.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60519
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/win32/cairo-win32-display-surface.c b/src/win32/cairo-win32-display-surface.c
index b0c2f90..ccd285d 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


More information about the cairo-commit mailing list