[libpng16] Some files were omitted from a previous checkin. Here they are.

This commit is contained in:
John Bowler 2012-08-10 10:58:01 -05:00 committed by Glenn Randers-Pehrson
parent 134c5761fa
commit ba2dd33d9c
5 changed files with 45 additions and 24 deletions

34
png.c
View File

@ -1709,10 +1709,12 @@ profile_error(png_const_structrp png_ptr, png_colorspacerp colorspace,
if (colorspace != NULL)
{
if (png_ptr->mode & PNG_IS_READ_STRUCT)
png_chunk_benign_error(png_ptr, message);
# ifdef PNG_READ_SUPPORTED
if (png_ptr->mode & PNG_IS_READ_STRUCT)
png_chunk_benign_error(png_ptr, message);
else
else
# endif
png_app_error(png_ptr, message);
}
@ -2548,7 +2550,7 @@ png_check_fp_string(png_const_charp string, png_size_t size)
}
#endif /* pCAL or sCAL */
#ifdef PNG_READ_sCAL_SUPPORTED
#ifdef PNG_sCAL_SUPPORTED
# ifdef PNG_FLOATING_POINT_SUPPORTED
/* Utility used below - a simple accurate power of ten from an integral
* exponent.
@ -3130,7 +3132,7 @@ png_muldiv_warn(png_const_structrp png_ptr, png_fixed_point a, png_int_32 times,
}
#endif
#ifdef PNG_READ_GAMMA_SUPPORTED /* more fixed point functions for gamma */
#ifdef PNG_GAMMA_SUPPORTED /* more fixed point functions for gamma */
/* Calculate a reciprocal, return 0 on div-by-zero or overflow. */
png_fixed_point
png_reciprocal(png_fixed_point a)
@ -3150,6 +3152,18 @@ png_reciprocal(png_fixed_point a)
return 0; /* error/overflow */
}
/* This is the shared test on whether a gamma value is 'significant' - whether
* it is worth doing gamma correction.
*/
int /* PRIVATE */
png_gamma_significant(png_fixed_point gamma_val)
{
return gamma_val < PNG_FP_1 - PNG_GAMMA_THRESHOLD_FIXED ||
gamma_val > PNG_FP_1 + PNG_GAMMA_THRESHOLD_FIXED;
}
#endif
#ifdef PNG_READ_GAMMA_SUPPORTED
/* A local convenience routine. */
static png_fixed_point
png_product2(png_fixed_point a, png_fixed_point b)
@ -3550,16 +3564,6 @@ png_gamma_correct(png_structrp png_ptr, unsigned int value,
return png_gamma_16bit_correct(value, gamma_val);
}
/* This is the shared test on whether a gamma value is 'significant' - whether
* it is worth doing gamma correction.
*/
int /* PRIVATE */
png_gamma_significant(png_fixed_point gamma_val)
{
return gamma_val < PNG_FP_1 - PNG_GAMMA_THRESHOLD_FIXED ||
gamma_val > PNG_FP_1 + PNG_GAMMA_THRESHOLD_FIXED;
}
/* Internal function to build a single 16-bit table - the table consists of
* 'num' 256 entry subtables, where 'num' is determined by 'shift' - the amount
* to shift the input values right (or 16-number_of_signifiant_bits).

6
png.h
View File

@ -1238,7 +1238,7 @@ PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structrp png_ptr,
int mode, png_fixed_point output_gamma))
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED)
#if defined(PNG_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED)
/* The output_gamma value is a screen gamma in libpng terminology: it expresses
* how to decode the output values, not how they are encoded. The values used
* correspond to the normal numbers used to describe the overall gamma of a
@ -1958,9 +1958,11 @@ PNG_EXPORT(106, void, png_chunk_warning, (png_const_structrp png_ptr,
PNG_EXPORT(107, void, png_benign_error, (png_const_structrp png_ptr,
png_const_charp warning_message));
/* Same, chunk name is prepended to message. */
#ifdef PNG_READ_SUPPORTED
/* Same, chunk name is prepended to message (only during read) */
PNG_EXPORT(108, void, png_chunk_benign_error, (png_const_structrp png_ptr,
png_const_charp warning_message));
#endif
PNG_EXPORT(109, void, png_set_benign_errors,
(png_structrp png_ptr, int allowed));

View File

@ -175,6 +175,9 @@ png_get_pixel_aspect_ratio(png_const_structrp png_ptr, png_const_inforp info_ptr
return ((float)((float)info_ptr->y_pixels_per_unit
/(float)info_ptr->x_pixels_per_unit));
}
#else
PNG_UNUSED(png_ptr)
PNG_UNUSED(info_ptr)
#endif
return ((float)0.0);
@ -203,6 +206,9 @@ png_get_pixel_aspect_ratio_fixed(png_const_structrp png_ptr,
(png_int_32)info_ptr->x_pixels_per_unit))
return res;
}
#else
PNG_UNUSED(png_ptr)
PNG_UNUSED(info_ptr)
#endif
return 0;

