From 05399c8c82d7b188357dc6fa05a8cdd89426b155 Mon Sep 17 00:00:00 2001 From: John Bowler Date: Tue, 22 Sep 2015 09:04:03 -0700 Subject: [PATCH] makepng.c: correct the first row filter setting It needs to include the "UP" filter so that libpng knows to retain the first line for the UP filter on the next one. Without this libpng ended up using NONE for the second line. Signed-off-by: John Bowler --- contrib/libtests/makepng.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/contrib/libtests/makepng.c b/contrib/libtests/makepng.c index ef8e5fcda..7f54e24a2 100644 --- a/contrib/libtests/makepng.c +++ b/contrib/libtests/makepng.c @@ -485,7 +485,10 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type, break; --size_max; } - filters = (y == 0 ? PNG_FILTER_SUB : PNG_FILTER_UP); + /* The first row must include PNG_FILTER_UP so that libpng knows we + * need to keep it for the following row: + */ + filters = (y == 0 ? PNG_FILTER_SUB+PNG_FILTER_UP : PNG_FILTER_UP); break; case 24: @@ -516,7 +519,7 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type, 0xFFU & (pixel_index + (byte_offset * 2*y) + 1); } } - filters = (y == 0 ? PNG_FILTER_SUB : PNG_FILTER_UP); + filters = (y == 0 ? PNG_FILTER_SUB+PNG_FILTER_UP : PNG_FILTER_UP); break; default: