提交 ef217b76 编写于 作者: G Glenn Randers-Pehrson

[devel] Updated comments that mention 1.5.3; changed them to 1.5.4.

上级 b0791f75
......@@ -2385,7 +2385,7 @@ png_build_gamma_table(png_structp png_ptr, int bit_depth)
png_ptr->gamma_shift = shift;
#ifdef PNG_16BIT_SUPPORTED
/* NOTE: prior to 1.5.3 this test used to include PNG_BACKGROUND (now
/* NOTE: prior to 1.5.4 this test used to include PNG_BACKGROUND (now
* PNG_COMPOSE). This effectively smashed the background calculation for
* 16-bit output because the 8-bit table assumes the result will be reduced
* to 8 bits.
......
......@@ -900,8 +900,9 @@ PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), typedef);
#define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* write only */
/* Added to libpng-1.4.0 */
#define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */
/* Added to libpng-1.5.3 */
/* Added to libpng-1.5.4 */
#define PNG_TRANSFORM_EXPAND_16 0x4000 /* read only */
#define PNG_TRANSFORM_CHOP_16 0x8000 /* read only */
/* Flags for MNG supported features */
#define PNG_FLAG_MNG_EMPTY_PLTE 0x01
......@@ -1404,7 +1405,7 @@ PNG_EXPORT(46, void, png_set_invert_mono, (png_structp png_ptr));
#ifdef PNG_READ_BACKGROUND_SUPPORTED
/* Handle alpha and tRNS by replacing with a background color. Prior to
* libpng-1.5.3 this API must not be called before the PNG file header has been
* libpng-1.5.4 this API must not be called before the PNG file header has been
* read. Doing so will result in unexpected behavior and possible warnings or
* errors if the PNG file contains a bKGD chunk.
*/
......
......@@ -507,7 +507,7 @@ png_default_error,(png_structp png_ptr, png_const_charp error_message),
{
#ifdef PNG_CONSOLE_IO_SUPPORTED
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
/* Check on NULL only added in 1.5.3 */
/* Check on NULL only added in 1.5.4 */
if (error_message != NULL && *error_message == PNG_LITERAL_SHARP)
{
/* Strip "#nnnn " from beginning of error message. */
......
......@@ -116,7 +116,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
#endif
/* If warnings or errors are turned off the code is disabled or redirected here.
* From 1.5.3 functions have been added to allow very limited formatting of
* From 1.5.4 functions have been added to allow very limited formatting of
* error and warning messages - this code will also be disabled here.
*/
#ifdef PNG_WARNINGS_SUPPORTED
......@@ -295,7 +295,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
#define PNG_RGB_TO_GRAY_ERR 0x200000L
#define PNG_RGB_TO_GRAY_WARN 0x400000L
#define PNG_RGB_TO_GRAY 0x600000L /* two bits, RGB_TO_GRAY_ERR|WARN */
#define PNG_ENCODE_ALPHA 0x800000L /* Added to libpng-1.5.3 */
#define PNG_ENCODE_ALPHA 0x800000L /* Added to libpng-1.5.4 */
#define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */
#define PNG_EXPAND_tRNS 0x2000000L /* Added to libpng-1.2.9 */
#define PNG_CHOP_16_TO_8 0x4000000L
......@@ -325,9 +325,9 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200
#define PNG_FLAG_CRC_CRITICAL_USE 0x0400
#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800
#define PNG_FLAG_ASSUME_sRGB 0x1000 /* Added to libpng-1.5.3 */
#define PNG_FLAG_OPTIMIZE_ALPHA 0x2000 /* Added to libpng-1.5.3 */
#define PNG_FLAG_DETECT_UNINITIALIZED 0x4000 /* Added to libpng-1.5.3 */
#define PNG_FLAG_ASSUME_sRGB 0x1000 /* Added to libpng-1.5.4 */
#define PNG_FLAG_OPTIMIZE_ALPHA 0x2000 /* Added to libpng-1.5.4 */
#define PNG_FLAG_DETECT_UNINITIALIZED 0x4000 /* Added to libpng-1.5.4 */
#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L
#define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L
#define PNG_FLAG_LIBRARY_MISMATCH 0x20000L
......@@ -338,7 +338,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
/* 0x400000L unused */
#define PNG_FLAG_BENIGN_ERRORS_WARN 0x800000L /* Added to libpng-1.4.0 */
#define PNG_FLAG_ZTXT_CUSTOM_STRATEGY 0x1000000L /* 5 lines added */
#define PNG_FLAG_ZTXT_CUSTOM_LEVEL 0x2000000L /* to libpng-1.5.3 */
#define PNG_FLAG_ZTXT_CUSTOM_LEVEL 0x2000000L /* to libpng-1.5.4 */
#define PNG_FLAG_ZTXT_CUSTOM_MEM_LEVEL 0x4000000L
#define PNG_FLAG_ZTXT_CUSTOM_WINDOW_BITS 0x8000000L
#define PNG_FLAG_ZTXT_CUSTOM_METHOD 0x10000000L
......@@ -452,7 +452,7 @@ PNG_EXTERN png_fixed_point png_fixed PNGARG((png_structp png_ptr, double fp,
#define PNG_tRNS PNG_CONST png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'}
#define PNG_zTXt PNG_CONST png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'}
/* Gamma values (new at libpng-1.5.3): */
/* Gamma values (new at libpng-1.5.4): */
#define PNG_GAMMA_MAC_OLD 151724 /* Assume '1.8' is really 2.2/1.45! */
#define PNG_GAMMA_MAC_INVERSE 65909
#define PNG_GAMMA_sRGB_INVERSE 45455
......@@ -1133,7 +1133,7 @@ PNG_EXTERN png_charp png_format_number(png_const_charp start, png_charp end,
#endif
#ifdef PNG_WARNINGS_SUPPORTED
/* New defines and members adding in libpng-1.5.3 */
/* New defines and members adding in libpng-1.5.4 */
# define PNG_WARNING_PARAMETER_SIZE 32
# define PNG_WARNING_PARAMETER_COUNT 8
......
......@@ -1292,6 +1292,9 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
if (transforms & PNG_TRANSFORM_STRIP_16)
png_set_strip_16(png_ptr);
# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
/* Added at libpng-1.5.4. "chop_16" produces the same result that "strip_16"
* did in earlier versions, while "strip_16" is now more accurate.
*/
else
if (transforms & PNG_TRANSFORM_CHOP_16)
png_set_chop_16(png_ptr);
......@@ -1392,7 +1395,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
png_set_gray_to_rgb(png_ptr);
#endif
/* Added at libpng-1.5.3 */
/* Added at libpng-1.5.4 */
#ifdef PNG_READ_EXPAND_16_SUPPORTED
if (transforms & PNG_TRANSFORM_EXPAND_16)
png_set_expand_16(png_ptr);
......
......@@ -775,12 +775,12 @@ png_set_gamma_fixed(png_structp png_ptr, png_fixed_point scrn_gamma,
if (png_ptr == NULL)
return;
/* New in libpng-1.5.3 - reserve particular negative values as flags. */
/* New in libpng-1.5.4 - reserve particular negative values as flags. */
scrn_gamma = translate_gamma_flags(png_ptr, scrn_gamma, 1/*screen*/);
file_gamma = translate_gamma_flags(png_ptr, file_gamma, 0/*file*/);
#if PNG_LIBPNG_VER >= 10600
/* Checking the gamma values for being >0 was added in 1.5.3 along with the
/* Checking the gamma values for being >0 was added in 1.5.4 along with the
* premultiplied alpha support; this actually hides an undocumented feature
* of the previous implementation which allowed gamma processing to be
* disabled in background handling. There is no evidence (so far) that this
......@@ -1155,7 +1155,7 @@ png_init_palette_transformations(png_structp png_ptr)
static void /* PRIVATE */
png_init_rgb_transformations(png_structp png_ptr)
{
/* Added to libpng-1.5.3: check the color type to determine whether there
/* Added to libpng-1.5.4: check the color type to determine whether there
* is any alpha or transparency in the image and simply cancel the
* background and alpha mode stuff if there isn't.
*/
......@@ -1260,9 +1260,9 @@ png_init_read_transformations(png_structp png_ptr)
*/
#ifdef PNG_READ_GAMMA_SUPPORTED
/* Prior to 1.5.3 these tests were performed from png_set_gamma, 1.5.3 adds
/* Prior to 1.5.4 these tests were performed from png_set_gamma, 1.5.4 adds
* png_set_alpha_mode and this is another source for a default file gamma so
* the test needs to be performed later - here. In addition prior to 1.5.3
* the test needs to be performed later - here. In addition prior to 1.5.4
* the tests were repeated for the PALETTE color type here - this is no
* longer necessary (and doesn't seem to have been necessary before.)
*/
......@@ -1287,7 +1287,7 @@ png_init_read_transformations(png_structp png_ptr)
else if (png_ptr->screen_gamma != 0)
/* The converse - assume the file matches the screen, note that this
* perhaps undesireable default can (from 1.5.3) be changed by calling
* perhaps undesireable default can (from 1.5.4) be changed by calling
* png_set_alpha_mode (even if the alpha handling mode isn't required
* or isn't changed from the default.)
*/
......@@ -1297,7 +1297,7 @@ png_init_read_transformations(png_structp png_ptr)
/* Just in case the following prevents any processing - file and screen
* are both assumed to be linear and there is no way to introduce a
* third gamma value other than png_set_background with 'UNIQUE', and,
* prior to 1.5.3
* prior to 1.5.4
*/
png_ptr->screen_gamma = png_ptr->gamma = PNG_FP_1;
......@@ -1358,12 +1358,12 @@ png_init_read_transformations(png_structp png_ptr)
PNG_EXPAND_tRNS);
png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
/* Kill the tRNS chunk itself too. Prior to 1.5.3 this did not happen
/* Kill the tRNS chunk itself too. Prior to 1.5.4 this did not happen
* so transparency information would remain just so long as it wasn't
* expanded. This produces unexpected API changes if the set of things
* that do PNG_EXPAND_tRNS changes (perfectly possible given the
* documentation - which says ask for what you want, accept what you
* get.) This makes the behavior consistent from 1.5.3:
* get.) This makes the behavior consistent from 1.5.4:
*/
png_ptr->num_trans = 0;
}
......@@ -1473,7 +1473,7 @@ png_init_read_transformations(png_structp png_ptr)
* background support (see the comments in scripts/pnglibconf.dfa), this
* allows pre-multiplication of the alpha channel to be implemented as
* compositing on black. This is probably sub-optimal and has been done in
* 1.5.3 betas simply to enable external critique and testing (i.e. to
* 1.5.4 betas simply to enable external critique and testing (i.e. to
* implement the new API quickly, without lots of internal changes.)
*/
......@@ -1492,7 +1492,7 @@ png_init_read_transformations(png_structp png_ptr)
* the gamma tables will not be built even if composition is required on a
* gamma encoded value.
*
* In 1.5.3 this is addressed below by an additional check on the individual
* In 1.5.4 this is addressed below by an additional check on the individual
* file gamma - if it is not 1.0 both RGB_TO_GRAY and COMPOSE need the
* tables.
*/
......@@ -1860,7 +1860,7 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
#endif
#ifdef PNG_READ_GAMMA_SUPPORTED
/* The following used to be conditional on PNG_GAMMA (prior to 1.5.3),
/* The following used to be conditional on PNG_GAMMA (prior to 1.5.4),
* however it seems that the code in png_init_read_transformations, which has
* been called before this from png_read_update_info->png_read_start_row
* sometimes does the gamma transform and cancels the flag.
......@@ -1969,7 +1969,7 @@ defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, info_ptr->width);
/* Adding in 1.5.3: cache the above value in png_struct so that we can later
/* Adding in 1.5.4: cache the above value in png_struct so that we can later
* check in png_rowbytes that the user buffer won't get overwritten. Note
* that the field is not always set - if png_read_update_info isn't called
* the application has to either not do any transforms or get the calculation
......@@ -1994,15 +1994,15 @@ png_do_read_transformations(png_structp png_ptr)
if (png_ptr->row_buf == NULL)
{
/* Prior to 1.5.3 this output row/pass where the NULL pointer is, but this
/* Prior to 1.5.4 this output row/pass where the NULL pointer is, but this
* error is incredibly rare and incredibly easy to debug without this
* information.
*/
png_error(png_ptr, "NULL row buffer");
}
/* The following is debugging; prior to 1.5.3 the code was never compiled in;
* in 1.5.3 PNG_FLAG_DETECT_UNINITIALIZED was added and the macro
/* The following is debugging; prior to 1.5.4 the code was never compiled in;
* in 1.5.4 PNG_FLAG_DETECT_UNINITIALIZED was added and the macro
* PNG_WARN_UNINITIALIZED_ROW removed. In 1.5 the new flag is set only for
* selected new APIs to ensure that there is no API change.
*/
......@@ -2011,7 +2011,7 @@ png_do_read_transformations(png_structp png_ptr)
{
/* Application has failed to call either png_read_start_image() or
* png_read_update_info() after setting transforms that expand pixels.
* This check added to libpng-1.2.19 (but not enabled until 1.5.3).
* This check added to libpng-1.2.19 (but not enabled until 1.5.4).
*/
png_error(png_ptr, "Uninitialized row");
}
......@@ -2173,7 +2173,7 @@ png_do_read_transformations(png_structp png_ptr)
#endif
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
/*NOTE: moved here in 1.5.3 (from much later in this list.) */
/*NOTE: moved here in 1.5.4 (from much later in this list.) */
if ((png_ptr->transformations & PNG_GRAY_TO_RGB) &&
(png_ptr->mode & PNG_BACKGROUND_IS_GRAY))
png_do_gray_to_rgb(&(png_ptr->row_info), png_ptr->row_buf + 1);
......
......@@ -2679,7 +2679,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
{
png_debug(1, "in png_combine_row");
/* Added in 1.5.3: the row_info should match the information returned by any
/* Added in 1.5.4: the row_info should match the information returned by any
* call to png_read_update_info at this point. Do not continue if we got
* this wrong.
*/
......
......@@ -68,7 +68,7 @@ struct png_struct_def
uInt zbuf_size; /* size of zbuf (typically 65536) */
#ifdef PNG_WRITE_SUPPORTED
/* Added in 1.5.3: state to keep track of whether the zstream has been
/* Added in 1.5.4: state to keep track of whether the zstream has been
* initialized and if so whether it is for IDAT or some other chunk.
*/
#define PNG_ZLIB_UNINITIALIZED 0
......@@ -78,7 +78,7 @@ struct png_struct_def
#define PNG_ZLIB_IN_USE 4 /* a flag value */
png_uint_32 zlib_state; /* State of zlib initialization */
/* End of material added at libpng 1.5.3 */
/* End of material added at libpng 1.5.4 */
int zlib_level; /* holds zlib compression level */
int zlib_method; /* holds zlib compression method */
......@@ -86,7 +86,7 @@ struct png_struct_def
int zlib_mem_level; /* holds zlib compression memory level */
int zlib_strategy; /* holds zlib compression strategy */
#endif
/* Added at libpng 1.5.3 */
/* Added at libpng 1.5.4 */
#if defined(PNG_WRITE_COMPRESSED_TEXT_SUPPORTED) || \
defined(PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED)
int zlib_text_level; /* holds zlib compression level */
......@@ -95,7 +95,7 @@ struct png_struct_def
int zlib_text_mem_level; /* holds zlib compression memory level */
int zlib_text_strategy; /* holds zlib compression strategy */
#endif
/* End of material added at libpng 1.5.3 */
/* End of material added at libpng 1.5.4 */
png_uint_32 width; /* width of image in pixels */
png_uint_32 height; /* height of image in pixels */
......@@ -111,7 +111,7 @@ struct png_struct_def
png_bytep avg_row; /* buffer to save "avg" row when filtering */
png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
png_row_info row_info; /* used for transformation routines */
png_size_t info_rowbytes; /* Added in 1.5.3: cache of updated row bytes */
png_size_t info_rowbytes; /* Added in 1.5.4: cache of updated row bytes */
png_uint_32 idat_size; /* current IDAT size for read */
png_uint_32 crc; /* current chunk CRC value */
......
......@@ -918,7 +918,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
/* Normally one would use Z_DEFAULT_STRATEGY for text compression.
* This is here just to make pngtest replicate the results from libpng
* versions prior to 1.5.3, and to test this new API.
* versions prior to 1.5.4, and to test this new API.
*/
png_set_text_compression_strategy(write_ptr, Z_FILTERED);
#endif
......
......@@ -3429,7 +3429,7 @@ read_palette(store_palette palette, int *npalette, png_structp pp, png_infop pi)
if ((png_get_tRNS(pp, pi, &trans_alpha, &num, 0) & PNG_INFO_tRNS) != 0 &&
(trans_alpha != NULL || num != 1/*returns 1 for a transparent color*/) &&
/* Oops, if a palette tRNS gets expanded png_read_update_info (at least so
* far as 1.5.3) does not zap the trans_alpha pointer, only num_trans, so
* far as 1.5.4) does not zap the trans_alpha pointer, only num_trans, so
* in the above call we get a success, we get a pointer (who knows what
* to) and we get num_trans == 0:
*/
......
......@@ -1458,7 +1458,7 @@ png_set_compression_method(png_structp png_ptr, int method)
png_ptr->zlib_method = method;
}
/* The following were added to libpng-1.5.3 */
/* The following were added to libpng-1.5.4 */
#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
void PNGAPI
png_set_text_compression_level(png_structp png_ptr, int level)
......@@ -1539,7 +1539,7 @@ png_set_text_compression_method(png_structp png_ptr, int method)
png_ptr->zlib_text_method = method;
}
#endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED */
/* end of API added to libpng-1.5.3 */
/* end of API added to libpng-1.5.4 */
void PNGAPI
png_set_write_status_fn(png_structp png_ptr, png_write_status_ptr write_row_fn)
......
......@@ -1017,7 +1017,7 @@ png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length)
png_write_chunk(png_ptr, png_IDAT, data, length);
png_ptr->mode |= PNG_HAVE_IDAT;
/* Prior to 1.5.3 this code was replicated in every caller (except at the
/* Prior to 1.5.4 this code was replicated in every caller (except at the
* end, where it isn't technically necessary). Since this function has
* flushed the data we can safely reset the zlib output buffer here.
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册