[cairo-bugs] [Bug 5816] New: Image surfaces do not start out blank by default

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sun Feb 5 09:56:24 PST 2006

Please do not reply to this email: if you want to comment on the bug, go to    
the URL shown below and enter yourcomments there.     
           Summary: Image surfaces do not start out blank by default
           Product: cairo
           Version: 1.1.1
          Platform: PC
        OS/Version: All
            Status: NEW
          Keywords: patch
          Severity: critical
          Priority: P2
         Component: png backend
        AssignedTo: cworth at cworth.org
        ReportedBy: cinamod at hotmail.com
         QAContact: cairo-bugs at cairographics.org

Please see librsvg bug http://bugzilla.gnome.org/show_bug.cgi?id=323114,
especially comment #12, which I will copy here. I'd be ok with
FbPixelsCreateForData not to do this initialization since you can presume it's
been done already at a higher level. Or, alternately, make them both zero out
the pixels for consistency's sake.

While librsvg creates an image surface from its
own zeroed-out data when it calls cairo_image_surface_create_for_data() (the
rsvg-view case), cairo does not do the same when in
cairo_image_surface_create() (the rsvg-convert case). It may be that cairo
expects us to call CAIRO_OPERATOR_CLEAR on the surface, but I contend that
necessity is bogus, since the presumption should be "you get a blank surface by
default", not "you get an undefined, probably corrupt surface by default". The
following patch to cairo/pixman/src/icpixels.c fixes the problem.

Index: pixman/src/icpixels.c
RCS file: /cvs/cairo/cairo/pixman/src/icpixels.c,v
retrieving revision 1.9
diff -u -p -u -r1.9 icpixels.c
--- pixman/src/icpixels.c       25 Jun 2005 03:13:19 -0000      1.9
+++ pixman/src/icpixels.c       5 Feb 2006 17:49:34 -0000
@@ -72,6 +72,7 @@ FbPixelsCreate (int width, int height, i
        return NULL;

     buf = (pixman_bits_t *) ((char *)pixels + base + adjust);
+    memset(buf, 0, height * stride);

     FbPixelsInit (pixels, buf, width, height, depth, bpp, stride);          
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email         
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.

More information about the cairo-bugs mailing list