[devel] Made FIXED and FLOATING options consistent in the APIs they enable

and disable.  Corrected scripts/options.awk to handle both command line
options and options specified in the .dfa files.
This commit is contained in:
Glenn Randers-Pehrson 2010-06-25 21:45:31 -05:00
parent a81c59a960
commit a272d8fe3d
11 changed files with 131 additions and 94 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.5.0beta32 - June 26, 2010
Libpng 1.5.0beta33 - June 26, 2010
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.
@ -9,20 +9,20 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a
"configure" script
1.5.0beta32.tar.xz (LZMA-compressed, recommended)
1.5.0beta32.tar.gz
1.5.0beta32.tar.bz2
1.5.0beta33.tar.xz (LZMA-compressed, recommended)
1.5.0beta33.tar.gz
1.5.0beta33.tar.bz2
Source files with CRLF line endings (for Windows), without the
"configure" script
lp150b32.zip
lp150b32.7z
lp150b33.zip
lp150b33.7z
Other information:
1.5.0beta32-README.txt
1.5.0beta32-LICENSE.txt
1.5.0beta33-README.txt
1.5.0beta33-LICENSE.txt
Changes since the last public release (1.4.1):
@ -252,7 +252,12 @@ version 1.5.0beta31 [June 26, 2010]
Removed some trailing blanks.
version 1.5.0beta32 [June 26, 2010]
Removed leftover scripts/options.patch and scripts/options.rej.
Removed leftover scripts/options.patch and scripts/options.rej
version 1.5.0beta32 [June 26, 2010]
Made FIXED and FLOATING options consistent in the APIs they enable and
disable. Corrected scripts/options.awk to handle both command line
options and options specified in the .dfa files.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit

View File

@ -2736,6 +2736,11 @@ version 1.5.0beta31 [June 26, 2010]
version 1.5.0beta32 [June 26, 2010]
Removed leftover scripts/options.patch and scripts/options.rej
version 1.5.0beta32 [June 26, 2010]
Made FIXED and FLOATING options consistent in the APIs they enable and
disable. Corrected scripts/options.awk to handle both command line
options and options specified in the .dfa files.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement

