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

Behdad Esfahbod behdad at behdad.org
Sun Nov 18 12:52:48 PST 2007


On Sun, 2007-11-18 at 15:32 -0500, Brian Ewins wrote:
> 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.

Hi Brian,

I don't think other backends do this, do they?  Can you elaborate?

Thanks

behdad


> 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,
> _______________________________________________
> cairo-commit mailing list
> cairo-commit at lists.cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo-commit
-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759





More information about the cairo mailing list