Bug 63487

Summary: Fix read_png with libpng 1.6
Product: cairo Reporter: Armin K <krejzi>
Component: png functionsAssignee: Carl Worth <cworth>
Status: RESOLVED NOTOURBUG QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: major    
Priority: medium CC: dominique-freedesktop.org, freedesktop, ross
Version: 1.12.14   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Fix read_png with libpng 1.6

Description Armin K 2013-04-12 20:53:11 UTC
Created attachment 77910 [details]
Fix read_png with libpng 1.6

With libpng 1.6, png_read_update_info() needs to be called after transformations.

http://libpng.git.sourceforge.net/git/gitweb.cgi?p=libpng/libpng;a=blob;f=libpng-manual.txt;hb=HEAD#l4983

The attached patch fixes it on my side.
Comment 1 Behdad Esfahbod 2013-04-12 22:27:07 UTC
The patch is wrong.

And the new requirement is really stupid, since to set the transform function we want to know what color type is going to be output by libpng, and to have that we have to call png_read_update_info().
Comment 2 Armin K 2013-04-12 22:40:34 UTC
Yeah, ickle pointed that out.

I've asked on libpng mailing list what would be the correct way to fix it since png_read_update_info() can't be used like this with libpng 1.6.
Comment 3 Behdad Esfahbod 2013-04-12 22:41:26 UTC
Thanks for following up with them.
Comment 4 Armin K 2013-04-12 23:19:45 UTC
-    png_read_update_info (png, info);
+    info = NULL;
+    png_read_info (png, info);

This appears to work, too. It doesn't work without unseting the info variable. If it's okay with you, I'll attach a new patch.
Comment 5 Armin K 2013-04-13 05:13:27 UTC
Someone responded at libpng mailing list and the response is here:

http://sourceforge.net/mailarchive/forum.php?thread_name=CAP7U39-d%3DBTERc7zkYhj%2BGr-_7p2rWzHCW10XPCEm77RiNj-Zw%40mail.gmail.com&forum_name=png-mng-implement

I admit that I don't really understand what he's saying - maybe someone here could figure it out?
Comment 7 Chris Wilson 2013-04-16 10:14:51 UTC
*** Bug 62779 has been marked as a duplicate of this bug. ***
Comment 8 Armin K 2013-04-26 14:42:05 UTC
Appears to work with libpng 1.6.2 which was released yesterday.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.