41
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.5.0beta32 - June 26, 2010
* libpng version 1.5.0beta33 - June 26, 2010
* Copyright (c) 1998-2010 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.)
@ -11,7 +11,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.5.0beta32 - June 26, 2010: Glenn
* libpng versions 0.97, January 1998, through 1.5.0beta33 - June 26, 2010: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@ -140,7 +140,7 @@
* 1.4.1 14 10401 14.so.14.1[.0]
* 1.4.2 14 10402 14.so.14.2[.0]
* 1.4.3 14 10403 14.so.14.3[.0]
* 1.5.0beta01-32 15 10500 15.so.15.0[.0]
* 1.5.0beta01-33 15 10500 15.so.15.0[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@ -172,7 +172,7 @@
*
* This code is released under the libpng license.
*
* libpng versions 1.2.6, August 15, 2004, through 1.5.0beta32, June 26, 2010, are
* libpng versions 1.2.6, August 15, 2004, through 1.5.0beta33, June 26, 2010, are
* Copyright (c) 2004, 2006-2010 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors:
@ -290,7 +290,7 @@
* an official declaration.
*
* This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.5.0beta32 are Y2K compliant. It is my belief that earlier
* upward through 1.5.0beta33 are Y2K compliant. It is my belief that earlier
* versions were also Y2K compliant.
*
* Libpng only has three year fields. One is a 2-byte unsigned integer
@ -346,9 +346,9 @@
*/
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.5.0beta32"
#define PNG_LIBPNG_VER_STRING "1.5.0beta33"
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.5.0beta32 - June 26, 2010\n"
" libpng version 1.5.0beta33 - June 26, 2010\n"
#define PNG_LIBPNG_VER_SONUM 15
#define PNG_LIBPNG_VER_DLLNUM 15
@ -361,7 +361,7 @@
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
*/
#define PNG_LIBPNG_VER_BUILD 32
#define PNG_LIBPNG_VER_BUILD 33
/* Release Status */
#define PNG_LIBPNG_BUILD_ALPHA 1
@ -836,7 +836,7 @@ typedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp),);
/* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
typedef png_structp version_1_5_0beta32;
typedef png_structp version_1_5_0beta33;
typedef png_struct FAR * FAR * png_structpp;
@ -998,16 +998,17 @@ extern PNG_EXPORT(void,png_set_bgr,(png_structp png_ptr),,30);
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
/* Expand the grayscale to 24-bit RGB if necessary. */
extern PNG_EXPORT(void,png_set_gray_to_rgb,(png_structp png_ptr),,31);
#endif
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
/* Reduce RGB to grayscale. */
# ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_rgb_to_gray,(png_structp png_ptr,
int error_action, double red, double green ),,32);
# endif
# ifdef PNG_FIXED_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_rgb_to_gray_fixed,(png_structp png_ptr,
int error_action, png_fixed_point red, png_fixed_point green),,33);
# endif
extern PNG_EXPORT(png_byte,png_get_rgb_to_gray_status,(png_structp png_ptr),,
34);
#endif
@ -1081,6 +1082,7 @@ extern PNG_EXPORT(void,png_set_background,(png_structp png_ptr,
png_color_16p background_color, int background_gamma_code,
int need_expand, double background_gamma),,47);
# endif
/* TODO: png_set_background_fixed */
# define PNG_BACKGROUND_GAMMA_UNKNOWN 0
# define PNG_BACKGROUND_GAMMA_SCREEN 1
# define PNG_BACKGROUND_GAMMA_FILE 2
@ -1107,6 +1109,7 @@ extern PNG_EXPORT(void,png_set_quantize,(png_structp png_ptr,
extern PNG_EXPORT(void,png_set_gamma,(png_structp png_ptr,
double screen_gamma, double default_file_gamma),,50);
# endif
/* TODO: png_set_gamma_fixed */
#endif
@ -1267,6 +1270,7 @@ extern PNG_EXPORT(void,png_set_filter_heuristics,(png_structp png_ptr,
int heuristic_method, int num_weights, png_doublep filter_weights,
png_doublep filter_costs),,68);
# endif
/* TODO: png_set_filter_heuristics_fixed */
#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
/* Heuristic used for row filter selection. These defines should NOT be
@ -1582,6 +1586,7 @@ extern PNG_EXPORT(png_uint_32, png_get_y_pixels_per_meter,
extern PNG_EXPORT(float, png_get_pixel_aspect_ratio,
(png_structp png_ptr, png_infop info_ptr),,125);
# endif
/* TODO: png_get_pixel_aspect_ratio_fixed */
/* Returns image x, y offset in pixels or microns, from oFFs chunk data. */
extern PNG_EXPORT(png_int_32, png_get_x_offset_pixels,
@ -1648,8 +1653,10 @@ extern PNG_EXPORT(void,png_set_cHRM_fixed,(png_structp png_ptr,
extern PNG_EXPORT(png_uint_32,png_get_gAMA,(png_structp png_ptr,
png_infop info_ptr, double *file_gamma),,137);
# endif
# ifdef PNG_FIXED_POINT_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_gAMA_fixed,(png_structp png_ptr,
png_infop info_ptr, png_fixed_point *int_file_gamma),,138);
# endif
#endif
#ifdef PNG_gAMA_SUPPORTED
@ -1657,8 +1664,10 @@ extern PNG_EXPORT(png_uint_32,png_get_gAMA_fixed,(png_structp png_ptr,
extern PNG_EXPORT(void,png_set_gAMA,(png_structp png_ptr,
png_infop info_ptr, double file_gamma),,139);
# endif
# ifdef PNG_FIXED_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_gAMA_fixed,(png_structp png_ptr,
png_infop info_ptr, png_fixed_point int_file_gamma),,140);
# endif
#endif
#ifdef PNG_hIST_SUPPORTED
@ -1813,12 +1822,11 @@ extern PNG_EXPORT(void,png_set_tRNS,(png_structp png_ptr,
# ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_sCAL,(png_structp png_ptr,
png_infop info_ptr, int *unit, double *width, double *height),,168);
# else
# ifdef PNG_FIXED_POINT_SUPPORTED
# endif
# ifdef PNG_FIXED_POINT_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_sCAL_s,(png_structp png_ptr,
png_infop info_ptr, int *unit, png_charpp swidth,
png_charpp sheight),,169);
# endif
# endif
#endif /* PNG_sCAL_SUPPORTED */
@ -1826,12 +1834,11 @@ extern PNG_EXPORT(png_uint_32,png_get_sCAL_s,(png_structp png_ptr,
# ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_sCAL,(png_structp png_ptr,
png_infop info_ptr, int unit, double width, double height),,170);
# else
# ifdef PNG_FIXED_POINT_SUPPORTED
# endif
# ifdef PNG_FIXED_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_sCAL_s,(png_structp png_ptr,
png_infop info_ptr, int unit, png_charp swidth,
png_charp sheight),,171);
# endif
# endif
#endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */

View File

@ -684,7 +684,7 @@ png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
return(0);
}
#else
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
@ -703,7 +703,6 @@ png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
}
#endif
#endif
#endif
#ifdef PNG_pHYs_SUPPORTED
png_uint_32 PNGAPI

View File