View File

@ -1593,7 +1593,7 @@ PNG_INTERNAL_FUNCTION(void,png_app_error,(png_const_structrp png_ptr,
/* ASCII to FP interfaces, currently only implemented if sCAL
* support is required.
*/
#if defined(PNG_READ_sCAL_SUPPORTED)
#if defined(PNG_sCAL_SUPPORTED)
/* MAX_DIGITS is actually the maximum number of characters in an sCAL
* width or height, derived from the precision (number of significant
* digits - a build time settable option) and assumptions about the
@ -1611,7 +1611,7 @@ PNG_INTERNAL_FUNCTION(void,png_ascii_from_fp,(png_const_structrp png_ptr,
PNG_INTERNAL_FUNCTION(void,png_ascii_from_fixed,(png_const_structrp png_ptr,
png_charp ascii, png_size_t size, png_fixed_point fp),PNG_EMPTY);
#endif /* FIXED_POINT */
#endif /* READ_sCAL */
#endif /* sCAL */
#if defined(PNG_sCAL_SUPPORTED) || defined(PNG_pCAL_SUPPORTED)
/* An internal API to validate the format of a floating point number.
@ -1733,7 +1733,7 @@ PNG_INTERNAL_FUNCTION(png_fixed_point,png_muldiv_warn,
png_int_32 divided_by),PNG_EMPTY);
#endif
#ifdef PNG_READ_GAMMA_SUPPORTED
#ifdef PNG_GAMMA_SUPPORTED
/* Calculate a reciprocal - used for gamma values. This returns
* 0 if the argument is 0 in order to maintain an undefined value,
* there are no warnings.
@ -1741,14 +1741,20 @@ PNG_INTERNAL_FUNCTION(png_fixed_point,png_muldiv_warn,
PNG_INTERNAL_FUNCTION(png_fixed_point,png_reciprocal,(png_fixed_point a),
PNG_EMPTY);
#ifdef PNG_READ_GAMMA_SUPPORTED
/* The same but gives a reciprocal of the product of two fixed point
* values. Accuracy is suitable for gamma calculations but this is
* not exact - use png_muldiv for that.
* not exact - use png_muldiv for that. Only required at present on read.
*/
PNG_INTERNAL_FUNCTION(png_fixed_point,png_reciprocal2,(png_fixed_point a,
png_fixed_point b),PNG_EMPTY);
#endif
/* Return true if the gamma value is significantly different from 1.0 */
PNG_INTERNAL_FUNCTION(int,png_gamma_significant,(png_fixed_point gamma_value),
PNG_EMPTY);
#endif
#ifdef PNG_READ_GAMMA_SUPPORTED
/* Internal fixed point gamma correction. These APIs are called as
* required to convert single values - they don't need to be fast,
@ -1759,8 +1765,6 @@ PNG_INTERNAL_FUNCTION(png_fixed_point,png_reciprocal2,(png_fixed_point a,
*/
PNG_INTERNAL_FUNCTION(png_uint_16,png_gamma_correct,(png_structrp png_ptr,
unsigned int value, png_fixed_point gamma_value),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(int,png_gamma_significant,(png_fixed_point gamma_value),
PNG_EMPTY);
PNG_INTERNAL_FUNCTION(png_uint_16,png_gamma_16bit_correct,(unsigned int value,
png_fixed_point gamma_value),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(png_byte,png_gamma_8bit_correct,(unsigned int value,
@ -1820,6 +1824,11 @@ PNG_INTERNAL_FUNCTION(int,png_safe_execute,(png_imagep image,
PNG_INTERNAL_FUNCTION(int,png_image_error,(png_imagep image,
png_const_charp error_message),PNG_EMPTY);
#ifndef PNG_SIMPLIFIED_READ_SUPPORTED
/* png_image_free is used by the write code but not exported */
PNG_INTERNAL_FUNCTION(void, png_image_free, (png_imagep image), PNG_EMPTY);
#endif /* !SIMPLIFIED_READ */
#endif /* SIMPLIFIED READ/WRITE */
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */

View File

@ -139,7 +139,7 @@ png_set_filler(png_structrp png_ptr, png_uint_32 filler, int filler_loc)
png_ptr->filler = (png_uint_16)filler;
# else
png_app_error(png_ptr, "png_set_filler not supported on read");
PNG_UNUSED(filler); /* not used in the write case */
PNG_UNUSED(filler) /* not used in the write case */
return;
# endif
}