Ensure png_set_interlace_handling before png_read_update_info

This commit is contained in:
Lovell Fuller 2019-04-26 22:29:16 +01:00
parent 3245dd301b
commit aff0c4cde5

View File

@ -471,6 +471,15 @@ png2vips_header( Read *read, VipsImage *out )
VIPS_META_ICC_NAME, profile, proflen );
}
/* Some libpng warn you to call png_set_interlace_handling(); here, but
* that can actually break interlace on older libpngs.
*
* Only set this for libpng 1.6+.
*/
#if PNG_LIBPNG_VER > 10600
(void) png_set_interlace_handling( read->pPng );
#endif
/* Sanity-check line size.
*/
png_read_update_info( read->pPng, read->pInfo );
@ -541,15 +550,6 @@ png2vips_interlace( Read *read, VipsImage *out )
if( setjmp( png_jmpbuf( read->pPng ) ) )
return( -1 );
/* Some libpng warn you to call png_set_interlace_handling(); here, but
* that can actually break interlace on older libpngs.
*
* Only set this for libpng 1.6+.
*/
#if PNG_LIBPNG_VER > 10600
(void) png_set_interlace_handling( read->pPng );
#endif
if( !(read->row_pointer = VIPS_ARRAY( NULL, out->Ysize, png_bytep )) )
return( -1 );
for( y = 0; y < out->Ysize; y++ )