@ -662,26 +662,12 @@ png_set_gray_to_rgb(png_structp png_ptr)
#endif
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
/* Convert a RGB image to a grayscale of the same width. This allows us,
* for example, to convert a 24 bpp RGB image into an 8 bpp grayscale image.
*/
void PNGAPI
png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red,
double green)
{
int red_fixed = (int)((float)red*100000.0 + 0.5);
int green_fixed = (int)((float)green*100000.0 + 0.5);
if (png_ptr == NULL)
return;
png_set_rgb_to_gray_fixed(png_ptr, error_action, red_fixed, green_fixed);
}
void
#ifdef PNG_FIXED_POINT_SUPPORTED
PNGAPI
#else
/* PRIVATE */
#endif
void PNGAPI
png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
png_fixed_point red, png_fixed_point green)
{
@ -741,6 +727,26 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
(png_uint_16)(32768 - red_int - green_int);
}
}
#ifdef PNG_FLOATING_POINT_SUPPORTED
/* Convert a RGB image to a grayscale of the same width. This allows us,
* for example, to convert a 24 bpp RGB image into an 8 bpp grayscale image.
*/
void PNGAPI
png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red,
double green)
{
int red_fixed = (int)((float)red*100000.0 + 0.5);
int green_fixed = (int)((float)green*100000.0 + 0.5);
if (png_ptr == NULL)
return;
png_set_rgb_to_gray_fixed(png_ptr, error_action, red_fixed, green_fixed);
}
#endif /* FLOATING POINT */
#endif
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \

View File

@ -746,8 +746,8 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_ptr->gamma = file_gamma;
# endif
png_set_gAMA(png_ptr, info_ptr, file_gamma);
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
#else
/* Fixed point must be set! */
png_set_gAMA_fixed(png_ptr, info_ptr, igamma);
#endif
}
@ -3187,7 +3187,7 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
break;
}
default:
png_warning(png_ptr, "Ignoring bad adaptive filter type");
png_error(png_ptr, "Ignoring bad adaptive filter type");
*row = 0;
break;
}

View File

@ -141,6 +141,7 @@ png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
png_warning(png_ptr, "Setting gamma = 0");
}
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
void PNGAPI
png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
int_gamma)
@ -172,15 +173,14 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
#ifdef PNG_FLOATING_POINT_SUPPORTED
info_ptr->gamma = (float)(png_gamma/100000.);
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
info_ptr->int_gamma = png_gamma;
#endif
info_ptr->valid |= PNG_INFO_gAMA;
if (png_gamma == 0)
png_warning(png_ptr, "Setting gamma = 0");
}
#endif
#endif
#ifdef PNG_hIST_SUPPORTED
void PNGAPI
@ -368,7 +368,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
}
#endif
#if defined(PNG_READ_sCAL_SUPPORTED) || defined(PNG_WRITE_sCAL_SUPPORTED)
#ifdef PNG_sCAL_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
png_set_sCAL(png_structp png_ptr, png_infop info_ptr,
@ -385,7 +385,7 @@ png_set_sCAL(png_structp png_ptr, png_infop info_ptr,
info_ptr->valid |= PNG_INFO_sCAL;
}
#else
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
void PNGAPI
png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
@ -440,7 +440,6 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
}
#endif
#endif
#endif
#ifdef PNG_pHYs_SUPPORTED
void PNGAPI
@ -558,13 +557,13 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
png_set_sRGB(png_ptr, info_ptr, intent);
#ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
file_gamma = (float).45455;
png_set_gAMA(png_ptr, info_ptr, file_gamma);
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
int_file_gamma = 45455L;
png_set_gAMA_fixed(png_ptr, info_ptr, int_file_gamma);
#else
/* Floating point must be set! */
file_gamma = (float).45455;
png_set_gAMA(png_ptr, info_ptr, file_gamma);
#endif
#endif

View File

