X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=contrib%2Flibtests%2Freadpng.c;h=3336d4e2180ee264302f3389253c3807c85b4544;hb=7b7ccdda02217a442f273ef9684706ecdef2acc5;hp=7ba46d0b96b3b8ba227a7a3c12ab65d322353a14;hpb=361fb099aa967c1618d8071268abab395e67e86a;p=platform%2Fupstream%2Flibpng.git diff --git a/contrib/libtests/readpng.c b/contrib/libtests/readpng.c index 7ba46d0..3336d4e 100644 --- a/contrib/libtests/readpng.c +++ b/contrib/libtests/readpng.c @@ -62,6 +62,7 @@ read_png(FILE *fp) { png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr); + /* Failure to initialize these is harmless */ row = malloc(rowbytes); display = malloc(rowbytes); @@ -70,7 +71,12 @@ read_png(FILE *fp) { png_uint_32 height = png_get_image_height(png_ptr, info_ptr); - int passes = png_set_interlace_handling(png_ptr); +# ifdef PNG_READ_INTERLACING_SUPPORTED + int passes = png_set_interlace_handling(png_ptr); +# else /* !READ_INTERLACING */ + int passes = png_get_interlace_type(png_ptr, info_ptr) == + PNG_INTERLACE_ADAM7 ? PNG_INTERLACE_ADAM7_PASSES : 1; +# endif /* !READ_INTERLACING */ int pass; png_start_read_image(png_ptr); @@ -79,6 +85,11 @@ read_png(FILE *fp) { png_uint_32 y = height; +# ifndef PNG_READ_INTERLACING_SUPPORTED + if (passes == PNG_INTERLACE_ADAM7_PASSES) + y = PNG_PASS_ROWS(y, pass); +# endif /* READ_INTERLACING */ + /* NOTE: this trashes the row each time; interlace handling won't * work, but this avoids memory thrashing for speed testing. */