From f10f71e5a983a2eb0ec01b74e42be199e99561b2 Mon Sep 17 00:00:00 2001 From: Armin K Date: Fri, 12 Apr 2013 22:47:29 +0200 Subject: [PATCH] Fix read_png with libpng 1.6 The library now issues an error if the application attempts to set a transform after it calls png_read_update_info(). --- src/cairo-png.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cairo-png.c b/src/cairo-png.c index e74a4a8..2fc3029 100644 --- a/src/cairo-png.c +++ b/src/cairo-png.c @@ -623,8 +623,6 @@ read_png (struct png_read_closure_t *png_closure) png_set_filler (png, 0xff, PNG_FILLER_AFTER); - /* recheck header after setting EXPAND options */ - png_read_update_info (png, info); png_get_IHDR (png, info, &png_width, &png_height, &depth, &color_type, &interlace, NULL, NULL); @@ -652,6 +650,11 @@ read_png (struct png_read_closure_t *png_closure) break; } + /* recheck header after setting EXPAND options; + libpng 1.6 requires this to be called after + transformations */ + png_read_update_info (png, info); + stride = cairo_format_stride_for_width (format, png_width); if (stride < 0) { surface = _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_STRIDE)); -- 1.8.2.1