[devel] Changed some "#if defined(" to "ifdef"

This commit is contained in:
Glenn Randers-Pehrson 2009-09-23 11:22:08 -05:00
parent 212defee0f
commit e26c09529a
14 changed files with 511 additions and 511 deletions

32
png.c
View File

@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions
*
* Last changed in libpng 1.4.0 [September 17, 2009]
* Last changed in libpng 1.4.0 [September 23, 2009]
* Copyright (c) 1998-2009 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.)
@ -251,7 +251,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
if (png_ptr == NULL || info_ptr == NULL)
return;
#if defined(PNG_TEXT_SUPPORTED)
#ifdef PNG_TEXT_SUPPORTED
/* Free text item num or (if num == -1) all text items */
if ((mask & PNG_FREE_TEXT) & info_ptr->free_me)
{
@ -275,7 +275,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
}
#endif
#if defined(PNG_tRNS_SUPPORTED)
#ifdef PNG_tRNS_SUPPORTED
/* Free any tRNS entry */
if ((mask & PNG_FREE_TRNS) & info_ptr->free_me)
{
@ -285,7 +285,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
}
#endif
#if defined(PNG_sCAL_SUPPORTED)
#ifdef PNG_sCAL_SUPPORTED
/* Free any sCAL entry */
if ((mask & PNG_FREE_SCAL) & info_ptr->free_me)
{
@ -299,7 +299,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
}
#endif
#if defined(PNG_pCAL_SUPPORTED)
#ifdef PNG_pCAL_SUPPORTED
/* Free any pCAL entry */
if ((mask & PNG_FREE_PCAL) & info_ptr->free_me)
{
@ -322,7 +322,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
}
#endif
#if defined(PNG_iCCP_SUPPORTED)
#ifdef PNG_iCCP_SUPPORTED
/* Free any iCCP entry */
if ((mask & PNG_FREE_ICCP) & info_ptr->free_me)
{
@ -334,7 +334,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
}
#endif
#if defined(PNG_sPLT_SUPPORTED)
#ifdef PNG_sPLT_SUPPORTED
/* Free a given sPLT entry, or (if num == -1) all sPLT entries */
if ((mask & PNG_FREE_SPLT) & info_ptr->free_me)
{
@ -365,7 +365,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
}
#endif
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
if (png_ptr->unknown_chunk.data)
{
png_free(png_ptr, png_ptr->unknown_chunk.data);
@ -399,7 +399,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
}
#endif
#if defined(PNG_hIST_SUPPORTED)
#ifdef PNG_hIST_SUPPORTED
/* Free any hIST entry */
if ((mask & PNG_FREE_HIST) & info_ptr->free_me)
{
@ -418,7 +418,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
info_ptr->num_palette = 0;
}
#if defined(PNG_INFO_IMAGE_SUPPORTED)
#ifdef PNG_INFO_IMAGE_SUPPORTED
/* Free any image bits attached to the info structure */
if ((mask & PNG_FREE_ROWS) & info_ptr->free_me)
{
@ -452,7 +452,7 @@ png_info_destroy(png_structp png_ptr, png_infop info_ptr)
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
#if defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
if (png_ptr->num_chunk_list)
{
png_free(png_ptr, png_ptr->chunk_list);
@ -496,7 +496,7 @@ png_init_io(png_structp png_ptr, png_FILE_p fp)
}
#endif
#if defined(PNG_TIME_RFC1123_SUPPORTED)
#ifdef PNG_TIME_RFC1123_SUPPORTED
/* Convert the supplied time into an RFC 1123 string suitable for use in
* a "Creation Time" or other text-based time string.
*/
@ -546,13 +546,13 @@ png_get_copyright(png_structp png_ptr)
#else
#ifdef __STDC__
return ((png_charp) PNG_STRING_NEWLINE \
"libpng version x 1.4.0beta81 - September 17, 2009" PNG_STRING_NEWLINE \
"libpng version x 1.4.0beta81 - September 23, 2009" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2009 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE);
#else
return ((png_charp) "libpng version 1.4.0beta81 - September 17, 2009\
return ((png_charp) "libpng version 1.4.0beta81 - September 23, 2009\
Copyright (c) 1998-2009 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
@ -652,8 +652,8 @@ png_convert_size(size_t size)
#endif /* PNG_SIZE_T */
/* Added at libpng version 1.2.34 and 1.4.0 (moved from pngset.c) */
#if defined(PNG_cHRM_SUPPORTED)
#if defined(PNG_CHECK_cHRM_SUPPORTED)
#ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_CHECK_cHRM_SUPPORTED
/*
* Multiply two 32-bit numbers, V1 and V2, using 32-bit

View File

@ -1,7 +1,7 @@
/* pngget.c - retrieval of values from info struct
*
* Last changed in libpng 1.4.0 [September 17, 2009]
* Last changed in libpng 1.4.0 [September 23, 2009]
* Copyright (c) 1998-2009 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.)
@ -36,7 +36,7 @@ png_get_rowbytes(png_structp png_ptr, png_infop info_ptr)
return(0);
}
#if defined(PNG_INFO_IMAGE_SUPPORTED)
#ifdef PNG_INFO_IMAGE_SUPPORTED
png_bytepp PNGAPI
png_get_rows(png_structp png_ptr, png_infop info_ptr)
{
@ -117,7 +117,7 @@ png_uint_32 PNGAPI
png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_pHYs_SUPPORTED)
#ifdef PNG_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs)
{
png_debug1(1, "in %s retrieval function", "png_get_x_pixels_per_meter");
@ -138,7 +138,7 @@ png_uint_32 PNGAPI
png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_pHYs_SUPPORTED)
#ifdef PNG_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs)
{
png_debug1(1, "in %s retrieval function", "png_get_y_pixels_per_meter");
@ -159,7 +159,7 @@ png_uint_32 PNGAPI
png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_pHYs_SUPPORTED)
#ifdef PNG_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs)
{
png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter");
@ -182,7 +182,7 @@ float PNGAPI
png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_pHYs_SUPPORTED)
#ifdef PNG_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs)
{
@ -206,7 +206,7 @@ png_int_32 PNGAPI
png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_oFFs_SUPPORTED)
#ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs)
{
@ -229,7 +229,7 @@ png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_oFFs_SUPPORTED)
#ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs)
{
png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
@ -251,7 +251,7 @@ png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_oFFs_SUPPORTED)
#ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs)
{
png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
@ -273,7 +273,7 @@ png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_oFFs_SUPPORTED)
#ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs)
{
png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
@ -326,7 +326,7 @@ png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr)
*.00003937);
}
#if defined(PNG_pHYs_SUPPORTED)
#ifdef PNG_pHYs_SUPPORTED
png_uint_32 PNGAPI
png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
@ -385,7 +385,7 @@ png_get_signature(png_structp png_ptr, png_infop info_ptr)
return (NULL);
}
#if defined(PNG_bKGD_SUPPORTED)
#ifdef PNG_bKGD_SUPPORTED
png_uint_32 PNGAPI
png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
png_color_16p *background)
@ -402,7 +402,7 @@ png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
}
#endif
#if defined(PNG_cHRM_SUPPORTED)
#ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
@ -468,7 +468,7 @@ png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
#endif
#endif
#if defined(PNG_gAMA_SUPPORTED)
#ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
@ -502,7 +502,7 @@ png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
#endif
#endif
#if defined(PNG_sRGB_SUPPORTED)
#ifdef PNG_sRGB_SUPPORTED
png_uint_32 PNGAPI
png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
{
@ -518,7 +518,7 @@ png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
}
#endif
#if defined(PNG_iCCP_SUPPORTED)
#ifdef PNG_iCCP_SUPPORTED
png_uint_32 PNGAPI
png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
png_charpp name, int *compression_type,
@ -542,7 +542,7 @@ png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
}
#endif
#if defined(PNG_sPLT_SUPPORTED)
#ifdef PNG_sPLT_SUPPORTED
png_uint_32 PNGAPI
png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
png_sPLT_tpp spalettes)
@ -556,7 +556,7 @@ png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
}
#endif
#if defined(PNG_hIST_SUPPORTED)
#ifdef PNG_hIST_SUPPORTED
png_uint_32 PNGAPI
png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
{
@ -627,7 +627,7 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
return (0);
}
#if defined(PNG_oFFs_SUPPORTED)
#ifdef PNG_oFFs_SUPPORTED
png_uint_32 PNGAPI
png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
@ -646,7 +646,7 @@ png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
}
#endif
#if defined(PNG_pCAL_SUPPORTED)
#ifdef PNG_pCAL_SUPPORTED
png_uint_32 PNGAPI
png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
@ -671,7 +671,7 @@ png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
}
#endif
#if defined(PNG_sCAL_SUPPORTED)
#ifdef PNG_sCAL_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
@ -707,7 +707,7 @@ png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
#endif
#endif
#if defined(PNG_pHYs_SUPPORTED)
#ifdef PNG_pHYs_SUPPORTED
png_uint_32 PNGAPI
png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
@ -758,7 +758,7 @@ png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
return (0);
}
#if defined(PNG_sBIT_SUPPORTED)
#ifdef PNG_sBIT_SUPPORTED
png_uint_32 PNGAPI
png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
{
@ -774,7 +774,7 @@ png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
}
#endif
#if defined(PNG_TEXT_SUPPORTED)
#ifdef PNG_TEXT_SUPPORTED
png_uint_32 PNGAPI
png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
int *num_text)
@ -799,7 +799,7 @@ png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
}
#endif
#if defined(PNG_tIME_SUPPORTED)
#ifdef PNG_tIME_SUPPORTED
png_uint_32 PNGAPI
png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
{
@ -815,7 +815,7 @@ png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
}
#endif
#if defined(PNG_tRNS_SUPPORTED)
#ifdef PNG_tRNS_SUPPORTED
png_uint_32 PNGAPI
png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)
@ -857,7 +857,7 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
}
#endif
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
png_uint_32 PNGAPI
png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
png_unknown_chunkpp unknowns)
@ -871,7 +871,7 @@ png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
}
#endif
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
png_byte PNGAPI
png_get_rgb_to_gray_status (png_structp png_ptr)
{
@ -879,7 +879,7 @@ png_get_rgb_to_gray_status (png_structp png_ptr)
}
#endif
#if defined(PNG_USER_CHUNKS_SUPPORTED)
#ifdef PNG_USER_CHUNKS_SUPPORTED
png_voidp PNGAPI
png_get_user_chunk_ptr(png_structp png_ptr)
{

View File

@ -1,7 +1,7 @@
/* pngmem.c - stub functions for memory allocation
*
* Last changed in libpng 1.4.0 [September 17, 2009]
* Last changed in libpng 1.4.0 [September 23, 2009]
* Copyright (c) 1998-2009 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.)

View File

@ -1,7 +1,7 @@
/* pngpread.c - read a png file in push mode
*
* Last changed in libpng 1.4.0 [September 20, 2009]
* Last changed in libpng 1.4.0 [September 23, 2009]
* Copyright (c) 1998-2009 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.)
@ -70,7 +70,7 @@ png_process_some_data(png_structp png_ptr, png_infop info_ptr)
break;
}
#if defined(PNG_READ_tEXt_SUPPORTED)
#ifdef PNG_READ_tEXt_SUPPORTED
case PNG_READ_tEXt_MODE:
{
png_push_read_tEXt(png_ptr, info_ptr);
@ -78,7 +78,7 @@ png_process_some_data(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
#ifdef PNG_READ_zTXt_SUPPORTED
case PNG_READ_zTXt_MODE:
{
png_push_read_zTXt(png_ptr, info_ptr);
@ -86,7 +86,7 @@ png_process_some_data(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_iTXt_SUPPORTED)
#ifdef PNG_READ_iTXt_SUPPORTED
case PNG_READ_iTXt_MODE:
{
png_push_read_iTXt(png_ptr, info_ptr);
@ -153,55 +153,55 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
PNG_IDAT;
PNG_IEND;
PNG_PLTE;
#if defined(PNG_READ_bKGD_SUPPORTED)
#ifdef PNG_READ_bKGD_SUPPORTED
PNG_bKGD;
#endif
#if defined(PNG_READ_cHRM_SUPPORTED)
#ifdef PNG_READ_cHRM_SUPPORTED
PNG_cHRM;
#endif
#if defined(PNG_READ_gAMA_SUPPORTED)
#ifdef PNG_READ_gAMA_SUPPORTED
PNG_gAMA;
#endif
#if defined(PNG_READ_hIST_SUPPORTED)
#ifdef PNG_READ_hIST_SUPPORTED
PNG_hIST;
#endif
#if defined(PNG_READ_iCCP_SUPPORTED)
#ifdef PNG_READ_iCCP_SUPPORTED
PNG_iCCP;
#endif
#if defined(PNG_READ_iTXt_SUPPORTED)
#ifdef PNG_READ_iTXt_SUPPORTED
PNG_iTXt;
#endif
#if defined(PNG_READ_oFFs_SUPPORTED)
#ifdef PNG_READ_oFFs_SUPPORTED
PNG_oFFs;
#endif
#if defined(PNG_READ_pCAL_SUPPORTED)
#ifdef PNG_READ_pCAL_SUPPORTED
PNG_pCAL;
#endif
#if defined(PNG_READ_pHYs_SUPPORTED)
#ifdef PNG_READ_pHYs_SUPPORTED
PNG_pHYs;
#endif
#if defined(PNG_READ_sBIT_SUPPORTED)
#ifdef PNG_READ_sBIT_SUPPORTED
PNG_sBIT;
#endif
#if defined(PNG_READ_sCAL_SUPPORTED)
#ifdef PNG_READ_sCAL_SUPPORTED
PNG_sCAL;
#endif
#if defined(PNG_READ_sRGB_SUPPORTED)
#ifdef PNG_READ_sRGB_SUPPORTED
PNG_sRGB;
#endif
#if defined(PNG_READ_sPLT_SUPPORTED)
#ifdef PNG_READ_sPLT_SUPPORTED
PNG_sPLT;
#endif
#if defined(PNG_READ_tEXt_SUPPORTED)
#ifdef PNG_READ_tEXt_SUPPORTED
PNG_tEXt;
#endif
#if defined(PNG_READ_tIME_SUPPORTED)
#ifdef PNG_READ_tIME_SUPPORTED
PNG_tIME;
#endif
#if defined(PNG_READ_tRNS_SUPPORTED)
#ifdef PNG_READ_tRNS_SUPPORTED
PNG_tRNS;
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
#ifdef PNG_READ_zTXt_SUPPORTED
PNG_zTXt;
#endif
/* First we make sure we have enough data for the 4 byte chunk name
@ -332,7 +332,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
return;
}
#if defined(PNG_READ_gAMA_SUPPORTED)
#ifdef PNG_READ_gAMA_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_gAMA, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -345,7 +345,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_sBIT_SUPPORTED)
#ifdef PNG_READ_sBIT_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_sBIT, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -358,7 +358,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_cHRM_SUPPORTED)
#ifdef PNG_READ_cHRM_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_cHRM, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -371,7 +371,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_sRGB_SUPPORTED)
#ifdef PNG_READ_sRGB_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_sRGB, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -384,7 +384,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_iCCP_SUPPORTED)
#ifdef PNG_READ_iCCP_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_iCCP, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -397,7 +397,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_sPLT_SUPPORTED)
#ifdef PNG_READ_sPLT_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_sPLT, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -410,7 +410,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_tRNS_SUPPORTED)
#ifdef PNG_READ_tRNS_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_tRNS, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -423,7 +423,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_bKGD_SUPPORTED)
#ifdef PNG_READ_bKGD_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_bKGD, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -436,7 +436,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_hIST_SUPPORTED)
#ifdef PNG_READ_hIST_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_hIST, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -449,7 +449,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_pHYs_SUPPORTED)
#ifdef PNG_READ_pHYs_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_pHYs, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -462,7 +462,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_oFFs_SUPPORTED)
#ifdef PNG_READ_oFFs_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_oFFs, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -475,7 +475,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_pCAL_SUPPORTED)
#ifdef PNG_READ_pCAL_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_pCAL, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -488,7 +488,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_sCAL_SUPPORTED)
#ifdef PNG_READ_sCAL_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_sCAL, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -501,7 +501,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_tIME_SUPPORTED)
#ifdef PNG_READ_tIME_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_tIME, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -514,7 +514,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_tEXt_SUPPORTED)
#ifdef PNG_READ_tEXt_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_tEXt, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -527,7 +527,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
#ifdef PNG_READ_zTXt_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_zTXt, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -540,7 +540,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_iTXt_SUPPORTED)
#ifdef PNG_READ_iTXt_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_iTXt, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@ -855,7 +855,7 @@ png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
if (!(png_ptr->zstream.avail_out))
{
if ((
#if defined(PNG_READ_INTERLACING_SUPPORTED)
#ifdef PNG_READ_INTERLACING_SUPPORTED
png_ptr->interlaced && png_ptr->pass > 6) ||
(!png_ptr->interlaced &&
#endif
@ -897,7 +897,7 @@ png_push_process_row(png_structp png_ptr)
if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA))
png_do_read_transformations(png_ptr);
#if defined(PNG_READ_INTERLACING_SUPPORTED)
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Blow up interlaced rows to full size */
if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
{
@ -1107,7 +1107,7 @@ png_read_push_finish_row(png_structp png_ptr)
if (png_ptr->row_number < png_ptr->num_rows)
return;
#if defined(PNG_READ_INTERLACING_SUPPORTED)
#ifdef PNG_READ_INTERLACING_SUPPORTED
if (png_ptr->interlaced)
{
png_ptr->row_number = 0;
@ -1148,7 +1148,7 @@ png_read_push_finish_row(png_structp png_ptr)
#endif /* PNG_READ_INTERLACING_SUPPORTED */
}
#if defined(PNG_READ_tEXt_SUPPORTED)
#ifdef PNG_READ_tEXt_SUPPORTED
void /* PRIVATE */
png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
length)
@ -1211,7 +1211,7 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
png_push_crc_finish(png_ptr);
#if defined(PNG_MAX_MALLOC_64K)
#ifdef PNG_MAX_MALLOC_64K
if (png_ptr->skip_length)
return;
#endif
@ -1246,7 +1246,7 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
#ifdef PNG_READ_zTXt_SUPPORTED
void /* PRIVATE */
png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
length)
@ -1447,7 +1447,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_iTXt_SUPPORTED)
#ifdef PNG_READ_iTXt_SUPPORTED
void /* PRIVATE */
png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
length)
@ -1514,7 +1514,7 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
png_push_crc_finish(png_ptr);
#if defined(PNG_MAX_MALLOC_64K)
#ifdef PNG_MAX_MALLOC_64K
if (png_ptr->skip_length)
return;
#endif
@ -1580,10 +1580,10 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
if (!(png_ptr->chunk_name[0] & 0x20))
{
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
PNG_HANDLE_CHUNK_ALWAYS
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
&& png_ptr->read_user_chunk_fn == NULL
#endif
)
@ -1593,7 +1593,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
info_ptr = info_ptr; /* To quiet some compiler warnings */
}
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
if (png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS)
{
#ifdef PNG_MAX_MALLOC_64K
@ -1622,7 +1622,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
}
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
if (png_ptr->read_user_chunk_fn != NULL)
{
/* Callback to user unknown chunk handler */

188
pngread.c
View File

@ -1,7 +1,7 @@
/* pngread.c - read a PNG file
*
* Last changed in libpng 1.4.0 [September 20, 2009]
* Last changed in libpng 1.4.0 [September 23, 2009]
* Copyright (c) 1998-2009 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.)
@ -15,7 +15,7 @@
*/
#include "png.h"
#if defined(PNG_READ_SUPPORTED)
#ifdef PNG_READ_SUPPORTED
#include "pngpriv.h"
@ -235,55 +235,55 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
PNG_IDAT;
PNG_IEND;
PNG_PLTE;
#if defined(PNG_READ_bKGD_SUPPORTED)
#ifdef PNG_READ_bKGD_SUPPORTED
PNG_bKGD;
#endif
#if defined(PNG_READ_cHRM_SUPPORTED)
#ifdef PNG_READ_cHRM_SUPPORTED
PNG_cHRM;
#endif
#if defined(PNG_READ_gAMA_SUPPORTED)
#ifdef PNG_READ_gAMA_SUPPORTED
PNG_gAMA;
#endif
#if defined(PNG_READ_hIST_SUPPORTED)
#ifdef PNG_READ_hIST_SUPPORTED
PNG_hIST;
#endif
#if defined(PNG_READ_iCCP_SUPPORTED)
#ifdef PNG_READ_iCCP_SUPPORTED
PNG_iCCP;
#endif
#if defined(PNG_READ_iTXt_SUPPORTED)
#ifdef PNG_READ_iTXt_SUPPORTED
PNG_iTXt;
#endif
#if defined(PNG_READ_oFFs_SUPPORTED)
#ifdef PNG_READ_oFFs_SUPPORTED
PNG_oFFs;
#endif
#if defined(PNG_READ_pCAL_SUPPORTED)
#ifdef PNG_READ_pCAL_SUPPORTED
PNG_pCAL;
#endif
#if defined(PNG_READ_pHYs_SUPPORTED)
#ifdef PNG_READ_pHYs_SUPPORTED
PNG_pHYs;
#endif
#if defined(PNG_READ_sBIT_SUPPORTED)
#ifdef PNG_READ_sBIT_SUPPORTED
PNG_sBIT;
#endif
#if defined(PNG_READ_sCAL_SUPPORTED)
#ifdef PNG_READ_sCAL_SUPPORTED
PNG_sCAL;
#endif
#if defined(PNG_READ_sPLT_SUPPORTED)
#ifdef PNG_READ_sPLT_SUPPORTED
PNG_sPLT;
#endif
#if defined(PNG_READ_sRGB_SUPPORTED)
#ifdef PNG_READ_sRGB_SUPPORTED
PNG_sRGB;
#endif
#if defined(PNG_READ_tEXt_SUPPORTED)
#ifdef PNG_READ_tEXt_SUPPORTED
PNG_tEXt;
#endif
#if defined(PNG_READ_tIME_SUPPORTED)
#ifdef PNG_READ_tIME_SUPPORTED
PNG_tIME;
#endif
#if defined(PNG_READ_tRNS_SUPPORTED)
#ifdef PNG_READ_tRNS_SUPPORTED
PNG_tRNS;
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
#ifdef PNG_READ_zTXt_SUPPORTED
PNG_zTXt;
#endif
png_uint_32 length = png_read_chunk_header(png_ptr);
@ -333,71 +333,71 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
png_ptr->mode |= PNG_HAVE_IDAT;
break;
}
#if defined(PNG_READ_bKGD_SUPPORTED)
#ifdef PNG_READ_bKGD_SUPPORTED
else if (!png_memcmp(chunk_name, png_bKGD, 4))
png_handle_bKGD(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_cHRM_SUPPORTED)
#ifdef PNG_READ_cHRM_SUPPORTED
else if (!png_memcmp(chunk_name, png_cHRM, 4))
png_handle_cHRM(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_gAMA_SUPPORTED)
#ifdef PNG_READ_gAMA_SUPPORTED
else if (!png_memcmp(chunk_name, png_gAMA, 4))
png_handle_gAMA(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_hIST_SUPPORTED)
#ifdef PNG_READ_hIST_SUPPORTED
else if (!png_memcmp(chunk_name, png_hIST, 4))
png_handle_hIST(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_oFFs_SUPPORTED)
#ifdef PNG_READ_oFFs_SUPPORTED
else if (!png_memcmp(chunk_name, png_oFFs, 4))
png_handle_oFFs(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_pCAL_SUPPORTED)
#ifdef PNG_READ_pCAL_SUPPORTED
else if (!png_memcmp(chunk_name, png_pCAL, 4))
png_handle_pCAL(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_sCAL_SUPPORTED)
#ifdef PNG_READ_sCAL_SUPPORTED
else if (!png_memcmp(chunk_name, png_sCAL, 4))
png_handle_sCAL(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_pHYs_SUPPORTED)
#ifdef PNG_READ_pHYs_SUPPORTED
else if (!png_memcmp(chunk_name, png_pHYs, 4))
png_handle_pHYs(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_sBIT_SUPPORTED)
#ifdef PNG_READ_sBIT_SUPPORTED
else if (!png_memcmp(chunk_name, png_sBIT, 4))
png_handle_sBIT(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_sRGB_SUPPORTED)
#ifdef PNG_READ_sRGB_SUPPORTED
else if (!png_memcmp(chunk_name, png_sRGB, 4))
png_handle_sRGB(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_iCCP_SUPPORTED)
#ifdef PNG_READ_iCCP_SUPPORTED
else if (!png_memcmp(chunk_name, png_iCCP, 4))
png_handle_iCCP(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_sPLT_SUPPORTED)
#ifdef PNG_READ_sPLT_SUPPORTED
else if (!png_memcmp(chunk_name, png_sPLT, 4))
png_handle_sPLT(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_tEXt_SUPPORTED)
#ifdef PNG_READ_tEXt_SUPPORTED
else if (!png_memcmp(chunk_name, png_tEXt, 4))
png_handle_tEXt(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_tIME_SUPPORTED)
#ifdef PNG_READ_tIME_SUPPORTED
else if (!png_memcmp(chunk_name, png_tIME, 4))
png_handle_tIME(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_tRNS_SUPPORTED)
#ifdef PNG_READ_tRNS_SUPPORTED
else if (!png_memcmp(chunk_name, png_tRNS, 4))
png_handle_tRNS(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
#ifdef PNG_READ_zTXt_SUPPORTED
else if (!png_memcmp(chunk_name, png_zTXt, 4))
png_handle_zTXt(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_iTXt_SUPPORTED)
#ifdef PNG_READ_iTXt_SUPPORTED
else if (!png_memcmp(chunk_name, png_iTXt, 4))
png_handle_iTXt(png_ptr, info_ptr, length);
#endif
@ -492,7 +492,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
#endif
}
#if defined(PNG_READ_INTERLACING_SUPPORTED)
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* If interlaced and we do not need a new row, combine row and return */
if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
{
@ -625,7 +625,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
png_memcpy(png_ptr->prev_row, png_ptr->row_buf, png_ptr->rowbytes + 1);
#if defined(PNG_MNG_FEATURES_SUPPORTED)
#ifdef PNG_MNG_FEATURES_SUPPORTED
if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
(png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING))
{
@ -638,7 +638,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA))
png_do_read_transformations(png_ptr);
#if defined(PNG_READ_INTERLACING_SUPPORTED)
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Blow up interlaced rows to full size */
if (png_ptr->interlaced &&
(png_ptr->transformations & PNG_INTERLACE))
@ -806,55 +806,55 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
PNG_IDAT;
PNG_IEND;
PNG_PLTE;
#if defined(PNG_READ_bKGD_SUPPORTED)
#ifdef PNG_READ_bKGD_SUPPORTED
PNG_bKGD;
#endif
#if defined(PNG_READ_cHRM_SUPPORTED)
#ifdef PNG_READ_cHRM_SUPPORTED
PNG_cHRM;
#endif
#if defined(PNG_READ_gAMA_SUPPORTED)
#ifdef PNG_READ_gAMA_SUPPORTED
PNG_gAMA;
#endif
#if defined(PNG_READ_hIST_SUPPORTED)
#ifdef PNG_READ_hIST_SUPPORTED
PNG_hIST;
#endif
#if defined(PNG_READ_iCCP_SUPPORTED)
#ifdef PNG_READ_iCCP_SUPPORTED
PNG_iCCP;
#endif
#if defined(PNG_READ_iTXt_SUPPORTED)
#ifdef PNG_READ_iTXt_SUPPORTED
PNG_iTXt;
#endif
#if defined(PNG_READ_oFFs_SUPPORTED)
#ifdef PNG_READ_oFFs_SUPPORTED
PNG_oFFs;
#endif
#if defined(PNG_READ_pCAL_SUPPORTED)
#ifdef PNG_READ_pCAL_SUPPORTED
PNG_pCAL;
#endif
#if defined(PNG_READ_pHYs_SUPPORTED)
#ifdef PNG_READ_pHYs_SUPPORTED
PNG_pHYs;
#endif
#if defined(PNG_READ_sBIT_SUPPORTED)
#ifdef PNG_READ_sBIT_SUPPORTED
PNG_sBIT;
#endif
#if defined(PNG_READ_sCAL_SUPPORTED)
#ifdef PNG_READ_sCAL_SUPPORTED
PNG_sCAL;
#endif
#if defined(PNG_READ_sPLT_SUPPORTED)
#ifdef PNG_READ_sPLT_SUPPORTED
PNG_sPLT;
#endif
#if defined(PNG_READ_sRGB_SUPPORTED)
#ifdef PNG_READ_sRGB_SUPPORTED
PNG_sRGB;
#endif
#if defined(PNG_READ_tEXt_SUPPORTED)
#ifdef PNG_READ_tEXt_SUPPORTED
PNG_tEXt;
#endif
#if defined(PNG_READ_tIME_SUPPORTED)
#ifdef PNG_READ_tIME_SUPPORTED
PNG_tIME;
#endif
#if defined(PNG_READ_tRNS_SUPPORTED)
#ifdef PNG_READ_tRNS_SUPPORTED
PNG_tRNS;
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
#ifdef PNG_READ_zTXt_SUPPORTED
PNG_zTXt;
#endif
png_uint_32 length = png_read_chunk_header(png_ptr);
@ -888,71 +888,71 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
}
else if (!png_memcmp(chunk_name, png_PLTE, 4))
png_handle_PLTE(png_ptr, info_ptr, length);
#if defined(PNG_READ_bKGD_SUPPORTED)
#ifdef PNG_READ_bKGD_SUPPORTED
else if (!png_memcmp(chunk_name, png_bKGD, 4))
png_handle_bKGD(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_cHRM_SUPPORTED)
#ifdef PNG_READ_cHRM_SUPPORTED
else if (!png_memcmp(chunk_name, png_cHRM, 4))
png_handle_cHRM(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_gAMA_SUPPORTED)
#ifdef PNG_READ_gAMA_SUPPORTED
else if (!png_memcmp(chunk_name, png_gAMA, 4))
png_handle_gAMA(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_hIST_SUPPORTED)
#ifdef PNG_READ_hIST_SUPPORTED
else if (!png_memcmp(chunk_name, png_hIST, 4))
png_handle_hIST(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_oFFs_SUPPORTED)
#ifdef PNG_READ_oFFs_SUPPORTED
else if (!png_memcmp(chunk_name, png_oFFs, 4))
png_handle_oFFs(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_pCAL_SUPPORTED)
#ifdef PNG_READ_pCAL_SUPPORTED
else if (!png_memcmp(chunk_name, png_pCAL, 4))
png_handle_pCAL(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_sCAL_SUPPORTED)
#ifdef PNG_READ_sCAL_SUPPORTED
else if (!png_memcmp(chunk_name, png_sCAL, 4))
png_handle_sCAL(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_pHYs_SUPPORTED)
#ifdef PNG_READ_pHYs_SUPPORTED
else if (!png_memcmp(chunk_name, png_pHYs, 4))
png_handle_pHYs(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_sBIT_SUPPORTED)
#ifdef PNG_READ_sBIT_SUPPORTED
else if (!png_memcmp(chunk_name, png_sBIT, 4))
png_handle_sBIT(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_sRGB_SUPPORTED)
#ifdef PNG_READ_sRGB_SUPPORTED
else if (!png_memcmp(chunk_name, png_sRGB, 4))
png_handle_sRGB(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_iCCP_SUPPORTED)
#ifdef PNG_READ_iCCP_SUPPORTED
else if (!png_memcmp(chunk_name, png_iCCP, 4))
png_handle_iCCP(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_sPLT_SUPPORTED)
#ifdef PNG_READ_sPLT_SUPPORTED
else if (!png_memcmp(chunk_name, png_sPLT, 4))
png_handle_sPLT(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_tEXt_SUPPORTED)
#ifdef PNG_READ_tEXt_SUPPORTED
else if (!png_memcmp(chunk_name, png_tEXt, 4))
png_handle_tEXt(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_tIME_SUPPORTED)
#ifdef PNG_READ_tIME_SUPPORTED
else if (!png_memcmp(chunk_name, png_tIME, 4))
png_handle_tIME(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_tRNS_SUPPORTED)
#ifdef PNG_READ_tRNS_SUPPORTED
else if (!png_memcmp(chunk_name, png_tRNS, 4))
png_handle_tRNS(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
#ifdef PNG_READ_zTXt_SUPPORTED
else if (!png_memcmp(chunk_name, png_zTXt, 4))
png_handle_zTXt(png_ptr, info_ptr, length);
#endif
#if defined(PNG_READ_iTXt_SUPPORTED)
#ifdef PNG_READ_iTXt_SUPPORTED
else if (!png_memcmp(chunk_name, png_iTXt, 4))
png_handle_iTXt(png_ptr, info_ptr, length);
#endif
@ -996,7 +996,7 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
if (info_ptr != NULL)
{
#if defined(PNG_TEXT_SUPPORTED)
#ifdef PNG_TEXT_SUPPORTED
png_free_data(png_ptr, info_ptr, PNG_FREE_TEXT, -1);
#endif
@ -1011,7 +1011,7 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
if (end_info_ptr != NULL)
{
#if defined(PNG_READ_TEXT_SUPPORTED)
#ifdef PNG_READ_TEXT_SUPPORTED
png_free_data(png_ptr, end_info_ptr, PNG_FREE_TEXT, -1);
#endif
#ifdef PNG_USER_MEM_SUPPORTED
@ -1061,14 +1061,14 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
png_free(png_ptr, png_ptr->big_row_buf);
png_free(png_ptr, png_ptr->prev_row);
png_free(png_ptr, png_ptr->chunkdata);
#if defined(PNG_READ_DITHER_SUPPORTED)
#ifdef PNG_READ_DITHER_SUPPORTED
png_free(png_ptr, png_ptr->palette_lookup);
png_free(png_ptr, png_ptr->dither_index);
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
png_free(png_ptr, png_ptr->gamma_table);
#endif
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
#ifdef PNG_READ_BACKGROUND_SUPPORTED
png_free(png_ptr, png_ptr->gamma_from_1);
png_free(png_ptr, png_ptr->gamma_to_1);
#endif
@ -1081,12 +1081,12 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
png_free(png_ptr, png_ptr->trans_alpha);
png_ptr->free_me &= ~PNG_FREE_TRNS;
#endif
#if defined(PNG_READ_hIST_SUPPORTED)
#ifdef PNG_READ_hIST_SUPPORTED
if (png_ptr->free_me & PNG_FREE_HIST)
png_free(png_ptr, png_ptr->hist);
png_ptr->free_me &= ~PNG_FREE_HIST;
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
if (png_ptr->gamma_16_table != NULL)
{
int i;
@ -1097,7 +1097,7 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
}
png_free(png_ptr, png_ptr->gamma_16_table);
}
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
#ifdef PNG_READ_BACKGROUND_SUPPORTED
if (png_ptr->gamma_16_from_1 != NULL)
{
int i;
@ -1120,7 +1120,7 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
}
#endif
#endif
#if defined(PNG_TIME_RFC1123_SUPPORTED)
#ifdef PNG_TIME_RFC1123_SUPPORTED
png_free(png_ptr, png_ptr->time_buffer);
#endif
@ -1174,7 +1174,7 @@ png_set_read_status_fn(png_structp png_ptr, png_read_status_ptr read_row_fn)
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
#if defined(PNG_INFO_IMAGE_SUPPORTED)
#ifdef PNG_INFO_IMAGE_SUPPORTED
void PNGAPI
png_read_png(png_structp png_ptr, png_infop info_ptr,
int transforms,
@ -1194,14 +1194,14 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
/* -------------- image transformations start here ------------------- */
#if defined(PNG_READ_16_TO_8_SUPPORTED)
#ifdef PNG_READ_16_TO_8_SUPPORTED
/* Tell libpng to strip 16 bit/color files down to 8 bits per color.
*/
if (transforms & PNG_TRANSFORM_STRIP_16)
png_set_strip_16(png_ptr);
#endif
#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
/* Strip alpha bytes from the input data without combining with
* the background (not recommended).
*/
@ -1217,7 +1217,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
png_set_packing(png_ptr);
#endif
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
#ifdef PNG_READ_PACKSWAP_SUPPORTED
/* Change the order of packed pixels to least significant bit first
* (not useful if you are using png_set_packing).
*/
@ -1225,7 +1225,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
png_set_packswap(png_ptr);
#endif
#if defined(PNG_READ_EXPAND_SUPPORTED)
#ifdef PNG_READ_EXPAND_SUPPORTED
/* Expand paletted colors into true RGB triplets
* Expand grayscale images to full 8 bits from 1, 2, or 4 bits/pixel
* Expand paletted or RGB images with transparency to full alpha
@ -1241,14 +1241,14 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
/* We don't handle background color or gamma transformation or dithering.
*/
#if defined(PNG_READ_INVERT_SUPPORTED)
#ifdef PNG_READ_INVERT_SUPPORTED
/* Invert monochrome files to have 0 as white and 1 as black
*/
if (transforms & PNG_TRANSFORM_INVERT_MONO)
png_set_invert_mono(png_ptr);
#endif
#if defined(PNG_READ_SHIFT_SUPPORTED)
#ifdef PNG_READ_SHIFT_SUPPORTED
/* If you want to shift the pixel values from the range [0,255] or
* [0,65535] to the original [0,7] or [0,31], or whatever range the
* colors were originally in:
@ -1263,35 +1263,35 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
}
#endif
#if defined(PNG_READ_BGR_SUPPORTED)
#ifdef PNG_READ_BGR_SUPPORTED
/* Flip the RGB pixels to BGR (or RGBA to BGRA)
*/
if (transforms & PNG_TRANSFORM_BGR)
png_set_bgr(png_ptr);
#endif
#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED)
#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
/* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR)
*/
if (transforms & PNG_TRANSFORM_SWAP_ALPHA)
png_set_swap_alpha(png_ptr);
#endif
#if defined(PNG_READ_SWAP_SUPPORTED)
#ifdef PNG_READ_SWAP_SUPPORTED
/* Swap bytes of 16 bit files to least significant byte first
*/
if (transforms & PNG_TRANSFORM_SWAP_ENDIAN)
png_set_swap(png_ptr);
#endif
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
/* Invert the alpha channel from opacity to transparency
*/
if (transforms & PNG_TRANSFORM_INVERT_ALPHA)
png_set_invert_alpha(png_ptr);
#endif
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
/* Expand grayscale image to RGB
*/
if (transforms & PNG_TRANSFORM_GRAY_TO_RGB)

View File

@ -1,7 +1,7 @@
/* pngrio.c - functions for data input
*
* Last changed in libpng 1.4.0 [September 17, 2009]
* Last changed in libpng 1.4.0 [September 23, 2009]
* Copyright (c) 1998-2009 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.)
@ -19,7 +19,7 @@
*/
#include "png.h"
#if defined(PNG_READ_SUPPORTED)
#ifdef PNG_READ_SUPPORTED
#include "pngpriv.h"
/* Read the data from whatever input you are using. The default routine
@ -155,7 +155,7 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
"same structure. Resetting write_data_fn to NULL");
}
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
#ifdef PNG_WRITE_FLUSH_SUPPORTED
png_ptr->output_flush_fn = NULL;
#endif
}

View File

@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
* Last changed in libpng 1.4.0 [September 20, 2009]
* Last changed in libpng 1.4.0 [September 23, 2009]
* Copyright (c) 1998-2009 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.)
@ -17,7 +17,7 @@
*/
#include "png.h"
#if defined(PNG_READ_SUPPORTED)
#ifdef PNG_READ_SUPPORTED
#include "pngpriv.h"
/* Set the action on getting a CRC error for an ancillary or critical chunk. */
@ -115,7 +115,7 @@ png_set_background(png_structp png_ptr,
}
#endif
#if defined(PNG_READ_16_TO_8_SUPPORTED)
#ifdef PNG_READ_16_TO_8_SUPPORTED
/* Strip 16 bit depth files to 8 bit depth */
void PNGAPI
png_set_strip_16(png_structp png_ptr)
@ -128,7 +128,7 @@ png_set_strip_16(png_structp png_ptr)
}
#endif
#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
void PNGAPI
png_set_strip_alpha(png_structp png_ptr)
{
@ -140,7 +140,7 @@ png_set_strip_alpha(png_structp png_ptr)
}
#endif
#if defined(PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED)
#ifdef PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
void PNGAPI
png_set_premultiply_alpha(png_structp png_ptr)
{
@ -156,7 +156,7 @@ png_set_premultiply_alpha(png_structp png_ptr)
}
#endif
#if defined(PNG_READ_DITHER_SUPPORTED)
#ifdef PNG_READ_DITHER_SUPPORTED
/* Dither file to 8 bit. Supply a palette, the current number
* of elements in the palette, the maximum number of elements
* allowed, and a histogram if possible. If the current number
@ -577,7 +577,7 @@ png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma)
}
#endif
#if defined(PNG_READ_EXPAND_SUPPORTED)
#ifdef PNG_READ_EXPAND_SUPPORTED
/* Expand paletted images to RGB, expand grayscale images of
* less than 8-bit depth to 8-bit depth, and expand tRNS chunks
* to alpha channels.
@ -650,7 +650,7 @@ png_set_tRNS_to_alpha(png_structp png_ptr)
}
#endif /* defined(PNG_READ_EXPAND_SUPPORTED) */
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
void PNGAPI
png_set_gray_to_rgb(png_structp png_ptr)
{
@ -661,8 +661,8 @@ png_set_gray_to_rgb(png_structp png_ptr)
}
#endif
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
#if defined(PNG_FLOATING_POINT_SUPPORTED)
#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.
*/
@ -699,7 +699,7 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
case 3: png_ptr->transformations |= PNG_RGB_TO_GRAY_ERR;
}
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
#if defined(PNG_READ_EXPAND_SUPPORTED)
#ifdef PNG_READ_EXPAND_SUPPORTED
png_ptr->transformations |= PNG_EXPAND;
#else
{
@ -745,7 +745,7 @@ png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
if (png_ptr == NULL)
return;
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
png_ptr->transformations |= PNG_USER_TRANSFORM;
png_ptr->read_user_transform_fn = read_user_transform_fn;
#endif
@ -768,7 +768,7 @@ png_init_read_transformations(png_structp png_ptr)
#if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED)
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
/* Detect gray background and attempt to enable optimization
* for gray --> RGB case
*
@ -855,10 +855,10 @@ png_init_read_transformations(png_structp png_ptr)
png_ptr->background.blue =
png_ptr->palette[png_ptr->background.index].blue;
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
if (png_ptr->transformations & PNG_INVERT_ALPHA)
{
#if defined(PNG_READ_EXPAND_SUPPORTED)
#ifdef PNG_READ_EXPAND_SUPPORTED
if (!(png_ptr->transformations & PNG_EXPAND_tRNS))
#endif
{
@ -901,7 +901,7 @@ png_init_read_transformations(png_structp png_ptr)
png_ptr->gamma != 0.0)
{
png_build_gamma_table(png_ptr);
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
#ifdef PNG_READ_BACKGROUND_SUPPORTED
if (png_ptr->transformations & PNG_BACKGROUND)
{
if (color_type == PNG_COLOR_TYPE_PALETTE)
@ -1091,11 +1091,11 @@ png_init_read_transformations(png_structp png_ptr)
png_ptr->transformations &= ~PNG_GAMMA;
}
}
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
#ifdef PNG_READ_BACKGROUND_SUPPORTED
else
#endif
#endif /* PNG_READ_GAMMA_SUPPORTED && PNG_FLOATING_POINT_SUPPORTED */
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
#ifdef PNG_READ_BACKGROUND_SUPPORTED
/* No GAMMA transformation */
if ((png_ptr->transformations & PNG_BACKGROUND) &&
(color_type == PNG_COLOR_TYPE_PALETTE))
@ -1133,7 +1133,7 @@ png_init_read_transformations(png_structp png_ptr)
}
#endif /* PNG_READ_BACKGROUND_SUPPORTED */
#if defined(PNG_READ_SHIFT_SUPPORTED)
#ifdef PNG_READ_SHIFT_SUPPORTED
if ((png_ptr->transformations & PNG_SHIFT) &&
(color_type == PNG_COLOR_TYPE_PALETTE))
{
@ -1174,7 +1174,7 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
{
png_debug(1, "in png_read_transform_info");
#if defined(PNG_READ_EXPAND_SUPPORTED)
#ifdef PNG_READ_EXPAND_SUPPORTED
if (png_ptr->transformations & PNG_EXPAND)
{
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
@ -1201,7 +1201,7 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
#ifdef PNG_READ_BACKGROUND_SUPPORTED
if (png_ptr->transformations & PNG_BACKGROUND)
{
info_ptr->color_type &= ~PNG_COLOR_MASK_ALPHA;
@ -1210,7 +1210,7 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
if (png_ptr->transformations & PNG_GAMMA)
{
#ifdef PNG_FLOATING_POINT_SUPPORTED
@ -1222,22 +1222,22 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_16_TO_8_SUPPORTED)
#ifdef PNG_READ_16_TO_8_SUPPORTED
if ((png_ptr->transformations & PNG_16_TO_8) && (info_ptr->bit_depth == 16))
info_ptr->bit_depth = 8;
#endif
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
if (png_ptr->transformations & PNG_GRAY_TO_RGB)
info_ptr->color_type |= PNG_COLOR_MASK_COLOR;
#endif
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
if (png_ptr->transformations & PNG_RGB_TO_GRAY)
info_ptr->color_type &= ~PNG_COLOR_MASK_COLOR;
#endif
#if defined(PNG_READ_DITHER_SUPPORTED)
#ifdef PNG_READ_DITHER_SUPPORTED
if (png_ptr->transformations & PNG_DITHER)
{
if (((info_ptr->color_type == PNG_COLOR_TYPE_RGB) ||
@ -1249,7 +1249,7 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
}
#endif
#if defined(PNG_READ_PACK_SUPPORTED)
#ifdef PNG_READ_PACK_SUPPORTED
if ((png_ptr->transformations & PNG_PACK) && (info_ptr->bit_depth < 8))
info_ptr->bit_depth = 8;
#endif
@ -1261,7 +1261,7 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
else
info_ptr->channels = 1;
#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
if (png_ptr->flags & PNG_FLAG_STRIP_ALPHA)
info_ptr->color_type &= ~PNG_COLOR_MASK_ALPHA;
#endif
@ -1269,7 +1269,7 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
info_ptr->channels++;
#if defined(PNG_READ_FILLER_SUPPORTED)
#ifdef PNG_READ_FILLER_SUPPORTED
/* STRIP_ALPHA and FILLER allowed: MASK_ALPHA bit stripped above */
if ((png_ptr->transformations & PNG_FILLER) &&
((info_ptr->color_type == PNG_COLOR_TYPE_RGB) ||
@ -1339,7 +1339,7 @@ png_do_read_transformations(png_structp png_ptr)
#endif
#endif
#if defined(PNG_READ_EXPAND_SUPPORTED)
#ifdef PNG_READ_EXPAND_SUPPORTED
if (png_ptr->transformations & PNG_EXPAND)
{
if (png_ptr->row_info.color_type == PNG_COLOR_TYPE_PALETTE)
@ -1360,13 +1360,13 @@ png_do_read_transformations(png_structp png_ptr)
}
#endif
#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
if (png_ptr->flags & PNG_FLAG_STRIP_ALPHA)
png_do_strip_filler(&(png_ptr->row_info), png_ptr->row_buf + 1,
PNG_FLAG_FILLER_AFTER | (png_ptr->flags & PNG_FLAG_STRIP_ALPHA));
#endif
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
if (png_ptr->transformations & PNG_RGB_TO_GRAY)
{
int rgb_error =
@ -1415,7 +1415,7 @@ png_do_read_transformations(png_structp png_ptr)
* transform appropriately, then it would save a lot of work/time.
*/
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
/* If gray -> RGB, do so now only if background is non-gray; else do later
* for performance reasons
*/
@ -1424,18 +1424,18 @@ png_do_read_transformations(png_structp png_ptr)
png_do_gray_to_rgb(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
#if defined(PNG_READ_16_TO_8_SUPPORTED)
#ifdef PNG_READ_16_TO_8_SUPPORTED
if (png_ptr->transformations & PNG_16_TO_8)
png_do_chop(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
#ifdef PNG_READ_BACKGROUND_SUPPORTED
if ((png_ptr->transformations & PNG_BACKGROUND) &&
((png_ptr->num_trans != 0 ) ||
(png_ptr->color_type & PNG_COLOR_MASK_ALPHA)))
png_do_background(&(png_ptr->row_info), png_ptr->row_buf + 1,
&(png_ptr->trans_color), &(png_ptr->background)
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
, &(png_ptr->background_1),
png_ptr->gamma_table, png_ptr->gamma_from_1,
png_ptr->gamma_to_1, png_ptr->gamma_16_table,
@ -1445,9 +1445,9 @@ png_do_read_transformations(png_structp png_ptr)
);
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
if ((png_ptr->transformations & PNG_GAMMA) &&
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
#ifdef PNG_READ_BACKGROUND_SUPPORTED
!((png_ptr->transformations & PNG_BACKGROUND) &&
((png_ptr->num_trans != 0) ||
(png_ptr->color_type & PNG_COLOR_MASK_ALPHA))) &&
@ -1458,7 +1458,7 @@ png_do_read_transformations(png_structp png_ptr)
png_ptr->gamma_shift);
#endif
#if defined(PNG_READ_DITHER_SUPPORTED)
#ifdef PNG_READ_DITHER_SUPPORTED
if (png_ptr->transformations & PNG_DITHER)
{
png_do_dither((png_row_infop)&(png_ptr->row_info), png_ptr->row_buf + 1,
@ -1468,67 +1468,67 @@ png_do_read_transformations(png_structp png_ptr)
}
#endif
#if defined(PNG_READ_INVERT_SUPPORTED)
#ifdef PNG_READ_INVERT_SUPPORTED
if (png_ptr->transformations & PNG_INVERT_MONO)
png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
#if defined(PNG_READ_SHIFT_SUPPORTED)
#ifdef PNG_READ_SHIFT_SUPPORTED
if (png_ptr->transformations & PNG_SHIFT)
png_do_unshift(&(png_ptr->row_info), png_ptr->row_buf + 1,
&(png_ptr->shift));
#endif
#if defined(PNG_READ_PACK_SUPPORTED)
#ifdef PNG_READ_PACK_SUPPORTED
if (png_ptr->transformations & PNG_PACK)
png_do_unpack(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
#if defined(PNG_READ_BGR_SUPPORTED)
#ifdef PNG_READ_BGR_SUPPORTED
if (png_ptr->transformations & PNG_BGR)
png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
#ifdef PNG_READ_PACKSWAP_SUPPORTED
if (png_ptr->transformations & PNG_PACKSWAP)
png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
/* If gray -> RGB, do so now only if we did not do so above */
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);
#endif
#if defined(PNG_READ_FILLER_SUPPORTED)
#ifdef PNG_READ_FILLER_SUPPORTED
if (png_ptr->transformations & PNG_FILLER)
png_do_read_filler(&(png_ptr->row_info), png_ptr->row_buf + 1,
(png_uint_32)png_ptr->filler, png_ptr->flags);
#endif
#if defined(PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED)
#ifdef PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
if (png_ptr->transformations & PNG_PREMULTIPLY_ALPHA)
png_do_read_premultiply_alpha(&(png_ptr->row_info),
png_ptr->row_buf + 1);
#endif
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
if (png_ptr->transformations & PNG_INVERT_ALPHA)
png_do_read_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED)
#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
if (png_ptr->transformations & PNG_SWAP_ALPHA)
png_do_read_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
#if defined(PNG_READ_SWAP_SUPPORTED)
#ifdef PNG_READ_SWAP_SUPPORTED
if (png_ptr->transformations & PNG_SWAP_BYTES)
png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
if (png_ptr->transformations & PNG_USER_TRANSFORM)
{
if (png_ptr->read_user_transform_fn != NULL)
@ -1542,7 +1542,7 @@ png_do_read_transformations(png_structp png_ptr)
/* png_byte channels; number of channels (1-4) */
/* png_byte pixel_depth; bits per pixel (depth*channels) */
png_ptr->row_buf + 1); /* start of pixel data for row */
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
if (png_ptr->user_transform_depth)
png_ptr->row_info.bit_depth = png_ptr->user_transform_depth;
if (png_ptr->user_transform_channels)
@ -1557,7 +1557,7 @@ png_do_read_transformations(png_structp png_ptr)
}
#if defined(PNG_READ_PACK_SUPPORTED)
#ifdef PNG_READ_PACK_SUPPORTED
/* Unpack pixels of 1, 2, or 4 bits per pixel into 1 byte per pixel,
* without changing the actual values. Thus, if you had a row with
* a bit depth of 1, you would end up with bytes that only contained
@ -1647,7 +1647,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
}
#endif
#if defined(PNG_READ_SHIFT_SUPPORTED)
#ifdef PNG_READ_SHIFT_SUPPORTED
/* Reverse the effects of png_do_shift. This routine merely shifts the
* pixels back to their significant bits values. Thus, if you have
* a row of bit depth 8, but only 5 are significant, this will shift
@ -1758,7 +1758,7 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
}
#endif
#if defined(PNG_READ_16_TO_8_SUPPORTED)
#ifdef PNG_READ_16_TO_8_SUPPORTED
/* Chop rows of bit depth 16 down to 8 */
void /* PRIVATE */
png_do_chop(png_row_infop row_info, png_bytep row)
@ -1774,7 +1774,7 @@ png_do_chop(png_row_infop row_info, png_bytep row)
for (i = 0; i<istop; i++, sp += 2, dp++)
{
#if defined(PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED)
#ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
/* This does a more accurate scaling of the 16-bit color
* value, rather than a simple low-byte truncation.
*
@ -1813,7 +1813,7 @@ png_do_chop(png_row_infop row_info, png_bytep row)
}
#endif
#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED)
#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
void /* PRIVATE */
png_do_read_swap_alpha(png_row_infop row_info, png_bytep row)
{
@ -1903,7 +1903,7 @@ png_do_read_swap_alpha(png_row_infop row_info, png_bytep row)
}
#endif
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
void /* PRIVATE */
png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
{
@ -1999,7 +1999,7 @@ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
}
#endif
#if defined(PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED)
#ifdef PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
void /* PRIVATE */
png_do_read_premultiply_alpha(png_row_infop row_info, png_bytep row)
{
@ -2078,7 +2078,7 @@ png_do_read_premultiply_alpha(png_row_infop row_info, png_bytep row)
}
#endif
#if defined(PNG_READ_FILLER_SUPPORTED)
#ifdef PNG_READ_FILLER_SUPPORTED
/* Add filler channel if we have RGB color */
void /* PRIVATE */
png_do_read_filler(png_row_infop row_info, png_bytep row,
@ -2252,7 +2252,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
}
#endif
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
/* Expand grayscale files to RGB, with or without alpha */
void /* PRIVATE */
png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
@ -2333,7 +2333,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
}
#endif
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
/* Reduce RGB files to grayscale, with or without alpha
* using the equation given in Poynton's ColorFAQ at
* <http://www.inforamp.net/~poynton/> (THIS LINK IS DEAD June 2008)
@ -2642,7 +2642,7 @@ png_build_grayscale_palette(int bit_depth, png_colorp palette)
}
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
#ifdef PNG_READ_BACKGROUND_SUPPORTED
/* Replace any alpha or transparency with the supplied background color.
* "background" is already in the screen gamma, while "background_1" is
* at a gamma of 1.0. Paletted files have already been taken care of.
@ -2650,7 +2650,7 @@ png_build_grayscale_palette(int bit_depth, png_colorp palette)
void /* PRIVATE */
png_do_background(png_row_infop row_info, png_bytep row,
png_color_16p trans_color, png_color_16p background
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
, png_color_16p background_1,
png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
@ -2700,7 +2700,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
case 2:
{
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
if (gamma_table != NULL)
{
sp = row;
@ -2757,7 +2757,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
case 4:
{
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
if (gamma_table != NULL)
{
sp = row;
@ -2814,7 +2814,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
case 8:
{
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
if (gamma_table != NULL)
{
sp = row;
@ -2847,7 +2847,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
case 16:
{
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
if (gamma_16 != NULL)
{
sp = row;
@ -2896,7 +2896,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
{
if (row_info->bit_depth == 8)
{
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
if (gamma_table != NULL)
{
sp = row;
@ -2937,7 +2937,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
}
else /* if (row_info->bit_depth == 16) */
{
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
if (gamma_16 != NULL)
{
sp = row;
@ -3001,7 +3001,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
{
if (row_info->bit_depth == 8)
{
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
if (gamma_to_1 != NULL && gamma_from_1 != NULL &&
gamma_table != NULL)
{
@ -3043,7 +3043,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
{
*dp = *sp;
}
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
else if (a == 0)
{
*dp = (png_byte)background->gray;
@ -3060,7 +3060,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
}
else /* if (png_ptr->bit_depth == 16) */
{
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
if (gamma_16 != NULL && gamma_16_from_1 != NULL &&
gamma_16_to_1 != NULL)
{
@ -3078,7 +3078,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
*dp = (png_byte)((v >> 8) & 0xff);
*(dp + 1) = (png_byte)(v & 0xff);
}
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
else if (a == 0)
#else
else
@ -3088,7 +3088,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
*dp = (png_byte)((background->gray >> 8) & 0xff);
*(dp + 1) = (png_byte)(background->gray & 0xff);
}
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
else
{
png_uint_16 g, v, w;
@ -3114,7 +3114,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
{
png_memcpy(dp, sp, 2);
}
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
else if (a == 0)
#else
else
@ -3123,7 +3123,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
*dp = (png_byte)((background->gray >> 8) & 0xff);
*(dp + 1) = (png_byte)(background->gray & 0xff);
}
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
else
{
png_uint_16 g, v;
@ -3144,7 +3144,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
{
if (row_info->bit_depth == 8)
{
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
if (gamma_to_1 != NULL && gamma_from_1 != NULL &&
gamma_table != NULL)
{
@ -3217,7 +3217,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
}
else /* if (row_info->bit_depth == 16) */
{
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
if (gamma_16 != NULL && gamma_16_from_1 != NULL &&
gamma_16_to_1 != NULL)
{
@ -3334,7 +3334,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
}
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
/* Gamma correct the image, avoiding the alpha channel. Make sure
* you do this after you deal with the transparency issue on grayscale
* or RGB images. If your bit depth is 8, use gamma_table, if it
@ -3523,7 +3523,7 @@ png_do_gamma(png_row_infop row_info, png_bytep row,
}
#endif
#if defined(PNG_READ_EXPAND_SUPPORTED)
#ifdef PNG_READ_EXPAND_SUPPORTED
/* Expands a palette row to an RGB or RGBA row depending
* upon whether you supply trans and num_trans.
*/
@ -3880,7 +3880,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
}
#endif
#if defined(PNG_READ_DITHER_SUPPORTED)
#ifdef PNG_READ_DITHER_SUPPORTED
void /* PRIVATE */
png_do_dither(png_row_infop row_info, png_bytep row,
png_bytep palette_lookup, png_bytep dither_lookup)
@ -3970,7 +3970,7 @@ png_do_dither(png_row_infop row_info, png_bytep row,
#endif
#ifdef PNG_FLOATING_POINT_SUPPORTED
#if defined(PNG_READ_GAMMA_SUPPORTED)
#ifdef PNG_READ_GAMMA_SUPPORTED
static PNG_CONST int png_gamma_shift[] =
{0x10, 0x21, 0x42, 0x84, 0x110, 0x248, 0x550, 0xff0, 0x00};
@ -4228,7 +4228,7 @@ png_build_gamma_table(png_structp png_ptr)
/* To do: install integer version of png_build_gamma_table here */
#endif
#if defined(PNG_MNG_FEATURES_SUPPORTED)
#ifdef PNG_MNG_FEATURES_SUPPORTED
/* Undoes intrapixel differencing */
void /* PRIVATE */
png_do_read_intrapixel(png_row_infop row_info, png_bytep row)

View File

@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file
*
* Last changed in libpng 1.4.0 [September 17, 2009]
* Last changed in libpng 1.4.0 [September 23, 2009]
* Copyright (c) 1998-2009 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.)
@ -15,7 +15,7 @@
*/
#include "png.h"
#if defined(PNG_READ_SUPPORTED)
#ifdef PNG_READ_SUPPORTED
#include "pngpriv.h"
# define png_strtod(p,a,b) strtod(a,b)
@ -315,7 +315,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
}
if (ret != Z_STREAM_END)
{
#if defined(PNG_STDIO_SUPPORTED)
#ifdef PNG_STDIO_SUPPORTED
char umsg[52];
if (ret == Z_BUF_ERROR)
@ -362,7 +362,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
}
else /* if (comp_type != PNG_COMPRESSION_TYPE_BASE) */
{
#if defined(PNG_STDIO_SUPPORTED)
#ifdef PNG_STDIO_SUPPORTED
char umsg[50];
png_snprintf(umsg, 50, "Unknown zTXt compression type %d", comp_type);
@ -414,7 +414,7 @@ png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_ptr->bit_depth = (png_byte)bit_depth;
png_ptr->interlaced = (png_byte)interlace_type;
png_ptr->color_type = (png_byte)color_type;
#if defined(PNG_MNG_FEATURES_SUPPORTED)
#ifdef PNG_MNG_FEATURES_SUPPORTED
png_ptr->filter_type = (png_byte)filter_type;
#endif
png_ptr->compression_type = (png_byte)compression_type;
@ -573,7 +573,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_set_PLTE(png_ptr, info_ptr, palette, num);
#if defined(PNG_READ_tRNS_SUPPORTED)
#ifdef PNG_READ_tRNS_SUPPORTED
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
{
if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
@ -615,7 +615,7 @@ png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
info_ptr = info_ptr; /* Quiet compiler warnings about unused info_ptr */
}
#if defined(PNG_READ_gAMA_SUPPORTED)
#ifdef PNG_READ_gAMA_SUPPORTED
void /* PRIVATE */
png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@ -640,7 +640,7 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_warning(png_ptr, "Out of place gAMA chunk");
if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
#if defined(PNG_READ_sRGB_SUPPORTED)
#ifdef PNG_READ_sRGB_SUPPORTED
&& !(info_ptr->valid & PNG_INFO_sRGB)
#endif
)
@ -670,7 +670,7 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
return;
}
#if defined(PNG_READ_sRGB_SUPPORTED)
#ifdef PNG_READ_sRGB_SUPPORTED
if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB))
if (PNG_OUT_OF_RANGE(igamma, 45500L, 500))
{
@ -696,7 +696,7 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
#if defined(PNG_READ_sBIT_SUPPORTED)
#ifdef PNG_READ_sBIT_SUPPORTED
void /* PRIVATE */
png_handle_sBIT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@ -762,7 +762,7 @@ png_handle_sBIT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
#if defined(PNG_READ_cHRM_SUPPORTED)
#ifdef PNG_READ_cHRM_SUPPORTED
void /* PRIVATE */
png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@ -790,7 +790,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_warning(png_ptr, "Missing PLTE before cHRM");
if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)
#if defined(PNG_READ_sRGB_SUPPORTED)
#ifdef PNG_READ_sRGB_SUPPORTED
&& !(info_ptr->valid & PNG_INFO_sRGB)
#endif
)
@ -842,7 +842,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
blue_y = (float)int_y_blue / (float)100000.0;
#endif
#if defined(PNG_READ_sRGB_SUPPORTED)
#ifdef PNG_READ_sRGB_SUPPORTED
if ((info_ptr != NULL) && (info_ptr->valid & PNG_INFO_sRGB))
{
if (PNG_OUT_OF_RANGE(int_x_white, 31270, 1000) ||
@ -886,7 +886,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
#if defined(PNG_READ_sRGB_SUPPORTED)
#ifdef PNG_READ_sRGB_SUPPORTED
void /* PRIVATE */
png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@ -984,7 +984,7 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif /* PNG_READ_sRGB_SUPPORTED */
#if defined(PNG_READ_iCCP_SUPPORTED)
#ifdef PNG_READ_iCCP_SUPPORTED
void /* PRIVATE */
png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
/* Note: this does not properly handle chunks that are > 64K under DOS */
@ -1104,7 +1104,7 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif /* PNG_READ_iCCP_SUPPORTED */
#if defined(PNG_READ_sPLT_SUPPORTED)
#ifdef PNG_READ_sPLT_SUPPORTED
void /* PRIVATE */
png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
/* Note: this does not properly handle chunks that are > 64K under DOS */
@ -1266,7 +1266,7 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif /* PNG_READ_sPLT_SUPPORTED */
#if defined(PNG_READ_tRNS_SUPPORTED)
#ifdef PNG_READ_tRNS_SUPPORTED
void /* PRIVATE */
png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@ -1361,7 +1361,7 @@ png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
#if defined(PNG_READ_bKGD_SUPPORTED)
#ifdef PNG_READ_bKGD_SUPPORTED
void /* PRIVATE */
png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@ -1450,7 +1450,7 @@ png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
#if defined(PNG_READ_hIST_SUPPORTED)
#ifdef PNG_READ_hIST_SUPPORTED
void /* PRIVATE */
png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@ -1504,7 +1504,7 @@ png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
#if defined(PNG_READ_pHYs_SUPPORTED)
#ifdef PNG_READ_pHYs_SUPPORTED
void /* PRIVATE */
png_handle_pHYs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@ -1547,7 +1547,7 @@ png_handle_pHYs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
#if defined(PNG_READ_oFFs_SUPPORTED)
#ifdef PNG_READ_oFFs_SUPPORTED
void /* PRIVATE */
png_handle_oFFs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@ -1590,7 +1590,7 @@ png_handle_oFFs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
#if defined(PNG_READ_pCAL_SUPPORTED)
#ifdef PNG_READ_pCAL_SUPPORTED
/* Read the pCAL chunk (described in the PNG Extensions document) */
void /* PRIVATE */
png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
@ -1724,7 +1724,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
#if defined(PNG_READ_sCAL_SUPPORTED)
#ifdef PNG_READ_sCAL_SUPPORTED
/* Read the sCAL chunk */
void /* PRIVATE */
png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
@ -1867,7 +1867,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
#if defined(PNG_READ_tIME_SUPPORTED)
#ifdef PNG_READ_tIME_SUPPORTED
void /* PRIVATE */
png_handle_tIME(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@ -1910,7 +1910,7 @@ png_handle_tIME(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
#if defined(PNG_READ_tEXt_SUPPORTED)
#ifdef PNG_READ_tEXt_SUPPORTED
/* Note: this does not properly handle chunks that are > 64K under DOS */
void /* PRIVATE */
png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
@ -2013,7 +2013,7 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
#ifdef PNG_READ_zTXt_SUPPORTED
/* Note: this does not correctly handle chunks that are > 64K under DOS */
void /* PRIVATE */
png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
@ -2133,7 +2133,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
#if defined(PNG_READ_iTXt_SUPPORTED)
#ifdef PNG_READ_iTXt_SUPPORTED
/* Note: this does not correctly handle chunks that are > 64K under DOS */
void /* PRIVATE */
png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
@ -2310,17 +2310,17 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if (png_ptr->mode & PNG_HAVE_IDAT)
{
PNG_CONST PNG_IDAT;
PNG_IDAT;
if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) /* Not an IDAT */
png_ptr->mode |= PNG_AFTER_IDAT;
}
if (!(png_ptr->chunk_name[0] & 0x20))
{
#if defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
PNG_HANDLE_CHUNK_ALWAYS
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
&& png_ptr->read_user_chunk_fn == NULL
#endif
)
@ -2328,9 +2328,9 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_chunk_error(png_ptr, "unknown critical chunk");
}
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
if ((png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS)
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
|| (png_ptr->read_user_chunk_fn != NULL)
#endif
)
@ -2355,7 +2355,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length);
png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
}
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
if (png_ptr->read_user_chunk_fn != NULL)
{
/* Callback to user unknown chunk handler */
@ -2367,7 +2367,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if (ret == 0)
{
if (!(png_ptr->chunk_name[0] & 0x20))
#if defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
PNG_HANDLE_CHUNK_ALWAYS)
#endif
@ -2446,7 +2446,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
png_uint_32 i;
png_uint_32 row_width = png_ptr->width;
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
#ifdef PNG_READ_PACKSWAP_SUPPORTED
if (png_ptr->transformations & PNG_PACKSWAP)
{
s_start = 0;
@ -2501,7 +2501,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
png_uint_32 row_width = png_ptr->width;
int value;
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
#ifdef PNG_READ_PACKSWAP_SUPPORTED
if (png_ptr->transformations & PNG_PACKSWAP)
{
s_start = 0;
@ -2553,7 +2553,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
png_uint_32 row_width = png_ptr->width;
int value;
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
#ifdef PNG_READ_PACKSWAP_SUPPORTED
if (png_ptr->transformations & PNG_PACKSWAP)
{
s_start = 0;
@ -2660,7 +2660,7 @@ png_do_read_interlace(png_structp png_ptr)
png_uint_32 i;
int j;
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
#ifdef PNG_READ_PACKSWAP_SUPPORTED
if (transformations & PNG_PACKSWAP)
{
sshift = (int)((row_info->width + 7) & 0x07);
@ -2713,7 +2713,7 @@ png_do_read_interlace(png_structp png_ptr)
int jstop = png_pass_inc[pass];
png_uint_32 i;
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
#ifdef PNG_READ_PACKSWAP_SUPPORTED
if (transformations & PNG_PACKSWAP)
{
sshift = (int)(((row_info->width + 3) & 0x03) << 1);
@ -2769,7 +2769,7 @@ png_do_read_interlace(png_structp png_ptr)
png_uint_32 i;
int jstop = png_pass_inc[pass];
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
#ifdef PNG_READ_PACKSWAP_SUPPORTED
if (transformations & PNG_PACKSWAP)
{
sshift = (int)(((row_info->width + 1) & 0x01) << 2);
@ -3036,7 +3036,7 @@ png_read_finish_row(png_structp png_ptr)
if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED))
{
PNG_CONST PNG_IDAT;
PNG_IDAT;
char extra;
int ret;
@ -3153,12 +3153,12 @@ png_read_start_row(png_structp png_ptr)
}
max_pixel_depth = png_ptr->pixel_depth;
#if defined(PNG_READ_PACK_SUPPORTED)
#ifdef PNG_READ_PACK_SUPPORTED
if ((png_ptr->transformations & PNG_PACK) && png_ptr->bit_depth < 8)
max_pixel_depth = 8;
#endif
#if defined(PNG_READ_EXPAND_SUPPORTED)
#ifdef PNG_READ_EXPAND_SUPPORTED
if (png_ptr->transformations & PNG_EXPAND)
{
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
@ -3186,7 +3186,7 @@ png_read_start_row(png_structp png_ptr)
}
#endif
#if defined(PNG_READ_FILLER_SUPPORTED)
#ifdef PNG_READ_FILLER_SUPPORTED
if (png_ptr->transformations & (PNG_FILLER))
{
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
@ -3208,14 +3208,14 @@ png_read_start_row(png_structp png_ptr)
}
#endif
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
if (png_ptr->transformations & PNG_GRAY_TO_RGB)
{
if (
#if defined(PNG_READ_EXPAND_SUPPORTED)
#ifdef PNG_READ_EXPAND_SUPPORTED
(png_ptr->num_trans && (png_ptr->transformations & PNG_EXPAND)) ||
#endif
#if defined(PNG_READ_FILLER_SUPPORTED)
#ifdef PNG_READ_FILLER_SUPPORTED
(png_ptr->transformations & (PNG_FILLER)) ||
#endif
png_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)

View File

@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct
*
* Last changed in libpng 1.4.0 [September 17, 2009]
* Last changed in libpng 1.4.0 [September 23, 2009]
* Copyright (c) 1998-2009 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.)
@ -20,7 +20,7 @@
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#include "pngpriv.h"
#if defined(PNG_bKGD_SUPPORTED)
#ifdef PNG_bKGD_SUPPORTED
void PNGAPI
png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background)
{
@ -34,7 +34,7 @@ png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background)
}
#endif
#if defined(PNG_cHRM_SUPPORTED)
#ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
@ -80,7 +80,7 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
if (png_ptr == NULL || info_ptr == NULL)
return;
#if defined(PNG_CHECK_cHRM_SUPPORTED)
#ifdef PNG_CHECK_cHRM_SUPPORTED
if (png_check_cHRM_fixed(png_ptr,
white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y))
#endif
@ -109,7 +109,7 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
#endif /* PNG_FIXED_POINT_SUPPORTED */
#endif /* PNG_cHRM_SUPPORTED */
#if defined(PNG_gAMA_SUPPORTED)
#ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
@ -176,7 +176,7 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
}
#endif
#if defined(PNG_hIST_SUPPORTED)
#ifdef PNG_hIST_SUPPORTED
void PNGAPI
png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
{
@ -268,7 +268,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
if (compression_type != PNG_COMPRESSION_TYPE_BASE)
png_error(png_ptr, "Unknown compression method in IHDR");
#if defined(PNG_MNG_FEATURES_SUPPORTED)
#ifdef PNG_MNG_FEATURES_SUPPORTED
/* Accept filter_method 64 (intrapixel differencing) only if
* 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and
* 2. Libpng did not read a PNG signature (this filter_method is only
@ -325,7 +325,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
}
#if defined(PNG_oFFs_SUPPORTED)
#ifdef PNG_oFFs_SUPPORTED
void PNGAPI
png_set_oFFs(png_structp png_ptr, png_infop info_ptr,
png_int_32 offset_x, png_int_32 offset_y, int unit_type)
@ -342,7 +342,7 @@ png_set_oFFs(png_structp png_ptr, png_infop info_ptr,
}
#endif
#if defined(PNG_pCAL_SUPPORTED)
#ifdef PNG_pCAL_SUPPORTED
void PNGAPI
png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams,
@ -477,7 +477,7 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
#endif
#endif
#if defined(PNG_pHYs_SUPPORTED)
#ifdef PNG_pHYs_SUPPORTED
void PNGAPI
png_set_pHYs(png_structp png_ptr, png_infop info_ptr,
png_uint_32 res_x, png_uint_32 res_y, int unit_type)
@ -537,7 +537,7 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
info_ptr->valid |= PNG_INFO_PLTE;
}
#if defined(PNG_sBIT_SUPPORTED)
#ifdef PNG_sBIT_SUPPORTED
void PNGAPI
png_set_sBIT(png_structp png_ptr, png_infop info_ptr,
png_color_8p sig_bit)
@ -552,7 +552,7 @@ png_set_sBIT(png_structp png_ptr, png_infop info_ptr,
}
#endif
#if defined(PNG_sRGB_SUPPORTED)
#ifdef PNG_sRGB_SUPPORTED
void PNGAPI
png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int intent)
{
@ -569,7 +569,7 @@ void PNGAPI
png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
int intent)
{
#if defined(PNG_gAMA_SUPPORTED)
#ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
float file_gamma;
#endif
@ -577,7 +577,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
png_fixed_point int_file_gamma;
#endif
#endif
#if defined(PNG_cHRM_SUPPORTED)
#ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y;
#endif
@ -591,7 +591,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
png_set_sRGB(png_ptr, info_ptr, intent);
#if defined(PNG_gAMA_SUPPORTED)
#ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
file_gamma = (float).45455;
png_set_gAMA(png_ptr, info_ptr, file_gamma);
@ -602,7 +602,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
#endif
#endif
#if defined(PNG_cHRM_SUPPORTED)
#ifdef PNG_cHRM_SUPPORTED
int_white_x = 31270L;
int_white_y = 32900L;
int_red_x = 64000L;
@ -623,7 +623,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
blue_y = (float).06;
#endif
#if defined(PNG_CHECK_cHRM_SUPPORTED)
#ifdef PNG_CHECK_cHRM_SUPPORTED
if (png_check_cHRM_fixed(png_ptr,
int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
int_green_y, int_blue_x, int_blue_y))
@ -644,7 +644,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
#endif /* sRGB */
#if defined(PNG_iCCP_SUPPORTED)
#ifdef PNG_iCCP_SUPPORTED
void PNGAPI
png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
png_charp name, int compression_type,
@ -690,7 +690,7 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
}
#endif
#if defined(PNG_TEXT_SUPPORTED)
#ifdef PNG_TEXT_SUPPORTED
void PNGAPI
png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
int num_text)
@ -861,7 +861,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
}
#endif
#if defined(PNG_tIME_SUPPORTED)
#ifdef PNG_tIME_SUPPORTED
void PNGAPI
png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time)
{
@ -876,7 +876,7 @@ png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time)
}
#endif
#if defined(PNG_tRNS_SUPPORTED)
#ifdef PNG_tRNS_SUPPORTED
void PNGAPI
png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
png_bytep trans_alpha, int num_trans, png_color_16p trans_color)
@ -929,7 +929,7 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
}
#endif
#if defined(PNG_sPLT_SUPPORTED)
#ifdef PNG_sPLT_SUPPORTED
void PNGAPI
png_set_sPLT(png_structp png_ptr,
png_infop info_ptr, png_sPLT_tp entries, int nentries)
@ -1069,7 +1069,7 @@ png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr,
#endif
#if defined(PNG_MNG_FEATURES_SUPPORTED)
#ifdef PNG_MNG_FEATURES_SUPPORTED
png_uint_32 PNGAPI
png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features)
{
@ -1083,7 +1083,7 @@ png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features)
}
#endif
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
void PNGAPI
png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
chunk_list, int num_chunks)
@ -1128,7 +1128,7 @@ png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
}
#endif
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
void PNGAPI
png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr,
png_user_chunk_ptr read_user_chunk_fn)
@ -1143,7 +1143,7 @@ png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr,
}
#endif
#if defined(PNG_INFO_IMAGE_SUPPORTED)
#ifdef PNG_INFO_IMAGE_SUPPORTED
void PNGAPI
png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)
{
@ -1215,7 +1215,7 @@ png_set_chunk_cache_max (png_structp png_ptr,
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
#if defined(PNG_BENIGN_ERRORS_SUPPORTED)
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
void PNGAPI
png_set_benign_errors(png_structp png_ptr, int allowed)
{

View File

@ -1,7 +1,7 @@
/* pngtest.c - a simple test program to test libpng
*
* Last changed in libpng 1.4.0 [September 17, 2009]
* Last changed in libpng 1.4.0 [September 23, 2009]
* Copyright (c) 1998-2009 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.)
@ -64,7 +64,7 @@ static float t_start, t_stop, t_decode, t_encode, t_misc;
#include <time.h>
#endif
#if defined(PNG_TIME_RFC1123_SUPPORTED)
#ifdef PNG_TIME_RFC1123_SUPPORTED
#define PNG_tIME_STRING_LENGTH 29
static int tIME_chunk_present = 0;
static char tIME_string[PNG_tIME_STRING_LENGTH] = "tIME chunk is not present";
@ -130,7 +130,7 @@ write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass)
}
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
/* Example of using user transform callback (we don't transform anything,
* but merely examine the row filters. We set this to 256 rather than
* 5 in case illegal filter values are present.)
@ -146,7 +146,7 @@ count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data)
}
#endif
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
/* Example of using user transform callback (we don't transform anything,
* but merely count the zero samples)
*/
@ -327,7 +327,7 @@ pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
}
#endif /* USE_FAR_KEYWORD */
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
#ifdef PNG_WRITE_FLUSH_SUPPORTED
static void
pngtest_flush(png_structp png_ptr)
{
@ -563,7 +563,7 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
/* Demonstration of user chunk support of the sTER and vpAg chunks */
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
/* (sTER is a public chunk not yet known by libpng. vpAg is a private
chunk used in ImageMagick to store "virtual page" size). */
@ -689,7 +689,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
pngtest_warning);
#endif
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
user_chunk_data[0] = 0;
user_chunk_data[1] = 0;
user_chunk_data[2] = 0;
@ -778,7 +778,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_set_read_fn(read_ptr, (png_voidp)fpin, pngtest_read_data);
# ifdef PNG_WRITE_SUPPORTED
png_set_write_fn(write_ptr, (png_voidp)fpout, pngtest_write_data,
# if defined(PNG_WRITE_FLUSH_SUPPORTED)
# ifdef PNG_WRITE_FLUSH_SUPPORTED
pngtest_flush);
# else
NULL);
@ -800,7 +800,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_set_read_status_fn(read_ptr, NULL);
}
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
{
int i;
for (i = 0; i<256; i++)
@ -808,19 +808,19 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_set_read_user_transform_fn(read_ptr, count_filters);
}
#endif
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
zero_samples = 0;
png_set_write_user_transform_fn(write_ptr, count_zero_samples);
#endif
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
# ifndef PNG_HANDLE_CHUNK_ALWAYS
# define PNG_HANDLE_CHUNK_ALWAYS 3
# endif
png_set_keep_unknown_chunks(read_ptr, PNG_HANDLE_CHUNK_ALWAYS,
NULL, 0);
#endif
#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
# ifndef PNG_HANDLE_CHUNK_IF_SAFE
# define PNG_HANDLE_CHUNK_IF_SAFE 2
# endif
@ -839,15 +839,15 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
&color_type, &interlace_type, &compression_type, &filter_type))
{
png_set_IHDR(write_ptr, write_info_ptr, width, height, bit_depth,
#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
color_type, interlace_type, compression_type, filter_type);
#else
color_type, PNG_INTERLACE_NONE, compression_type, filter_type);
#endif
}
}
#if defined(PNG_FIXED_POINT_SUPPORTED)
#if defined(PNG_cHRM_SUPPORTED)
#ifdef PNG_FIXED_POINT_SUPPORTED
#ifdef PNG_cHRM_SUPPORTED
{
png_fixed_point white_x, white_y, red_x, red_y, green_x, green_y, blue_x,
blue_y;
@ -859,7 +859,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
#if defined(PNG_gAMA_SUPPORTED)
#ifdef PNG_gAMA_SUPPORTED
{
png_fixed_point gamma;
@ -881,7 +881,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
#if defined(PNG_gAMA_SUPPORTED)
#ifdef PNG_gAMA_SUPPORTED
{
double gamma;
@ -891,7 +891,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif
#endif /* Floating point */
#endif /* Fixed point */
#if defined(PNG_iCCP_SUPPORTED)
#ifdef PNG_iCCP_SUPPORTED
{
png_charp name;
png_charp profile;
@ -906,7 +906,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
#if defined(PNG_sRGB_SUPPORTED)
#ifdef PNG_sRGB_SUPPORTED
{
int intent;
@ -921,7 +921,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
if (png_get_PLTE(read_ptr, read_info_ptr, &palette, &num_palette))
png_set_PLTE(write_ptr, write_info_ptr, palette, num_palette);
}
#if defined(PNG_bKGD_SUPPORTED)
#ifdef PNG_bKGD_SUPPORTED
{
png_color_16p background;
@ -931,7 +931,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
#if defined(PNG_hIST_SUPPORTED)
#ifdef PNG_hIST_SUPPORTED
{
png_uint_16p hist;
@ -939,7 +939,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_set_hIST(write_ptr, write_info_ptr, hist);
}
#endif
#if defined(PNG_oFFs_SUPPORTED)
#ifdef PNG_oFFs_SUPPORTED
{
png_int_32 offset_x, offset_y;
int unit_type;
@ -951,7 +951,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
#if defined(PNG_pCAL_SUPPORTED)
#ifdef PNG_pCAL_SUPPORTED
{
png_charp purpose, units;
png_charpp params;
@ -966,7 +966,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
#if defined(PNG_pHYs_SUPPORTED)
#ifdef PNG_pHYs_SUPPORTED
{
png_uint_32 res_x, res_y;
int unit_type;
@ -975,7 +975,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
#if defined(PNG_sBIT_SUPPORTED)
#ifdef PNG_sBIT_SUPPORTED
{
png_color_8p sig_bit;
@ -1010,7 +1010,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif
#endif
#endif
#if defined(PNG_TEXT_SUPPORTED)
#ifdef PNG_TEXT_SUPPORTED
{
png_textp text_ptr;
int num_text;
@ -1022,14 +1022,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
#if defined(PNG_tIME_SUPPORTED)
#ifdef PNG_tIME_SUPPORTED
{
png_timep mod_time;
if (png_get_tIME(read_ptr, read_info_ptr, &mod_time))
{
png_set_tIME(write_ptr, write_info_ptr, mod_time);
#if defined(PNG_TIME_RFC1123_SUPPORTED)
#ifdef PNG_TIME_RFC1123_SUPPORTED
/* We have to use png_memcpy instead of "=" because the string
* pointed to by png_convert_to_rfc1123() gets free'ed before
* we use it.
@ -1043,7 +1043,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
#if defined(PNG_tRNS_SUPPORTED)
#ifdef PNG_tRNS_SUPPORTED
{
png_bytep trans_alpha;
int num_trans;
@ -1065,7 +1065,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
{
png_unknown_chunkp unknowns;
int num_unknowns = (int)png_get_unknown_chunks(read_ptr, read_info_ptr,
@ -1094,7 +1094,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
*/
png_write_info(write_ptr, write_info_ptr);
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
if (user_chunk_data[0] != 0)
{
png_byte png_sTER[5] = {115, 84, 69, 82, '\0'};
@ -1188,17 +1188,17 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
png_free_data(read_ptr, read_info_ptr, PNG_FREE_UNKN, -1);
#endif
#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1);
#endif
png_debug(0, "Reading and writing end_info data");
png_read_end(read_ptr, end_info_ptr);
#if defined(PNG_TEXT_SUPPORTED)
#ifdef PNG_TEXT_SUPPORTED
{
png_textp text_ptr;
int num_text;
@ -1210,14 +1210,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
#if defined(PNG_tIME_SUPPORTED)
#ifdef PNG_tIME_SUPPORTED
{
png_timep mod_time;
if (png_get_tIME(read_ptr, end_info_ptr, &mod_time))
{
png_set_tIME(write_ptr, write_end_info_ptr, mod_time);
#if defined(PNG_TIME_RFC1123_SUPPORTED)
#ifdef PNG_TIME_RFC1123_SUPPORTED
/* We have to use png_memcpy instead of "=" because the string
pointed to by png_convert_to_rfc1123() gets free'ed before
we use it */
@ -1230,7 +1230,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
{
png_unknown_chunkp unknowns;
int num_unknowns;
@ -1457,7 +1457,7 @@ main(int argc, char *argv[])
#endif
for (i=2; i<argc; ++i)
{
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
int k;
#endif
int kerror;
@ -1465,19 +1465,19 @@ main(int argc, char *argv[])
kerror = test_one_file(argv[i], outname);
if (kerror == 0)
{
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
fprintf(STDERR, "\n PASS (%lu zero samples)\n",
(unsigned long)zero_samples);
#else
fprintf(STDERR, " PASS\n");
#endif
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
for (k = 0; k<256; k++)
if (filters_used[k])
fprintf(STDERR, " Filter %d was used %lu times\n",
k, (unsigned long)filters_used[k]);
#endif
#if defined(PNG_TIME_RFC1123_SUPPORTED)
#ifdef PNG_TIME_RFC1123_SUPPORTED
if (tIME_chunk_present != 0)
fprintf(STDERR, " tIME = %s\n", tIME_string);
tIME_chunk_present = 0;
@ -1537,23 +1537,23 @@ main(int argc, char *argv[])
{
if (verbose == 1 || i == 2)
{
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
int k;
#endif
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
fprintf(STDERR, "\n PASS (%lu zero samples)\n",
(unsigned long)zero_samples);
#else
fprintf(STDERR, " PASS\n");
#endif
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
for (k = 0; k<256; k++)
if (filters_used[k])
fprintf(STDERR, " Filter %d was used %lu times\n",
k,
(unsigned long)filters_used[k]);
#endif
#if defined(PNG_TIME_RFC1123_SUPPORTED)
#ifdef PNG_TIME_RFC1123_SUPPORTED
if (tIME_chunk_present != 0)
fprintf(STDERR, " tIME = %s\n", tIME_string);
#endif /* PNG_TIME_RFC1123_SUPPORTED */

View File

@ -1,7 +1,7 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
* Last changed in libpng 1.4.0 [September 17, 2009]
* Last changed in libpng 1.4.0 [September 23, 2009]
* Copyright (c) 1998-2009 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.)
@ -644,7 +644,7 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp
if (png_ptr == NULL)
return;
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
png_ptr->user_transform_ptr = user_transform_ptr;
png_ptr->user_transform_depth = (png_byte)user_transform_depth;
png_ptr->user_transform_channels = (png_byte)user_transform_channels;
@ -666,7 +666,7 @@ png_get_user_transform_ptr(png_structp png_ptr)
{
if (png_ptr == NULL)
return (NULL);
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
return ((png_voidp)png_ptr->user_transform_ptr);
#else
return (NULL);

View File

@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file
*
* Last changed in libpng 1.4.0 [September 17, 2009]
* Last changed in libpng 1.4.0 [September 23, 2009]
* Copyright (c) 1998-2009 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.)
@ -36,7 +36,7 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
{
/* Write PNG signature */
png_write_sig(png_ptr);
#if defined(PNG_MNG_FEATURES_SUPPORTED)
#ifdef PNG_MNG_FEATURES_SUPPORTED
if ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&(png_ptr->mng_features_permitted))
{
png_warning(png_ptr, "MNG features are not allowed in a PNG datastream");
@ -47,7 +47,7 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
png_write_IHDR(png_ptr, info_ptr->width, info_ptr->height,
info_ptr->bit_depth, info_ptr->color_type, info_ptr->compression_type,
info_ptr->filter_type,
#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
info_ptr->interlace_type);
#else
0);
@ -55,7 +55,7 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
/* The rest of these check to see if the valid field has the appropriate
* flag set, and if it does, writes the chunk.
*/
#if defined(PNG_WRITE_gAMA_SUPPORTED)
#ifdef PNG_WRITE_gAMA_SUPPORTED
if (info_ptr->valid & PNG_INFO_gAMA)
{
# ifdef PNG_FLOATING_POINT_SUPPORTED
@ -67,20 +67,20 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
#endif
}
#endif
#if defined(PNG_WRITE_sRGB_SUPPORTED)
#ifdef PNG_WRITE_sRGB_SUPPORTED
if (info_ptr->valid & PNG_INFO_sRGB)
png_write_sRGB(png_ptr, (int)info_ptr->srgb_intent);
#endif
#if defined(PNG_WRITE_iCCP_SUPPORTED)
#ifdef PNG_WRITE_iCCP_SUPPORTED
if (info_ptr->valid & PNG_INFO_iCCP)
png_write_iCCP(png_ptr, info_ptr->iccp_name, PNG_COMPRESSION_TYPE_BASE,
info_ptr->iccp_profile, (int)info_ptr->iccp_proflen);
#endif
#if defined(PNG_WRITE_sBIT_SUPPORTED)
#ifdef PNG_WRITE_sBIT_SUPPORTED
if (info_ptr->valid & PNG_INFO_sBIT)
png_write_sBIT(png_ptr, &(info_ptr->sig_bit), info_ptr->color_type);
#endif
#if defined(PNG_WRITE_cHRM_SUPPORTED)
#ifdef PNG_WRITE_cHRM_SUPPORTED
if (info_ptr->valid & PNG_INFO_cHRM)
{
#ifdef PNG_FLOATING_POINT_SUPPORTED
@ -100,7 +100,7 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
#endif
}
#endif
#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
if (info_ptr->unknown_chunks_num)
{
png_unknown_chunk *up;
@ -149,10 +149,10 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
png_error(png_ptr, "Valid palette required for paletted images");
#if defined(PNG_WRITE_tRNS_SUPPORTED)
#ifdef PNG_WRITE_tRNS_SUPPORTED
if (info_ptr->valid & PNG_INFO_tRNS)
{
#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
/* Invert the alpha channel (in tRNS) */
if ((png_ptr->transformations & PNG_INVERT_ALPHA) &&
info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
@ -166,29 +166,29 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
info_ptr->num_trans, info_ptr->color_type);
}
#endif
#if defined(PNG_WRITE_bKGD_SUPPORTED)
#ifdef PNG_WRITE_bKGD_SUPPORTED
if (info_ptr->valid & PNG_INFO_bKGD)
png_write_bKGD(png_ptr, &(info_ptr->background), info_ptr->color_type);
#endif
#if defined(PNG_WRITE_hIST_SUPPORTED)
#ifdef PNG_WRITE_hIST_SUPPORTED
if (info_ptr->valid & PNG_INFO_hIST)
png_write_hIST(png_ptr, info_ptr->hist, info_ptr->num_palette);
#endif
#if defined(PNG_WRITE_oFFs_SUPPORTED)
#ifdef PNG_WRITE_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs)
png_write_oFFs(png_ptr, info_ptr->x_offset, info_ptr->y_offset,
info_ptr->offset_unit_type);
#endif
#if defined(PNG_WRITE_pCAL_SUPPORTED)
#ifdef PNG_WRITE_pCAL_SUPPORTED
if (info_ptr->valid & PNG_INFO_pCAL)
png_write_pCAL(png_ptr, info_ptr->pcal_purpose, info_ptr->pcal_X0,
info_ptr->pcal_X1, info_ptr->pcal_type, info_ptr->pcal_nparams,
info_ptr->pcal_units, info_ptr->pcal_params);
#endif
#if defined(PNG_sCAL_SUPPORTED)
#ifdef PNG_sCAL_SUPPORTED
if (info_ptr->valid & PNG_INFO_sCAL)
#if defined(PNG_WRITE_sCAL_SUPPORTED)
#ifdef PNG_WRITE_sCAL_SUPPORTED
#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
png_write_sCAL(png_ptr, (int)info_ptr->scal_unit,
info_ptr->scal_pixel_width, info_ptr->scal_pixel_height);
@ -204,13 +204,13 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
#endif /* WRITE_sCAL */
#endif /* sCAL */
#if defined(PNG_WRITE_pHYs_SUPPORTED)
#ifdef PNG_WRITE_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs)
png_write_pHYs(png_ptr, info_ptr->x_pixels_per_unit,
info_ptr->y_pixels_per_unit, info_ptr->phys_unit_type);
#endif /* pHYs */
#if defined(PNG_WRITE_tIME_SUPPORTED)
#ifdef PNG_WRITE_tIME_SUPPORTED
if (info_ptr->valid & PNG_INFO_tIME)
{
png_write_tIME(png_ptr, &(info_ptr->mod_time));
@ -218,13 +218,13 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
}
#endif /* tIME */
#if defined(PNG_WRITE_sPLT_SUPPORTED)
#ifdef PNG_WRITE_sPLT_SUPPORTED
if (info_ptr->valid & PNG_INFO_sPLT)
for (i = 0; i < (int)info_ptr->splt_palettes_num; i++)
png_write_sPLT(png_ptr, info_ptr->splt_palettes + i);
#endif /* sPLT */
#if defined(PNG_WRITE_TEXT_SUPPORTED)
#ifdef PNG_WRITE_TEXT_SUPPORTED
/* Check to see if we need to write text chunks */
for (i = 0; i < info_ptr->num_text; i++)
{
@ -233,7 +233,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
/* An internationalized chunk? */
if (info_ptr->text[i].compression > 0)
{
#if defined(PNG_WRITE_iTXt_SUPPORTED)
#ifdef PNG_WRITE_iTXt_SUPPORTED
/* Write international chunk */
png_write_iTXt(png_ptr,
info_ptr->text[i].compression,
@ -250,7 +250,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
/* If we want a compressed text chunk */
else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_zTXt)
{
#if defined(PNG_WRITE_zTXt_SUPPORTED)
#ifdef PNG_WRITE_zTXt_SUPPORTED
/* Write compressed chunk */
png_write_zTXt(png_ptr, info_ptr->text[i].key,
info_ptr->text[i].text, 0,
@ -263,7 +263,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
}
else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE)
{
#if defined(PNG_WRITE_tEXt_SUPPORTED)
#ifdef PNG_WRITE_tEXt_SUPPORTED
/* Write uncompressed chunk */
png_write_tEXt(png_ptr, info_ptr->text[i].key,
info_ptr->text[i].text,
@ -278,7 +278,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
}
#endif /* tEXt */
#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
if (info_ptr->unknown_chunks_num)
{
png_unknown_chunk *up;
@ -321,16 +321,16 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
/* See if user wants us to write information chunks */
if (info_ptr != NULL)
{
#if defined(PNG_WRITE_TEXT_SUPPORTED)
#ifdef PNG_WRITE_TEXT_SUPPORTED
int i; /* local index variable */
#endif
#if defined(PNG_WRITE_tIME_SUPPORTED)
#ifdef PNG_WRITE_tIME_SUPPORTED
/* Check to see if user has supplied a time chunk */
if ((info_ptr->valid & PNG_INFO_tIME) &&
!(png_ptr->mode & PNG_WROTE_tIME))
png_write_tIME(png_ptr, &(info_ptr->mod_time));
#endif
#if defined(PNG_WRITE_TEXT_SUPPORTED)
#ifdef PNG_WRITE_TEXT_SUPPORTED
/* Loop through comment chunks */
for (i = 0; i < info_ptr->num_text; i++)
{
@ -339,7 +339,7 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
/* An internationalized chunk? */
if (info_ptr->text[i].compression > 0)
{
#if defined(PNG_WRITE_iTXt_SUPPORTED)
#ifdef PNG_WRITE_iTXt_SUPPORTED
/* Write international chunk */
png_write_iTXt(png_ptr,
info_ptr->text[i].compression,
@ -355,7 +355,7 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
}
else if (info_ptr->text[i].compression >= PNG_TEXT_COMPRESSION_zTXt)
{
#if defined(PNG_WRITE_zTXt_SUPPORTED)
#ifdef PNG_WRITE_zTXt_SUPPORTED
/* Write compressed chunk */
png_write_zTXt(png_ptr, info_ptr->text[i].key,
info_ptr->text[i].text, 0,
@ -368,7 +368,7 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
}
else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE)
{
#if defined(PNG_WRITE_tEXt_SUPPORTED)
#ifdef PNG_WRITE_tEXt_SUPPORTED
/* Write uncompressed chunk */
png_write_tEXt(png_ptr, info_ptr->text[i].key,
info_ptr->text[i].text, 0);
@ -381,7 +381,7 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
}
}
#endif
#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
if (info_ptr->unknown_chunks_num)
{
png_unknown_chunk *up;
@ -415,12 +415,12 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
* experiences a problem, please report the event to
* png-mng-implement at lists.sf.net .
*/
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
#ifdef PNG_WRITE_FLUSH_SUPPORTED
png_flush(png_ptr);
#endif
}
#if defined(PNG_WRITE_tIME_SUPPORTED)
#ifdef PNG_WRITE_tIME_SUPPORTED
/* "time.h" functions are not supported on WindowsCE */
void PNGAPI
png_convert_from_struct_tm(png_timep ptime, struct tm FAR * ttime)
@ -580,7 +580,7 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_set_write_fn(png_ptr, NULL, NULL, NULL);
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT,
1, NULL, NULL);
#endif
@ -628,7 +628,7 @@ png_write_image(png_structp png_ptr, png_bytepp image)
png_debug(1, "in png_write_image");
#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
/* Initialize interlace handling. If image is not interlaced,
* this will set pass to 1
*/
@ -698,7 +698,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
png_write_start_row(png_ptr);
}
#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
/* If interlaced and not interested in row, return */
if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
{
@ -778,7 +778,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
/* Copy user's row into buffer, leaving room for filter byte. */
png_memcpy(png_ptr->row_buf + 1, row, png_ptr->row_info.rowbytes);
#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
/* Handle interlacing */
if (png_ptr->interlaced && png_ptr->pass < 6 &&
(png_ptr->transformations & PNG_INTERLACE))
@ -798,7 +798,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
if (png_ptr->transformations)
png_do_write_transformations(png_ptr);
#if defined(PNG_MNG_FEATURES_SUPPORTED)
#ifdef PNG_MNG_FEATURES_SUPPORTED
/* Write filter_method 64 (intrapixel differencing) only if
* 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and
* 2. Libpng did not write a PNG signature (this filter_method is only
@ -823,7 +823,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
(*(png_ptr->write_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass);
}
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
#ifdef PNG_WRITE_FLUSH_SUPPORTED
/* Set the automatic flush interval or 0 to turn flushing off */
void PNGAPI
png_set_flush(png_structp png_ptr, int nrows)
@ -930,7 +930,7 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
{
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
if (png_ptr->num_chunk_list)
{
png_free(png_ptr, png_ptr->chunk_list);
@ -992,11 +992,11 @@ png_write_destroy(png_structp png_ptr)
png_free(png_ptr, png_ptr->paeth_row);
#endif
#if defined(PNG_TIME_RFC1123_SUPPORTED)
#ifdef PNG_TIME_RFC1123_SUPPORTED
png_free(png_ptr, png_ptr->time_buffer);
#endif
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
png_free(png_ptr, png_ptr->prev_filters);
png_free(png_ptr, png_ptr->filter_weights);
png_free(png_ptr, png_ptr->inv_filter_weights);
@ -1038,7 +1038,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
if (png_ptr == NULL)
return;
#if defined(PNG_MNG_FEATURES_SUPPORTED)
#ifdef PNG_MNG_FEATURES_SUPPORTED
if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
(method == PNG_INTRAPIXEL_DIFFERENCING))
method = PNG_FILTER_TYPE_BASE;
@ -1150,7 +1150,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
* filtered data going to zlib more consistent, hopefully resulting in
* better compression.
*/
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* GRR 970116 */
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* GRR 970116 */
void PNGAPI
png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
int num_weights, png_doublep filter_weights,
@ -1345,7 +1345,7 @@ png_set_write_status_fn(png_structp png_ptr, png_write_status_ptr write_row_fn)
png_ptr->write_row_fn = write_row_fn;
}
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
void PNGAPI
png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
write_user_transform_fn)
@ -1360,7 +1360,7 @@ png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
#endif
#if defined(PNG_INFO_IMAGE_SUPPORTED)
#ifdef PNG_INFO_IMAGE_SUPPORTED
void PNGAPI
png_write_png(png_structp png_ptr, png_infop info_ptr,
int transforms, voidp params)
@ -1373,13 +1373,13 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
/* ------ these transformations don't touch the info structure ------- */
#if defined(PNG_WRITE_INVERT_SUPPORTED)
#ifdef PNG_WRITE_INVERT_SUPPORTED
/* Invert monochrome pixels */
if (transforms & PNG_TRANSFORM_INVERT_MONO)
png_set_invert_mono(png_ptr);
#endif
#if defined(PNG_WRITE_SHIFT_SUPPORTED)
#ifdef PNG_WRITE_SHIFT_SUPPORTED
/* Shift the pixels up to a legal bit depth and fill in
* as appropriate to correctly scale the image.
*/
@ -1388,19 +1388,19 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
png_set_shift(png_ptr, &info_ptr->sig_bit);
#endif
#if defined(PNG_WRITE_PACK_SUPPORTED)
#ifdef PNG_WRITE_PACK_SUPPORTED
/* Pack pixels into bytes */
if (transforms & PNG_TRANSFORM_PACKING)
png_set_packing(png_ptr);
#endif
#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
/* Swap location of alpha bytes from ARGB to RGBA */
if (transforms & PNG_TRANSFORM_SWAP_ALPHA)
png_set_swap_alpha(png_ptr);
#endif
#if defined(PNG_WRITE_FILLER_SUPPORTED)
#ifdef PNG_WRITE_FILLER_SUPPORTED
/* Pack XRGB/RGBX/ARGB/RGBA into * RGB (4 channels -> 3 channels) */
if (transforms & PNG_TRANSFORM_STRIP_FILLER_AFTER)
png_set_filler(png_ptr, 0, PNG_FILLER_AFTER);
@ -1408,31 +1408,31 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
#endif
#if defined(PNG_WRITE_BGR_SUPPORTED)
#ifdef PNG_WRITE_BGR_SUPPORTED
/* Flip BGR pixels to RGB */
if (transforms & PNG_TRANSFORM_BGR)
png_set_bgr(png_ptr);
#endif
#if defined(PNG_WRITE_SWAP_SUPPORTED)
#ifdef PNG_WRITE_SWAP_SUPPORTED
/* Swap bytes of 16-bit files to most significant byte first */
if (transforms & PNG_TRANSFORM_SWAP_ENDIAN)
png_set_swap(png_ptr);
#endif
#if defined(PNG_WRITE_PACKSWAP_SUPPORTED)
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
/* Swap bits of 1, 2, 4 bit packed pixel formats */
if (transforms & PNG_TRANSFORM_PACKSWAP)
png_set_packswap(png_ptr);
#endif
#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
/* Invert the alpha channel from opacity to transparency */
if (transforms & PNG_TRANSFORM_INVERT_ALPHA)
png_set_invert_alpha(png_ptr);
#endif
#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
/* Invert the alpha channel from opacity to transparency */
if (transforms & PNG_TRANSFORM_INVERT_ALPHA)
png_set_invert_alpha(png_ptr);

View File

@ -1,7 +1,7 @@
/* pngwtran.c - transforms the data in a row for PNG writers
*
* Last changed in libpng 1.4.0 [September 17, 2009]
* Last changed in libpng 1.4.0 [September 23, 2009]
* Copyright (c) 1998-2009 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.)
@ -26,7 +26,7 @@ png_do_write_transformations(png_structp png_ptr)
if (png_ptr == NULL)
return;
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
if (png_ptr->transformations & PNG_USER_TRANSFORM)
if (png_ptr->write_user_transform_fn != NULL)
(*(png_ptr->write_user_transform_fn)) /* User write transform function */
@ -40,48 +40,48 @@ png_do_write_transformations(png_structp png_ptr)
/* png_byte pixel_depth; bits per pixel (depth*channels) */
png_ptr->row_buf + 1); /* start of pixel data for row */
#endif
#if defined(PNG_WRITE_FILLER_SUPPORTED)
#ifdef PNG_WRITE_FILLER_SUPPORTED
if (png_ptr->transformations & PNG_FILLER)
png_do_strip_filler(&(png_ptr->row_info), png_ptr->row_buf + 1,
png_ptr->flags);
#endif
#if defined(PNG_WRITE_PACKSWAP_SUPPORTED)
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
if (png_ptr->transformations & PNG_PACKSWAP)
png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
#if defined(PNG_WRITE_PACK_SUPPORTED)
#ifdef PNG_WRITE_PACK_SUPPORTED
if (png_ptr->transformations & PNG_PACK)
png_do_pack(&(png_ptr->row_info), png_ptr->row_buf + 1,
(png_uint_32)png_ptr->bit_depth);
#endif
#if defined(PNG_WRITE_SWAP_SUPPORTED)
#ifdef PNG_WRITE_SWAP_SUPPORTED
if (png_ptr->transformations & PNG_SWAP_BYTES)
png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
#if defined(PNG_WRITE_SHIFT_SUPPORTED)
#ifdef PNG_WRITE_SHIFT_SUPPORTED
if (png_ptr->transformations & PNG_SHIFT)
png_do_shift(&(png_ptr->row_info), png_ptr->row_buf + 1,
&(png_ptr->shift));
#endif
#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
if (png_ptr->transformations & PNG_SWAP_ALPHA)
png_do_write_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
if (png_ptr->transformations & PNG_INVERT_ALPHA)
png_do_write_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
#if defined(PNG_WRITE_BGR_SUPPORTED)
#ifdef PNG_WRITE_BGR_SUPPORTED
if (png_ptr->transformations & PNG_BGR)
png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
#if defined(PNG_WRITE_INVERT_SUPPORTED)
#ifdef PNG_WRITE_INVERT_SUPPORTED
if (png_ptr->transformations & PNG_INVERT_MONO)
png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
}
#if defined(PNG_WRITE_PACK_SUPPORTED)
#ifdef PNG_WRITE_PACK_SUPPORTED
/* Pack pixels into bytes. Pass the true bit depth in bit_depth. The
* row_info bit depth should be 8 (one pixel per byte). The channels
* should be 1 (this only happens on grayscale and paletted images).
@ -202,7 +202,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
}
#endif
#if defined(PNG_WRITE_SHIFT_SUPPORTED)
#ifdef PNG_WRITE_SHIFT_SUPPORTED
/* Shift pixel values to take advantage of whole range. Pass the
* true number of bits in bit_depth. The row should be packed
* according to row_info->bit_depth. Thus, if you had a row of
@ -330,7 +330,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
}
#endif
#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
void /* PRIVATE */
png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
{
@ -416,7 +416,7 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
}
#endif
#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
void /* PRIVATE */
png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
{
@ -503,7 +503,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
}
#endif
#if defined(PNG_MNG_FEATURES_SUPPORTED)
#ifdef PNG_MNG_FEATURES_SUPPORTED
/* Undoes intrapixel differencing */
void /* PRIVATE */
png_do_write_intrapixel(png_row_infop row_info, png_bytep row)

View File

@ -1,7 +1,7 @@
/* pngwutil.c - utilities to write a PNG file
*
* Last changed in libpng 1.4.0 [September 17, 2009]
* Last changed in libpng 1.4.0 [September 23, 2009]
* Copyright (c) 1998-2009 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.)
@ -28,7 +28,7 @@ png_save_uint_32(png_bytep buf, png_uint_32 i)
buf[3] = (png_byte)(i & 0xff);
}
#if defined(PNG_SAVE_INT_32_SUPPORTED)
#ifdef PNG_SAVE_INT_32_SUPPORTED
/* The png_save_int_32 function assumes integers are stored in two's
* complement format. If this isn't the case, then this routine needs to
* be modified to write data in two's complement format.
@ -220,7 +220,7 @@ png_text_compress(png_structp png_ptr,
if (compression >= PNG_TEXT_COMPRESSION_LAST)
{
#if defined(PNG_STDIO_SUPPORTED)
#ifdef PNG_STDIO_SUPPORTED
char msg[50];
png_snprintf(msg, 50, "Unknown compression type %d", compression);
png_warning(png_ptr, msg);
@ -483,7 +483,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
* 5. The color_type is RGB or RGBA
*/
if (
#if defined(PNG_MNG_FEATURES_SUPPORTED)
#ifdef PNG_MNG_FEATURES_SUPPORTED
!((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) == 0) &&
(color_type == PNG_COLOR_TYPE_RGB ||
@ -511,7 +511,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
png_ptr->bit_depth = (png_byte)bit_depth;
png_ptr->color_type = (png_byte)color_type;
png_ptr->interlaced = (png_byte)interlace_type;
#if defined(PNG_MNG_FEATURES_SUPPORTED)
#ifdef PNG_MNG_FEATURES_SUPPORTED
png_ptr->filter_type = (png_byte)filter_type;
#endif
png_ptr->compression_type = (png_byte)compression_type;
@ -601,7 +601,7 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
png_debug(1, "in png_write_PLTE");
if ((
#if defined(PNG_MNG_FEATURES_SUPPORTED)
#ifdef PNG_MNG_FEATURES_SUPPORTED
!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) &&
#endif
num_pal == 0) || num_pal > 256)
@ -718,7 +718,7 @@ png_write_IEND(png_structp png_ptr)
png_ptr->mode |= PNG_HAVE_IEND;
}
#if defined(PNG_WRITE_gAMA_SUPPORTED)
#ifdef PNG_WRITE_gAMA_SUPPORTED
/* Write a gAMA chunk */
#ifdef PNG_FLOATING_POINT_SUPPORTED
void /* PRIVATE */
@ -752,7 +752,7 @@ png_write_gAMA_fixed(png_structp png_ptr, png_fixed_point file_gamma)
#endif
#endif
#if defined(PNG_WRITE_sRGB_SUPPORTED)
#ifdef PNG_WRITE_sRGB_SUPPORTED
/* Write a sRGB chunk */
void /* PRIVATE */
png_write_sRGB(png_structp png_ptr, int srgb_intent)
@ -770,7 +770,7 @@ png_write_sRGB(png_structp png_ptr, int srgb_intent)
}
#endif
#if defined(PNG_WRITE_iCCP_SUPPORTED)
#ifdef PNG_WRITE_iCCP_SUPPORTED
/* Write an iCCP chunk */
void /* PRIVATE */
png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
@ -849,7 +849,7 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
}
#endif
#if defined(PNG_WRITE_sPLT_SUPPORTED)
#ifdef PNG_WRITE_sPLT_SUPPORTED
/* Write a sPLT chunk */
void /* PRIVATE */
png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette)
@ -928,7 +928,7 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette)
}
#endif
#if defined(PNG_WRITE_sBIT_SUPPORTED)
#ifdef PNG_WRITE_sBIT_SUPPORTED
/* Write the sBIT chunk */
void /* PRIVATE */
png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type)
@ -983,7 +983,7 @@ png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type)
}
#endif
#if defined(PNG_WRITE_cHRM_SUPPORTED)
#ifdef PNG_WRITE_cHRM_SUPPORTED
/* Write the cHRM chunk */
#ifdef PNG_FLOATING_POINT_SUPPORTED
void /* PRIVATE */
@ -1008,7 +1008,7 @@ png_write_cHRM(png_structp png_ptr, double white_x, double white_y,
int_blue_x = (png_uint_32)(blue_x * 100000.0 + 0.5);
int_blue_y = (png_uint_32)(blue_y * 100000.0 + 0.5);
#if defined(PNG_CHECK_cHRM_SUPPORTED)
#ifdef PNG_CHECK_cHRM_SUPPORTED
if (png_check_cHRM_fixed(png_ptr, int_white_x, int_white_y,
int_red_x, int_red_y, int_green_x, int_green_y, int_blue_x, int_blue_y))
#endif
@ -1044,7 +1044,7 @@ png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x,
png_debug(1, "in png_write_cHRM");
/* Each value is saved in 1/100,000ths */
#if defined(PNG_CHECK_cHRM_SUPPORTED)
#ifdef PNG_CHECK_cHRM_SUPPORTED
if (png_check_cHRM_fixed(png_ptr, white_x, white_y, red_x, red_y,
green_x, green_y, blue_x, blue_y))
#endif
@ -1067,7 +1067,7 @@ png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x,
#endif
#endif
#if defined(PNG_WRITE_tRNS_SUPPORTED)
#ifdef PNG_WRITE_tRNS_SUPPORTED
/* Write the tRNS chunk */
void /* PRIVATE */
png_write_tRNS(png_structp png_ptr, png_bytep trans_alpha, png_color_16p tran,
@ -1122,7 +1122,7 @@ png_write_tRNS(png_structp png_ptr, png_bytep trans_alpha, png_color_16p tran,
}
#endif
#if defined(PNG_WRITE_bKGD_SUPPORTED)
#ifdef PNG_WRITE_bKGD_SUPPORTED
/* Write the background chunk */
void /* PRIVATE */
png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type)
@ -1135,7 +1135,7 @@ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type)
if (color_type == PNG_COLOR_TYPE_PALETTE)
{
if (
#if defined(PNG_MNG_FEATURES_SUPPORTED)
#ifdef PNG_MNG_FEATURES_SUPPORTED
(png_ptr->num_palette ||
(!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE))) &&
#endif
@ -1174,7 +1174,7 @@ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type)
}
#endif
#if defined(PNG_WRITE_hIST_SUPPORTED)
#ifdef PNG_WRITE_hIST_SUPPORTED
/* Write the histogram */
void /* PRIVATE */
png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist)
@ -1249,7 +1249,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
if ((png_byte)*kp < 0x20 ||
((png_byte)*kp > 0x7E && (png_byte)*kp < 0xA1))
{
#if defined(PNG_STDIO_SUPPORTED)
#ifdef PNG_STDIO_SUPPORTED
char msg[40];
png_snprintf(msg, 40,
@ -1335,7 +1335,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
}
#endif
#if defined(PNG_WRITE_tEXt_SUPPORTED)
#ifdef PNG_WRITE_tEXt_SUPPORTED
/* Write a tEXt chunk */
void /* PRIVATE */
png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text,
@ -1374,7 +1374,7 @@ png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text,
}
#endif
#if defined(PNG_WRITE_zTXt_SUPPORTED)
#ifdef PNG_WRITE_zTXt_SUPPORTED
/* Write a compressed text chunk */
void /* PRIVATE */
png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text,
@ -1432,7 +1432,7 @@ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text,
}
#endif
#if defined(PNG_WRITE_iTXt_SUPPORTED)
#ifdef PNG_WRITE_iTXt_SUPPORTED
/* Write an iTXt chunk */
void /* PRIVATE */
png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
@ -1519,7 +1519,7 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
}
#endif
#if defined(PNG_WRITE_oFFs_SUPPORTED)
#ifdef PNG_WRITE_oFFs_SUPPORTED
/* Write the oFFs chunk */
void /* PRIVATE */
png_write_oFFs(png_structp png_ptr, png_int_32 x_offset, png_int_32 y_offset,
@ -1540,7 +1540,7 @@ png_write_oFFs(png_structp png_ptr, png_int_32 x_offset, png_int_32 y_offset,
png_write_chunk(png_ptr, (png_bytep)png_oFFs, buf, (png_size_t)9);
}
#endif
#if defined(PNG_WRITE_pCAL_SUPPORTED)
#ifdef PNG_WRITE_pCAL_SUPPORTED
/* Write the pCAL chunk (described in the PNG extensions document) */
void /* PRIVATE */
png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
@ -1601,7 +1601,7 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
}
#endif
#if defined(PNG_WRITE_sCAL_SUPPORTED)
#ifdef PNG_WRITE_sCAL_SUPPORTED
/* Write the sCAL chunk */
#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
void /* PRIVATE */
@ -1654,7 +1654,7 @@ png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width,
#endif
#endif
#if defined(PNG_WRITE_pHYs_SUPPORTED)
#ifdef PNG_WRITE_pHYs_SUPPORTED
/* Write the pHYs chunk */
void /* PRIVATE */
png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit,
@ -1677,7 +1677,7 @@ png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit,
}
#endif
#if defined(PNG_WRITE_tIME_SUPPORTED)
#ifdef PNG_WRITE_tIME_SUPPORTED
/* Write the tIME chunk. Use either png_convert_from_struct_tm()
* or png_convert_from_time_t(), or fill in the structure yourself.
*/
@ -1917,7 +1917,7 @@ png_write_finish_row(png_structp png_ptr)
png_ptr->zstream.data_type = Z_BINARY;
}
#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
/* Pick out the correct pixels for the interlace pass.
* The basic idea here is to go through the row with a source
* pointer and a destination pointer (sp and dp), and copy the
@ -2163,7 +2163,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
sum += (v < 128) ? v : 256 - v;
}
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
png_uint_32 sumhi, sumlo;
@ -2227,7 +2227,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_uint_32 i;
int v;
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
/* We temporarily increase the "minimum sum" by the factor we
* would reduce the sum of this filter, so that we can do the
* early exit comparison without scaling the sum each time.
@ -2280,7 +2280,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
break;
}
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
@ -2341,7 +2341,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
int v;
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
@ -2383,7 +2383,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
break;
}
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
@ -2446,7 +2446,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_uint_32 i;
int v;
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
@ -2495,7 +2495,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
break;
}
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
@ -2579,7 +2579,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_uint_32 i;
int v;
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
@ -2660,7 +2660,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
break;
}
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
@ -2702,7 +2702,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_write_filtered_row(png_ptr, best_row);
#ifdef PNG_WRITE_FILTER_SUPPORTED
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
/* Save the type of filter we picked this time for future calculations */
if (png_ptr->num_prev_filters > 0)
{
@ -2769,7 +2769,7 @@ png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row)
/* Finish row - updates counters and flushes zlib if last row */
png_write_finish_row(png_ptr);
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
#ifdef PNG_WRITE_FLUSH_SUPPORTED
png_ptr->flush_rows++;
if (png_ptr->flush_dist > 0 &&