Merge pull request #1296 from lovell/png-interlace-handling-ordering

master: fix interlaced PNG input handling with newer libpng versions
This commit is contained in:
John Cupitt 2019-04-27 09:16:50 +01:00 committed by GitHub
commit ce8aff8dd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 9 deletions

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++ )