[libpng16] Corrected simplified API default gamma for color-mapped output, added

a flag to change default. In 1.6.0 when the simplified API was used
to produce color-mapped output from an input image with no gamma
information the gamma assumed for the input could be different from
that assumed for non-color-mapped output.  In particular 16-bit depth
input files were assumed to be sRGB encoded, whereas in the 'direct'
case they were assumed to have linear data.  This was an error.  The
fix makes the simplified API treat all input files the same way and
adds a new flag to the png_image::flags member to allow the
application/user to specify that 16-bit files contain sRGB data
rather than the default linear.
Fixed bugs in the pngpixel and makepng test programs.
This commit is contained in:
John Bowler
2013-03-06 22:15:25 -06:00
committed by Glenn Randers-Pehrson
parent 1f24cb74f2
commit 59ae38984f
7 changed files with 90 additions and 14 deletions

View File

@@ -37,7 +37,7 @@ component(png_const_bytep row, png_uint_32 x, unsigned int c,
* bytes wide. Since the row fitted into memory, however, the following must
* work:
*/
png_uint_32 bit_offset_hi = bit_depth * ((x >> 6) * channels + c);
png_uint_32 bit_offset_hi = bit_depth * ((x >> 6) * channels);
png_uint_32 bit_offset_lo = bit_depth * ((x & 0x3f) * channels + c);
row = (png_const_bytep)(((PNG_CONST png_byte (*)[8])row) + bit_offset_hi);