[cairo-commit] src/cairo-png.c

Carl Worth cworth at kemper.freedesktop.org
Wed Sep 24 22:01:02 PDT 2008


 src/cairo-png.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 261dd83b31adb4a6b4d80f626b9d5fde5eb4d8f6
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Sep 24 21:55:53 2008 -0700

    Eliminate paranoid check for PNG_INTERLACE_NONE.
    
    Commit 20b1b33c0fc7 added some "paranoid checks" to our png
    loading code. One of these was checking that if png_get_IHDR
    first reports an interlace value other than PNG_INTERLACE_NONE
    that after we call png_set_interlace_handling then we do
    get PNG_INTERLACE_NONE from the next call to png_get_IHDR.
    
    However, libpng doesn't seem to actually have that behavior.
    When testing cairo_image_surface_create_from_png with an
    interlanced PNG file, (which the test suite happens not to
    do---even now), the call to png_set_interlace_handling is
    doing the trick, but the check for PNG_INTERLACE_NONE is
    failing.
    
    So, with the check in place, loading an interlaced PNG image
    fails with CAIRO_STATUS_READ_ERROR. By simply removing
    that check, an interlaced image loads just fine.

diff --git a/src/cairo-png.c b/src/cairo-png.c
index d807dac..06e7cb5 100644
--- a/src/cairo-png.c
+++ b/src/cairo-png.c
@@ -524,7 +524,7 @@ read_png (png_rw_ptr	read_func,
     png_get_IHDR (png, info,
                   &png_width, &png_height, &depth,
                   &color_type, &interlace, NULL, NULL);
-    if (depth != 8 || interlace != PNG_INTERLACE_NONE ||
+    if (depth != 8 ||
 	! (color_type == PNG_COLOR_TYPE_RGB ||
 	   color_type == PNG_COLOR_TYPE_RGB_ALPHA))
     {


More information about the cairo-commit mailing list