From 59e655b0209edd7c827b41945df89ddd4b40f01b Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sat, 10 Oct 2015 12:05:55 -0500 Subject: [PATCH] [libpng16] Added sPLT support to pngtest.c --- ANNOUNCE | 5 +++-- CHANGES | 3 ++- pngtest.c | 43 ++++++++++++++++++++++++++++++++++++------- 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 30de9f551..e5357212e 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,4 +1,4 @@ -Libpng 1.6.19beta04 - October 3, 2015 +Libpng 1.6.19beta04 - October 10, 2015 This is not intended to be a public release. It will be replaced within a few weeks by a public version or by another test version. @@ -92,7 +92,7 @@ Version 1.6.19beta03 [September 26, 2015] warning, updated pngstest-errors.h for the errors detected with the new contrib/testspngs PNG test files (John Bowler). -Version 1.6.19beta04 [October 3, 2015] +Version 1.6.19beta04 [October 10, 2015] Worked around rgb-to-gray issues in libpng 1.6. The previous attempts to ignore the errors in the code aren't quite enough to deal with the 'channel selection' encoding added to libpng 1.7; abort. @@ -101,6 +101,7 @@ Version 1.6.19beta04 [October 3, 2015] directives. Make sure pow is a function where this happens. This is a minimal safe fix, the issue only arises in non-performance-critical code (bug report by Curtis Leach, fix by John Bowler). + Added sPLT support to pngtest.c Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 5f339df24..f77032057 100644 --- a/CHANGES +++ b/CHANGES @@ -5375,7 +5375,7 @@ Version 1.6.19beta03 [September 26, 2015] warning, updated pngstest-errors.h for the errors detected with the new contrib/testspngs PNG test files (John Bowler). -Version 1.6.19beta04 [October 3, 2015] +Version 1.6.19beta04 [October 10, 2015] Worked around rgb-to-gray issues in libpng 1.6. The previous attempts to ignore the errors in the code aren't quite enough to deal with the 'channel selection' encoding added to libpng 1.7; abort. @@ -5385,6 +5385,7 @@ Version 1.6.19beta04 [October 3, 2015] directives. Make sure pow is a function where this happens. This is a minimal safe fix, the issue only arises in non-performance-critical code (bug report by Curtis Leach, fix by John Bowler). + Added sPLT support to pngtest.c Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngtest.c b/pngtest.c index f3513bb8b..c6291189c 100644 --- a/pngtest.c +++ b/pngtest.c @@ -1,7 +1,7 @@ /* pngtest.c - a simple test program to test libpng * - * Last changed in libpng 1.6.18 [July 23, 2015] + * Last changed in libpng 1.6.19 [(PENDING RELEASE)] * Copyright (c) 1998-2015 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -60,6 +60,7 @@ defined PNG_READ_pHYs_SUPPORTED &&\ defined PNG_READ_sBIT_SUPPORTED &&\ defined PNG_READ_sCAL_SUPPORTED &&\ + defined PNG_READ_sPLT_SUPPORTED &&\ defined PNG_READ_sRGB_SUPPORTED &&\ defined PNG_READ_tEXt_SUPPORTED &&\ defined PNG_READ_tIME_SUPPORTED &&\ @@ -1076,6 +1077,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) #endif } } + #ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_cHRM_SUPPORTED { @@ -1090,6 +1092,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) } } #endif + #ifdef PNG_gAMA_SUPPORTED { png_fixed_point gamma; @@ -1123,6 +1126,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) #endif #endif /* Floating point */ #endif /* Fixed point */ + #ifdef PNG_iCCP_SUPPORTED { png_charp name; @@ -1138,6 +1142,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) } } #endif + #ifdef PNG_sRGB_SUPPORTED { int intent; @@ -1146,6 +1151,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) png_set_sRGB(write_ptr, write_info_ptr, intent); } #endif + { png_colorp palette; int num_palette; @@ -1153,6 +1159,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) if (png_get_PLTE(read_ptr, read_info_ptr, &palette, &num_palette) != 0) png_set_PLTE(write_ptr, write_info_ptr, palette, num_palette); } + #ifdef PNG_bKGD_SUPPORTED { png_color_16p background; @@ -1163,6 +1170,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) } } #endif + #ifdef PNG_hIST_SUPPORTED { png_uint_16p hist; @@ -1171,6 +1179,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) png_set_hIST(write_ptr, write_info_ptr, hist); } #endif + #ifdef PNG_oFFs_SUPPORTED { png_int_32 offset_x, offset_y; @@ -1183,6 +1192,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) } } #endif + #ifdef PNG_pCAL_SUPPORTED { png_charp purpose, units; @@ -1198,6 +1208,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) } } #endif + #ifdef PNG_pHYs_SUPPORTED { png_uint_32 res_x, res_y; @@ -1208,6 +1219,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) png_set_pHYs(write_ptr, write_info_ptr, res_x, res_y, unit_type); } #endif + #ifdef PNG_sBIT_SUPPORTED { png_color_8p sig_bit; @@ -1216,6 +1228,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) png_set_sBIT(write_ptr, write_info_ptr, sig_bit); } #endif + #ifdef PNG_sCAL_SUPPORTED #if defined(PNG_FLOATING_POINT_SUPPORTED) && \ defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) @@ -1242,9 +1255,22 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) scal_height); } } -#endif -#endif -#endif +#endif /* FIXED_POINT */ +#endif /* FLOATING_POINT */ +#endif /* sCAL */ + +#ifdef PNG_sPLT_SUPPORTED + { + png_sPLT_tp entries; + + int num_entries = (int) png_get_sPLT(read_ptr, read_info_ptr, &entries); + if (num_entries) + { + png_set_sPLT(write_ptr, write_info_ptr, entries, num_entries); + } + } +#endif /* sPLT */ + #ifdef PNG_TEXT_SUPPORTED { png_textp text_ptr; @@ -1271,7 +1297,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) png_set_text(write_ptr, write_info_ptr, text_ptr, num_text); } } -#endif +#endif /* TEXT */ + #ifdef PNG_tIME_SUPPORTED { png_timep mod_time; @@ -1293,7 +1320,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) #endif /* TIME_RFC1123 */ } } -#endif +#endif /* tIME */ + #ifdef PNG_tRNS_SUPPORTED { png_bytep trans_alpha; @@ -1315,7 +1343,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) trans_color); } } -#endif +#endif /* tRNS */ + #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED { png_unknown_chunkp unknowns;