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 <jbowler@acm.org>
This commit is contained in:
John Bowler 2015-09-22 09:04:03 -07:00
parent 8fae6609c0
commit 05399c8c82

View File

@ -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: