[cairo-commit] src/cairo-quartz-surface.c

Brian Ewins brianewins at kemper.freedesktop.org
Sun Nov 18 12:32:40 PST 2007


 src/cairo-quartz-surface.c |    2 ++
 1 file changed, 2 insertions(+)

New commits:
commit ba239a474a5cab36098b8f4a98f36aa6281f7da9
Author: Brian Ewins <Brian.Ewins at gmail.com>
Date:   Sun Nov 18 20:30:49 2007 +0000

    [quartz] zero memory on bitmap creation
    
    7 quartz/argb32/similar tests were showing failures due to
    random bits being set. The problem turned out to be that the
    initial test surface was not cleared before the similar surface
    was created by push_group. The problem behaviour is more obvious
    if you run the tests with MallocScribble=1.
    
    Fix this by calling memset after bitmap allocation; the multiplication
    here cannot overflow since we already checked that in malloc_ab.

diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index 80d352e..b3d0634 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -1915,6 +1915,8 @@ cairo_quartz_surface_create (cairo_format_t format,
 	_cairo_error (CAIRO_STATUS_NO_MEMORY);
 	return (cairo_surface_t*) &_cairo_surface_nil;
     }
+    /* zero the memory to match the image surface behaviour */
+    memset (imageData, 0, height * stride);
 
     cgc = CGBitmapContextCreate (imageData,
 				 width,


More information about the cairo-commit mailing list