@ -85,6 +85,36 @@ pre == -1{
}
}
# variable=value
# Sets the given variable to the given value (the syntax is fairly
# free form, except for deb (you are expected to understand how to
# set the debug variable...)
#
# This happens before the check on 'pre' below skips most of the
# rest of the actions, so the variable settings happen during
# preprocessing but are recorded in the END action too. This
# allows them to be set on the command line too.
$0 ~ /^[ ]*everything[ =]*off[ ]*$/{
everything = "off"
next
}
$0 ~ /^[ ]*everything[ =]*on[ ]*$/{
everything = "on"
next
}
$0 ~ /^[ ]*logunsupported[ =]*0[ ]*$/{
logunsupported = 0
next
}
$0 ~ /^[ ]*logunsupported[ =]*1[ ]*$/{
logunsupported = 1
next
}
$1 == "deb" && $2 == "=" && NF == 3{
deb = $3
next
}
# Preprocessing - this just copies the input file with lines
# that need preprocessing (just chunk at present) expanded
# The bare "pre" instead of "pre != 0" crashes under Sunos awk
@ -153,31 +183,6 @@ $1 == "file" && NF >= 2{
next
}
# variable=value
# Sets the given variable to the given value (the syntax is fairly
# free form, except for deb (you are expected to understand how to
# set the debug variable...)
$0 ~ /^[ ]*everything[ =]*off[ ]*$/{
everything = "off"
next
}
$0 ~ /^[ ]*everything[ =]*on[ ]*$/{
everything = "on"
next
}
$0 ~ /^[ ]*logunsupported[ =]*0[ ]*$/{
logunsupported = 0
next
}
$0 ~ /^[ ]*logunsupported[ =]*1[ ]*$/{
logunsupported = 1
next
}
$1 == "deb" && $2 == "=" && NF == 3{
deb = $3
next
}
# option NAME ( (requires|enables|if) NAME* | on | off | disabled )*
# Declares an option 'NAME' and describes its default setting (disabled)
# and its relationship to other options. The option is disabled
@ -403,12 +408,12 @@ END{
if (err) exit 1
if (pre) {
# Record the variables
print "deb =", deb
# Record the final value of the variables
print "deb =", deb >out
if (everything != "") {
print "everything =", everything
print "everything =", everything >out
}
print "logunsupported =", logunsupported
print "logunsupported =", logunsupported >out
exit 0
}

View File

@ -166,7 +166,7 @@ option WRITE_INT_FUNCTIONS disabled
option WRITE enables WRITE_INT_FUNCTIONS
# Generic options - affect both read and write.
option BENIGN_ERRORS disabled
option BENIGN_ERRORS
option MNG_FEATURES
option FLOATING_POINT enables ok_math
option FIXED_POINT enables ok_math
@ -288,7 +288,7 @@ option READ_COMPOSITE_NODIV requires READ
= NO_READ_COMPOSITE_NODIV PNG_NO_READ_COMPOSITED_NODIV
# Inch conversions: not switched on by default
option INCH_CONVERSIONS requires FLOATING_POINT disabled
option INCH_CONVERSIONS requires FLOATING_POINT
= INCH_CONVERSIONS PNG_INCH_CONVERSIONS
# IN DEVELOPMENT

View File

@ -1,4 +1,4 @@
/* libpng-1.5.0beta32 STANDARD API DEFINITION */
/* libpng-1.5.0beta33 STANDARD API DEFINITION */
/* pnglibconf.h - library build configuration */
/* last changed in libpng version 1.5.0 - June 26, 2010 */
@ -36,12 +36,12 @@
#define PNG_ERROR_TEXT_SUPPORTED
#define PNG_READ_SUPPORTED
/*#undef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED*/
/*#undef PNG_BENIGN_ERRORS_SUPPORTED*/
#define PNG_BENIGN_ERRORS_SUPPORTED
#define PNG_SETJMP_SUPPORTED
#define PNG_WRITE_FLUSH_SUPPORTED
#define PNG_MNG_FEATURES_SUPPORTED
#define PNG_FLOATING_POINT_SUPPORTED
/*#undef PNG_INCH_CONVERSIONS_SUPPORTED*/
#define PNG_INCH_CONVERSIONS_SUPPORTED
#define PNG_STDIO_SUPPORTED
#define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_USER_MEM_SUPPORTED

View File

@ -11,7 +11,7 @@ LIBRARY
;OS2 CODE PRELOAD MOVEABLE DISCARDABLE
EXPORTS
;Version 1.5.0beta32
;Version 1.5.0beta33
png_access_version_number @1
png_set_sig_bytes @2
png_sig_cmp @3
@ -117,6 +117,9 @@ EXPORTS
png_chunk_error @103
png_warning @105
png_chunk_warning @106
png_benign_error @107
png_chunk_benign_error @108
png_set_benign_errors @109
png_get_valid @110
png_get_rowbytes @111
png_get_rows @112
@ -176,7 +179,9 @@ EXPORTS
png_get_tRNS @166
png_set_tRNS @167
png_get_sCAL @168
png_get_sCAL_s @169
png_set_sCAL @170
png_set_sCAL_s @171
png_set_keep_unknown_chunks @172
png_handle_as_unknown @173
png_set_unknown_chunks @174
@ -197,6 +202,12 @@ EXPORTS
png_get_chunk_cache_max @190
png_set_chunk_malloc_max @191
png_get_chunk_malloc_max @192
png_get_pixels_per_inch @193
png_get_x_pixels_per_inch @194
png_get_y_pixels_per_inch @195
png_get_x_offset_inches @196
png_get_y_offset_inches @197
png_get_pHYs_dpi @198
png_get_io_state @199
png_get_io_chunk_name @200
png_get_uint_32 @201