[devel] Fix and clarify LEGACY 16-to-8 scaling.
This commit is contained in:
parent
97039baa88
commit
74945f2f04
10
pngrtran.c
10
pngrtran.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
|
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -2499,17 +2499,17 @@ png_do_chop(png_row_infop row_info, png_bytep row)
|
|||||||
* (V * 255 + 32895) >> 16
|
* (V * 255 + 32895) >> 16
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef PNG_LEGACY_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
|
|
||||||
*dp = *sp + ((((int)(*(sp + 1)) - *sp) > 128) ? 1 : 0);
|
|
||||||
#else
|
|
||||||
png_int_32 tmp = *sp++; /* must be signed! */
|
png_int_32 tmp = *sp++; /* must be signed! */
|
||||||
|
#ifdef PNG_LEGACY_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
|
||||||
|
tmp += (((int)*sp++ - tmp) > 128) ? 1 : 0;
|
||||||
|
#else
|
||||||
# ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
|
# ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
|
||||||
tmp += (((int)*sp++ - tmp + 128) * 65535) >> 24;
|
tmp += (((int)*sp++ - tmp + 128) * 65535) >> 24;
|
||||||
# else
|
# else
|
||||||
sp++;
|
sp++;
|
||||||
# endif
|
# endif
|
||||||
*dp++ = (png_byte)tmp;
|
|
||||||
#endif
|
#endif
|
||||||
|
*dp++ = (png_byte)tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
row_info->bit_depth = 8;
|
row_info->bit_depth = 8;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngtest.c - a simple test program to test libpng
|
/* pngtest.c - a simple test program to test libpng
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.5.3 [(PENDING RELEASE)]
|
* Last changed in libpng 1.5.4 [(PENDING RELEASE)]
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -1794,4 +1794,4 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||||
typedef png_libpng_version_1_5_4beta01 Your_png_h_is_not_version_1_5_4beta01;
|
typedef png_libpng_version_1_5_4beta02 Your_png_h_is_not_version_1_5_4beta02;
|
||||||
|
Loading…
Reference in New Issue
Block a user