Test backport

Tests backported from the multi-version compatible ones in libpng 1.7

Signed-off-by: John Bowler <jbowler@acm.org>
This commit is contained in:
John Bowler
2015-11-23 20:15:51 -08:00
parent 9a2065c5ee
commit 8a08b6457a
5 changed files with 381 additions and 212 deletions

View File

@@ -31,13 +31,6 @@
# include "../../png.h"
#endif
#if PNG_LIBPNG_VER < 10700
/* READ_INTERLACING was used instead of READ_DEINTERLACE. */
# ifdef PNG_READ_INTERLACING_SUPPORTED
# define PNG_READ_DEINTERLACE_SUPPORTED
# endif
#endif
static int
read_png(FILE *fp)
{
@@ -77,12 +70,12 @@ read_png(FILE *fp)
{
png_uint_32 height = png_get_image_height(png_ptr, info_ptr);
# ifdef PNG_READ_DEINTERLACE_SUPPORTED
# ifdef PNG_READ_INTERLACING_SUPPORTED
int passes = png_set_interlace_handling(png_ptr);
# else
# else /* !READ_INTERLACING */
int passes = png_get_interlace_type(png_ptr, info_ptr) ==
PNG_INTERLACE_ADAM7 ? PNG_INTERLACE_ADAM7_PASSES : 1;
# endif
# endif /* !READ_INTERLACING */
int pass;
png_start_read_image(png_ptr);
@@ -91,10 +84,10 @@ read_png(FILE *fp)
{
png_uint_32 y = height;
# ifndef PNG_READ_DEINTERLACE_SUPPORTED
# ifndef PNG_READ_INTERLACING_SUPPORTED
if (passes == PNG_INTERLACE_ADAM7_PASSES)
y = PNG_PASS_ROWS(y, pass);
# endif
# endif /* READ_INTERLACING */
/* NOTE: this trashes the row each time; interlace handling won't
* work, but this avoids memory thrashing for speed testing.