[master] Ported some cosmetic changes from the devel branch

This commit is contained in:
Glenn Randers-Pehrson 2009-10-05 13:53:19 -05:00
parent 48fac4e8ce
commit 9023e8f7bb
9 changed files with 172 additions and 125 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.2.41beta04 - October 2, 2009 Libpng 1.2.41beta04 - October 5, 2009
This is not intended to be a public release. It will be replaced This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version. within a few weeks by a public version or by another test version.
@ -55,8 +55,9 @@ version 1.2.41beta03 [October 1, 2009]
Revised png_check_IHDR() again, to check info_ptr members instead of Revised png_check_IHDR() again, to check info_ptr members instead of
the contents of the returned parameters. the contents of the returned parameters.
version 1.2.41beta04 [October 2, 2009] version 1.2.41beta04 [October 5, 2009]
Added "xcode" project similar one already in libpng-1.4.0beta (Alam Arias). Added "xcode" project similar one already in libpng-1.4.0beta (Alam Arias).
Ported some cosmetic changes from libpng-1.4.0beta86.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net

View File

@ -2466,7 +2466,7 @@ version 1.2.40beta01 [August 20, 2009]
version 1.2.40rc01 [September 2, 2009] version 1.2.40rc01 [September 2, 2009]
Various bugfixes and improvements to CMakeLists.txt (Philip Lowman) Various bugfixes and improvements to CMakeLists.txt (Philip Lowman)
version 1.2.40 and 1.0.49 [October 2, 2009] version 1.2.40 and 1.0.49 [October 5, 2009]
No changes. No changes.
version 1.0.50 [September 10, 2009] version 1.0.50 [September 10, 2009]
@ -2485,8 +2485,9 @@ version 1.2.41beta03 [October 1, 2009]
Revised png_check_IHDR() again, to check info_ptr members instead of Revised png_check_IHDR() again, to check info_ptr members instead of
the contents of the returned parameters. the contents of the returned parameters.
version 1.2.41beta04 [October 2, 2009] version 1.2.41beta04 [October 5, 2009]
Added "xcode" project similar one already in libpng-1.4.0beta (Alam Arias). Added "xcode" project similar one already in libpng-1.4.0beta (Alam Arias).
Ported some cosmetic changes from libpng-1.4.0beta86.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -17,9 +17,9 @@ int PNGAPI
png_dummy_mmx_support(void) png_dummy_mmx_support(void)
{ {
int result; int result;
#if defined(PNG_MMX_CODE_SUPPORTED) // superfluous, but what the heck #ifdef PNG_MMX_CODE_SUPPORTED // superfluous, but what the heck
__asm__ __volatile__ ( __asm__ __volatile__ (
#if defined(__x86_64__) #ifdef __x86_64__
"pushq %%rbx \n\t" // rbx gets clobbered by CPUID instruction "pushq %%rbx \n\t" // rbx gets clobbered by CPUID instruction
"pushq %%rcx \n\t" // so does rcx... "pushq %%rcx \n\t" // so does rcx...
"pushq %%rdx \n\t" // ...and rdx (but rcx & rdx safe on Linux) "pushq %%rdx \n\t" // ...and rdx (but rcx & rdx safe on Linux)
@ -71,7 +71,7 @@ png_dummy_mmx_support(void)
"0: \n\t" // .NOT_SUPPORTED: target label for jump instructions "0: \n\t" // .NOT_SUPPORTED: target label for jump instructions
"movl $0, %%eax \n\t" // set return value to 0 "movl $0, %%eax \n\t" // set return value to 0
"1: \n\t" // .RETURN: target label for jump instructions "1: \n\t" // .RETURN: target label for jump instructions
#if defined(__x86_64__) #ifdef __x86_64__
"popq %%rdx \n\t" // restore rdx "popq %%rdx \n\t" // restore rdx
"popq %%rcx \n\t" // restore rcx "popq %%rcx \n\t" // restore rcx
"popq %%rbx \n\t" // restore rbx "popq %%rbx \n\t" // restore rbx

102
pngget.c
View File

@ -1,7 +1,7 @@
/* pngget.c - retrieval of values from info struct /* pngget.c - retrieval of values from info struct
* *
* Last changed in libpng 1.2.41 [October 2, 2009] * Last changed in libpng 1.2.41 [October 5, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (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); return(0);
} }
#if defined(PNG_INFO_IMAGE_SUPPORTED) #ifdef PNG_INFO_IMAGE_SUPPORTED
png_bytepp PNGAPI png_bytepp PNGAPI
png_get_rows(png_structp png_ptr, png_infop info_ptr) 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) png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_pHYs_SUPPORTED) #ifdef PNG_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs) if (info_ptr->valid & PNG_INFO_pHYs)
{ {
png_debug1(1, "in %s retrieval function", "png_get_x_pixels_per_meter"); 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) png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_pHYs_SUPPORTED) #ifdef PNG_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs) if (info_ptr->valid & PNG_INFO_pHYs)
{ {
png_debug1(1, "in %s retrieval function", "png_get_y_pixels_per_meter"); 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) png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_pHYs_SUPPORTED) #ifdef PNG_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs) if (info_ptr->valid & PNG_INFO_pHYs)
{ {
png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter"); png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter");
@ -182,13 +182,15 @@ float PNGAPI
png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr) png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_pHYs_SUPPORTED) #ifdef PNG_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs) if (info_ptr->valid & PNG_INFO_pHYs)
{ {
png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio"); png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio");
if (info_ptr->x_pixels_per_unit == 0) if (info_ptr->x_pixels_per_unit == 0)
return ((float)0.0); return ((float)0.0);
else else
return ((float)((float)info_ptr->y_pixels_per_unit return ((float)((float)info_ptr->y_pixels_per_unit
/(float)info_ptr->x_pixels_per_unit)); /(float)info_ptr->x_pixels_per_unit));
@ -204,7 +206,7 @@ png_int_32 PNGAPI
png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr) png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_oFFs_SUPPORTED) #ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs) if (info_ptr->valid & PNG_INFO_oFFs)
{ {
@ -227,7 +229,7 @@ png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_oFFs_SUPPORTED) #ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs) if (info_ptr->valid & PNG_INFO_oFFs)
{ {
png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns"); png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
@ -249,7 +251,7 @@ png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_oFFs_SUPPORTED) #ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs) if (info_ptr->valid & PNG_INFO_oFFs)
{ {
png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns"); png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
@ -271,7 +273,7 @@ png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_oFFs_SUPPORTED) #ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs) if (info_ptr->valid & PNG_INFO_oFFs)
{ {
png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns"); png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
@ -324,7 +326,7 @@ png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr)
*.00003937); *.00003937);
} }
#if defined(PNG_pHYs_SUPPORTED) #ifdef PNG_pHYs_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr, 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) png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
@ -334,6 +336,7 @@ png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
{ {
png_debug1(1, "in %s retrieval function", "pHYs"); png_debug1(1, "in %s retrieval function", "pHYs");
if (res_x != NULL) if (res_x != NULL)
{ {
*res_x = info_ptr->x_pixels_per_unit; *res_x = info_ptr->x_pixels_per_unit;
@ -382,7 +385,7 @@ png_get_signature(png_structp png_ptr, png_infop info_ptr)
return (NULL); return (NULL);
} }
#if defined(PNG_bKGD_SUPPORTED) #ifdef PNG_bKGD_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_bKGD(png_structp png_ptr, png_infop info_ptr, png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
png_color_16p *background) png_color_16p *background)
@ -391,6 +394,7 @@ png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
&& background != NULL) && background != NULL)
{ {
png_debug1(1, "in %s retrieval function", "bKGD"); png_debug1(1, "in %s retrieval function", "bKGD");
*background = &(info_ptr->background); *background = &(info_ptr->background);
return (PNG_INFO_bKGD); return (PNG_INFO_bKGD);
} }
@ -398,7 +402,7 @@ png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_cHRM_SUPPORTED) #ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_cHRM(png_structp png_ptr, png_infop info_ptr, png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
@ -408,6 +412,7 @@ png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
{ {
png_debug1(1, "in %s retrieval function", "cHRM"); png_debug1(1, "in %s retrieval function", "cHRM");
if (white_x != NULL) if (white_x != NULL)
*white_x = (double)info_ptr->x_white; *white_x = (double)info_ptr->x_white;
if (white_y != NULL) if (white_y != NULL)
@ -436,9 +441,10 @@ png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y, png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y,
png_fixed_point *blue_x, png_fixed_point *blue_y) png_fixed_point *blue_x, png_fixed_point *blue_y)
{ {
png_debug1(1, "in %s retrieval function", "cHRM");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
{ {
png_debug1(1, "in %s retrieval function", "cHRM");
if (white_x != NULL) if (white_x != NULL)
*white_x = info_ptr->int_x_white; *white_x = info_ptr->int_x_white;
if (white_y != NULL) if (white_y != NULL)
@ -462,15 +468,16 @@ png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#endif #endif
#if defined(PNG_gAMA_SUPPORTED) #ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma) png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
{ {
png_debug1(1, "in %s retrieval function", "gAMA");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
&& file_gamma != NULL) && file_gamma != NULL)
{ {
png_debug1(1, "in %s retrieval function", "gAMA");
*file_gamma = (double)info_ptr->gamma; *file_gamma = (double)info_ptr->gamma;
return (PNG_INFO_gAMA); return (PNG_INFO_gAMA);
} }
@ -482,10 +489,11 @@ png_uint_32 PNGAPI
png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
png_fixed_point *int_file_gamma) png_fixed_point *int_file_gamma)
{ {
png_debug1(1, "in %s retrieval function", "gAMA");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
&& int_file_gamma != NULL) && int_file_gamma != NULL)
{ {
png_debug1(1, "in %s retrieval function", "gAMA");
*int_file_gamma = info_ptr->int_gamma; *int_file_gamma = info_ptr->int_gamma;
return (PNG_INFO_gAMA); return (PNG_INFO_gAMA);
} }
@ -494,14 +502,15 @@ png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#endif #endif
#if defined(PNG_sRGB_SUPPORTED) #ifdef PNG_sRGB_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent) png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
{ {
png_debug1(1, "in %s retrieval function", "sRGB");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)
&& file_srgb_intent != NULL) && file_srgb_intent != NULL)
{ {
png_debug1(1, "in %s retrieval function", "sRGB");
*file_srgb_intent = (int)info_ptr->srgb_intent; *file_srgb_intent = (int)info_ptr->srgb_intent;
return (PNG_INFO_sRGB); return (PNG_INFO_sRGB);
} }
@ -509,16 +518,17 @@ png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
} }
#endif #endif
#if defined(PNG_iCCP_SUPPORTED) #ifdef PNG_iCCP_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_iCCP(png_structp png_ptr, png_infop info_ptr, png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
png_charpp name, int *compression_type, png_charpp name, int *compression_type,
png_charpp profile, png_uint_32 *proflen) png_charpp profile, png_uint_32 *proflen)
{ {
png_debug1(1, "in %s retrieval function", "iCCP");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP)
&& name != NULL && profile != NULL && proflen != NULL) && name != NULL && profile != NULL && proflen != NULL)
{ {
png_debug1(1, "in %s retrieval function", "iCCP");
*name = info_ptr->iccp_name; *name = info_ptr->iccp_name;
*profile = info_ptr->iccp_profile; *profile = info_ptr->iccp_profile;
/* Compression_type is a dummy so the API won't have to change /* Compression_type is a dummy so the API won't have to change
@ -532,7 +542,7 @@ png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_sPLT_SUPPORTED) #ifdef PNG_sPLT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_sPLT(png_structp png_ptr, png_infop info_ptr, png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
png_sPLT_tpp spalettes) png_sPLT_tpp spalettes)
@ -546,14 +556,15 @@ png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_hIST_SUPPORTED) #ifdef PNG_hIST_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist) png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
{ {
png_debug1(1, "in %s retrieval function", "hIST");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)
&& hist != NULL) && hist != NULL)
{ {
png_debug1(1, "in %s retrieval function", "hIST");
*hist = info_ptr->hist; *hist = info_ptr->hist;
return (PNG_INFO_hIST); return (PNG_INFO_hIST);
} }
@ -566,6 +577,7 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
png_uint_32 *width, png_uint_32 *height, int *bit_depth, png_uint_32 *width, png_uint_32 *height, int *bit_depth,
int *color_type, int *interlace_type, int *compression_type, int *color_type, int *interlace_type, int *compression_type,
int *filter_type) int *filter_type)
{ {
png_debug1(1, "in %s retrieval function", "IHDR"); png_debug1(1, "in %s retrieval function", "IHDR");
@ -599,15 +611,16 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
return (1); return (1);
} }
#if defined(PNG_oFFs_SUPPORTED) #ifdef PNG_oFFs_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_oFFs(png_structp png_ptr, png_infop info_ptr, png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type) png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
{ {
png_debug1(1, "in %s retrieval function", "oFFs");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)
&& offset_x != NULL && offset_y != NULL && unit_type != NULL) && offset_x != NULL && offset_y != NULL && unit_type != NULL)
{ {
png_debug1(1, "in %s retrieval function", "oFFs");
*offset_x = info_ptr->x_offset; *offset_x = info_ptr->x_offset;
*offset_y = info_ptr->y_offset; *offset_y = info_ptr->y_offset;
*unit_type = (int)info_ptr->offset_unit_type; *unit_type = (int)info_ptr->offset_unit_type;
@ -617,17 +630,18 @@ png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_pCAL_SUPPORTED) #ifdef PNG_pCAL_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_pCAL(png_structp png_ptr, png_infop info_ptr, 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, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
png_charp *units, png_charpp *params) png_charp *units, png_charpp *params)
{ {
png_debug1(1, "in %s retrieval function", "pCAL");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL)
&& purpose != NULL && X0 != NULL && X1 != NULL && type != NULL && && purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
nparams != NULL && units != NULL && params != NULL) nparams != NULL && units != NULL && params != NULL)
{ {
png_debug1(1, "in %s retrieval function", "pCAL");
*purpose = info_ptr->pcal_purpose; *purpose = info_ptr->pcal_purpose;
*X0 = info_ptr->pcal_X0; *X0 = info_ptr->pcal_X0;
*X1 = info_ptr->pcal_X1; *X1 = info_ptr->pcal_X1;
@ -641,7 +655,7 @@ png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_sCAL_SUPPORTED) #ifdef PNG_sCAL_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_sCAL(png_structp png_ptr, png_infop info_ptr, png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
@ -677,18 +691,18 @@ png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#endif #endif
#if defined(PNG_pHYs_SUPPORTED) #ifdef PNG_pHYs_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_pHYs(png_structp png_ptr, png_infop info_ptr, png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type) png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
{ {
png_uint_32 retval = 0; png_uint_32 retval = 0;
png_debug1(1, "in %s retrieval function", "pHYs");
if (png_ptr != NULL && info_ptr != NULL && if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_pHYs)) (info_ptr->valid & PNG_INFO_pHYs))
{ {
png_debug1(1, "in %s retrieval function", "pHYs");
if (res_x != NULL) if (res_x != NULL)
{ {
*res_x = info_ptr->x_pixels_per_unit; *res_x = info_ptr->x_pixels_per_unit;
@ -715,10 +729,11 @@ png_uint_32 PNGAPI
png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette, png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
int *num_palette) int *num_palette)
{ {
png_debug1(1, "in %s retrieval function", "PLTE");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE)
&& palette != NULL) && palette != NULL)
{ {
png_debug1(1, "in %s retrieval function", "PLTE");
*palette = info_ptr->palette; *palette = info_ptr->palette;
*num_palette = info_ptr->num_palette; *num_palette = info_ptr->num_palette;
png_debug1(3, "num_palette = %d", *num_palette); png_debug1(3, "num_palette = %d", *num_palette);
@ -727,14 +742,15 @@ png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
return (0); return (0);
} }
#if defined(PNG_sBIT_SUPPORTED) #ifdef PNG_sBIT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit) png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
{ {
png_debug1(1, "in %s retrieval function", "sBIT");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT)
&& sig_bit != NULL) && sig_bit != NULL)
{ {
png_debug1(1, "in %s retrieval function", "sBIT");
*sig_bit = &(info_ptr->sig_bit); *sig_bit = &(info_ptr->sig_bit);
return (PNG_INFO_sBIT); return (PNG_INFO_sBIT);
} }
@ -742,7 +758,7 @@ png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
} }
#endif #endif
#if defined(PNG_TEXT_SUPPORTED) #ifdef PNG_TEXT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr, png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
int *num_text) int *num_text)
@ -767,14 +783,15 @@ png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
} }
#endif #endif
#if defined(PNG_tIME_SUPPORTED) #ifdef PNG_tIME_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time) png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
{ {
png_debug1(1, "in %s retrieval function", "tIME");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME)
&& mod_time != NULL) && mod_time != NULL)
{ {
png_debug1(1, "in %s retrieval function", "tIME");
*mod_time = &(info_ptr->mod_time); *mod_time = &(info_ptr->mod_time);
return (PNG_INFO_tIME); return (PNG_INFO_tIME);
} }
@ -782,7 +799,7 @@ png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
} }
#endif #endif
#if defined(PNG_tRNS_SUPPORTED) #ifdef PNG_tRNS_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_tRNS(png_structp png_ptr, png_infop info_ptr, png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
png_bytep *trans, int *num_trans, png_color_16p *trans_values) png_bytep *trans, int *num_trans, png_color_16p *trans_values)
@ -791,6 +808,7 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS)) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
{ {
png_debug1(1, "in %s retrieval function", "tRNS"); png_debug1(1, "in %s retrieval function", "tRNS");
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
{ {
if (trans != NULL) if (trans != NULL)
@ -823,7 +841,7 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr, png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
png_unknown_chunkpp unknowns) png_unknown_chunkpp unknowns)
@ -837,7 +855,7 @@ png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
png_byte PNGAPI png_byte PNGAPI
png_get_rgb_to_gray_status (png_structp png_ptr) png_get_rgb_to_gray_status (png_structp png_ptr)
{ {
@ -845,7 +863,7 @@ png_get_rgb_to_gray_status (png_structp png_ptr)
} }
#endif #endif
#if defined(PNG_USER_CHUNKS_SUPPORTED) #ifdef PNG_USER_CHUNKS_SUPPORTED
png_voidp PNGAPI png_voidp PNGAPI
png_get_user_chunk_ptr(png_structp png_ptr) png_get_user_chunk_ptr(png_structp png_ptr)
{ {

View File

@ -1,7 +1,7 @@
/* pngrio.c - functions for data input /* pngrio.c - functions for data input
* *
* Last changed in libpng 1.2.37 [June 4, 2009] * Last changed in libpng 1.2.41 [October 5, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -20,7 +20,7 @@
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
#if defined(PNG_READ_SUPPORTED) #ifdef PNG_READ_SUPPORTED
/* Read the data from whatever input you are using. The default routine /* Read the data from whatever input you are using. The default routine
* reads from a file pointer. Note that this routine sometimes gets called * reads from a file pointer. Note that this routine sometimes gets called
@ -32,13 +32,14 @@ void /* PRIVATE */
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length) png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
png_debug1(4, "reading %d bytes", (int)length); png_debug1(4, "reading %d bytes", (int)length);
if (png_ptr->read_data_fn != NULL) if (png_ptr->read_data_fn != NULL)
(*(png_ptr->read_data_fn))(png_ptr, data, length); (*(png_ptr->read_data_fn))(png_ptr, data, length);
else else
png_error(png_ptr, "Call to NULL read function"); png_error(png_ptr, "Call to NULL read function");
} }
#if !defined(PNG_NO_STDIO) #ifndef PNG_NO_STDIO
/* This is the function that does the actual reading of data. If you are /* This is the function that does the actual reading of data. If you are
* not reading from a standard C stream, you should create a replacement * not reading from a standard C stream, you should create a replacement
* read_data function and use it at run time with png_set_read_fn(), rather * read_data function and use it at run time with png_set_read_fn(), rather
@ -55,7 +56,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
/* fread() returns 0 on error, so it is OK to store this in a png_size_t /* fread() returns 0 on error, so it is OK to store this in a png_size_t
* instead of an int, which is what fread() actually returns. * instead of an int, which is what fread() actually returns.
*/ */
#if defined(_WIN32_WCE) #ifdef _WIN32_WCE
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) ) if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
check = 0; check = 0;
#else #else
@ -89,7 +90,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr); io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
if ((png_bytep)n_data == data) if ((png_bytep)n_data == data)
{ {
#if defined(_WIN32_WCE) #ifdef _WIN32_WCE
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) ) if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
check = 0; check = 0;
#else #else
@ -105,7 +106,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
do do
{ {
read = MIN(NEAR_BUF_SIZE, remaining); read = MIN(NEAR_BUF_SIZE, remaining);
#if defined(_WIN32_WCE) #ifdef _WIN32_WCE
if ( !ReadFile((HANDLE)(io_ptr), buf, read, &err, NULL) ) if ( !ReadFile((HANDLE)(io_ptr), buf, read, &err, NULL) )
err = 0; err = 0;
#else #else
@ -151,7 +152,7 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
return; return;
png_ptr->io_ptr = io_ptr; png_ptr->io_ptr = io_ptr;
#if !defined(PNG_NO_STDIO) #ifndef PNG_NO_STDIO
if (read_data_fn != NULL) if (read_data_fn != NULL)
png_ptr->read_data_fn = read_data_fn; png_ptr->read_data_fn = read_data_fn;
else else
@ -170,7 +171,7 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
"same structure. Resetting write_data_fn to NULL."); "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; png_ptr->output_flush_fn = NULL;
#endif #endif
} }

View File

@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct /* pngset.c - storage of image information into info struct
* *
* Last changed in libpng 1.2.41 [October 2, 2009] * Last changed in libpng 1.2.41 [October 5, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -20,7 +20,7 @@
#include "png.h" #include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#if defined(PNG_bKGD_SUPPORTED) #ifdef PNG_bKGD_SUPPORTED
void PNGAPI void PNGAPI
png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background) 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 #endif
#if defined(PNG_cHRM_SUPPORTED) #ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI void PNGAPI
png_set_cHRM(png_structp png_ptr, png_infop info_ptr, 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) if (png_ptr == NULL || info_ptr == NULL)
return; return;
#if !defined(PNG_NO_CHECK_cHRM) #ifndef PNG_NO_CHECK_cHRM
if (png_check_cHRM_fixed(png_ptr, if (png_check_cHRM_fixed(png_ptr,
white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y)) white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y))
#endif #endif
@ -109,7 +109,7 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
#endif /* PNG_FIXED_POINT_SUPPORTED */ #endif /* PNG_FIXED_POINT_SUPPORTED */
#endif /* PNG_cHRM_SUPPORTED */ #endif /* PNG_cHRM_SUPPORTED */
#if defined(PNG_gAMA_SUPPORTED) #ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI void PNGAPI
png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma) 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 #endif
#if defined(PNG_hIST_SUPPORTED) #ifdef PNG_hIST_SUPPORTED
void PNGAPI void PNGAPI
png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist) png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
{ {
@ -267,7 +267,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width); info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
} }
#if defined(PNG_oFFs_SUPPORTED) #ifdef PNG_oFFs_SUPPORTED
void PNGAPI void PNGAPI
png_set_oFFs(png_structp png_ptr, png_infop info_ptr, png_set_oFFs(png_structp png_ptr, png_infop info_ptr,
png_int_32 offset_x, png_int_32 offset_y, int unit_type) png_int_32 offset_x, png_int_32 offset_y, int unit_type)
@ -284,7 +284,7 @@ png_set_oFFs(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_pCAL_SUPPORTED) #ifdef PNG_pCAL_SUPPORTED
void PNGAPI void PNGAPI
png_set_pCAL(png_structp png_ptr, png_infop info_ptr, 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, png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams,
@ -423,7 +423,7 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#endif #endif
#if defined(PNG_pHYs_SUPPORTED) #ifdef PNG_pHYs_SUPPORTED
void PNGAPI void PNGAPI
png_set_pHYs(png_structp png_ptr, png_infop info_ptr, png_set_pHYs(png_structp png_ptr, png_infop info_ptr,
png_uint_32 res_x, png_uint_32 res_y, int unit_type) png_uint_32 res_x, png_uint_32 res_y, int unit_type)
@ -491,7 +491,7 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
info_ptr->valid |= PNG_INFO_PLTE; info_ptr->valid |= PNG_INFO_PLTE;
} }
#if defined(PNG_sBIT_SUPPORTED) #ifdef PNG_sBIT_SUPPORTED
void PNGAPI void PNGAPI
png_set_sBIT(png_structp png_ptr, png_infop info_ptr, png_set_sBIT(png_structp png_ptr, png_infop info_ptr,
png_color_8p sig_bit) png_color_8p sig_bit)
@ -506,7 +506,7 @@ png_set_sBIT(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_sRGB_SUPPORTED) #ifdef PNG_sRGB_SUPPORTED
void PNGAPI void PNGAPI
png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int intent) png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int intent)
{ {
@ -523,7 +523,7 @@ void PNGAPI
png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr, png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
int intent) int intent)
{ {
#if defined(PNG_gAMA_SUPPORTED) #ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
float file_gamma; float file_gamma;
#endif #endif
@ -531,7 +531,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
png_fixed_point int_file_gamma; png_fixed_point int_file_gamma;
#endif #endif
#endif #endif
#if defined(PNG_cHRM_SUPPORTED) #ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y; float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y;
#endif #endif
@ -545,7 +545,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
png_set_sRGB(png_ptr, info_ptr, intent); png_set_sRGB(png_ptr, info_ptr, intent);
#if defined(PNG_gAMA_SUPPORTED) #ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
file_gamma = (float).45455; file_gamma = (float).45455;
png_set_gAMA(png_ptr, info_ptr, file_gamma); png_set_gAMA(png_ptr, info_ptr, file_gamma);
@ -556,7 +556,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#endif #endif
#if defined(PNG_cHRM_SUPPORTED) #ifdef PNG_cHRM_SUPPORTED
int_white_x = 31270L; int_white_x = 31270L;
int_white_y = 32900L; int_white_y = 32900L;
int_red_x = 64000L; int_red_x = 64000L;
@ -591,7 +591,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
#endif /* sRGB */ #endif /* sRGB */
#if defined(PNG_iCCP_SUPPORTED) #ifdef PNG_iCCP_SUPPORTED
void PNGAPI void PNGAPI
png_set_iCCP(png_structp png_ptr, png_infop info_ptr, png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
png_charp name, int compression_type, png_charp name, int compression_type,
@ -639,7 +639,7 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_TEXT_SUPPORTED) #ifdef PNG_TEXT_SUPPORTED
void PNGAPI void PNGAPI
png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
int num_text) int num_text)
@ -812,7 +812,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
} }
#endif #endif
#if defined(PNG_tIME_SUPPORTED) #ifdef PNG_tIME_SUPPORTED
void PNGAPI void PNGAPI
png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time) png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time)
{ {
@ -827,7 +827,7 @@ png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time)
} }
#endif #endif
#if defined(PNG_tRNS_SUPPORTED) #ifdef PNG_tRNS_SUPPORTED
void PNGAPI void PNGAPI
png_set_tRNS(png_structp png_ptr, png_infop info_ptr, png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
png_bytep trans, int num_trans, png_color_16p trans_values) png_bytep trans, int num_trans, png_color_16p trans_values)
@ -886,7 +886,7 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_sPLT_SUPPORTED) #ifdef PNG_sPLT_SUPPORTED
void PNGAPI void PNGAPI
png_set_sPLT(png_structp png_ptr, png_set_sPLT(png_structp png_ptr,
png_infop info_ptr, png_sPLT_tp entries, int nentries) png_infop info_ptr, png_sPLT_tp entries, int nentries)
@ -1050,7 +1050,7 @@ png_permit_empty_plte (png_structp png_ptr, int empty_plte_permitted)
#endif #endif
#endif #endif
#if defined(PNG_MNG_FEATURES_SUPPORTED) #ifdef PNG_MNG_FEATURES_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features) png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features)
{ {
@ -1064,7 +1064,7 @@ png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features)
} }
#endif #endif
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
void PNGAPI void PNGAPI
png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
chunk_list, int num_chunks) chunk_list, int num_chunks)
@ -1111,7 +1111,7 @@ png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
} }
#endif #endif
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED) #ifdef PNG_READ_USER_CHUNKS_SUPPORTED
void PNGAPI void PNGAPI
png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr, png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr,
png_user_chunk_ptr read_user_chunk_fn) png_user_chunk_ptr read_user_chunk_fn)
@ -1126,7 +1126,7 @@ png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr,
} }
#endif #endif
#if defined(PNG_INFO_IMAGE_SUPPORTED) #ifdef PNG_INFO_IMAGE_SUPPORTED
void PNGAPI void PNGAPI
png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers) png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)
{ {

View File

@ -1,7 +1,7 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers) /* pngtrans.c - transforms the data in a row (used by both readers and writers)
* *
* Last changed in libpng 1.2.36 [May 14, 2009] * Last changed in libpng 1.2.41 [October 5, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -21,6 +21,7 @@ void PNGAPI
png_set_bgr(png_structp png_ptr) png_set_bgr(png_structp png_ptr)
{ {
png_debug(1, "in png_set_bgr"); png_debug(1, "in png_set_bgr");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_ptr->transformations |= PNG_BGR; png_ptr->transformations |= PNG_BGR;
@ -33,6 +34,7 @@ void PNGAPI
png_set_swap(png_structp png_ptr) png_set_swap(png_structp png_ptr)
{ {
png_debug(1, "in png_set_swap"); png_debug(1, "in png_set_swap");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
if (png_ptr->bit_depth == 16) if (png_ptr->bit_depth == 16)
@ -46,6 +48,7 @@ void PNGAPI
png_set_packing(png_structp png_ptr) png_set_packing(png_structp png_ptr)
{ {
png_debug(1, "in png_set_packing"); png_debug(1, "in png_set_packing");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
if (png_ptr->bit_depth < 8) if (png_ptr->bit_depth < 8)
@ -62,6 +65,7 @@ void PNGAPI
png_set_packswap(png_structp png_ptr) png_set_packswap(png_structp png_ptr)
{ {
png_debug(1, "in png_set_packswap"); png_debug(1, "in png_set_packswap");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
if (png_ptr->bit_depth < 8) if (png_ptr->bit_depth < 8)
@ -74,6 +78,7 @@ void PNGAPI
png_set_shift(png_structp png_ptr, png_color_8p true_bits) png_set_shift(png_structp png_ptr, png_color_8p true_bits)
{ {
png_debug(1, "in png_set_shift"); png_debug(1, "in png_set_shift");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_ptr->transformations |= PNG_SHIFT; png_ptr->transformations |= PNG_SHIFT;
@ -87,6 +92,7 @@ int PNGAPI
png_set_interlace_handling(png_structp png_ptr) png_set_interlace_handling(png_structp png_ptr)
{ {
png_debug(1, "in png_set_interlace handling"); png_debug(1, "in png_set_interlace handling");
if (png_ptr && png_ptr->interlaced) if (png_ptr && png_ptr->interlaced)
{ {
png_ptr->transformations |= PNG_INTERLACE; png_ptr->transformations |= PNG_INTERLACE;
@ -107,10 +113,15 @@ void PNGAPI
png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc) png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
{ {
png_debug(1, "in png_set_filler"); png_debug(1, "in png_set_filler");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_ptr->transformations |= PNG_FILLER; png_ptr->transformations |= PNG_FILLER;
#ifdef PNG_LEGACY_SUPPORTED
png_ptr->filler = (png_byte)filler; png_ptr->filler = (png_byte)filler;
#else
png_ptr->filler = (png_uint_16)filler;
#endif
if (filler_loc == PNG_FILLER_AFTER) if (filler_loc == PNG_FILLER_AFTER)
png_ptr->flags |= PNG_FLAG_FILLER_AFTER; png_ptr->flags |= PNG_FLAG_FILLER_AFTER;
else else
@ -135,12 +146,13 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
} }
} }
#if !defined(PNG_1_0_X) #ifndef PNG_1_0_X
/* Added to libpng-1.2.7 */ /* Added to libpng-1.2.7 */
void PNGAPI void PNGAPI
png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc) png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
{ {
png_debug(1, "in png_set_add_alpha"); png_debug(1, "in png_set_add_alpha");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_set_filler(png_ptr, filler, filler_loc); png_set_filler(png_ptr, filler, filler_loc);
@ -156,6 +168,7 @@ void PNGAPI
png_set_swap_alpha(png_structp png_ptr) png_set_swap_alpha(png_structp png_ptr)
{ {
png_debug(1, "in png_set_swap_alpha"); png_debug(1, "in png_set_swap_alpha");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_ptr->transformations |= PNG_SWAP_ALPHA; png_ptr->transformations |= PNG_SWAP_ALPHA;
@ -168,6 +181,7 @@ void PNGAPI
png_set_invert_alpha(png_structp png_ptr) png_set_invert_alpha(png_structp png_ptr)
{ {
png_debug(1, "in png_set_invert_alpha"); png_debug(1, "in png_set_invert_alpha");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_ptr->transformations |= PNG_INVERT_ALPHA; png_ptr->transformations |= PNG_INVERT_ALPHA;
@ -179,6 +193,7 @@ void PNGAPI
png_set_invert_mono(png_structp png_ptr) png_set_invert_mono(png_structp png_ptr)
{ {
png_debug(1, "in png_set_invert_mono"); png_debug(1, "in png_set_invert_mono");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_ptr->transformations |= PNG_INVERT_MONO; png_ptr->transformations |= PNG_INVERT_MONO;
@ -189,10 +204,11 @@ void /* PRIVATE */
png_do_invert(png_row_infop row_info, png_bytep row) png_do_invert(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_invert"); png_debug(1, "in png_do_invert");
/* This test removed from libpng version 1.0.13 and 1.2.0: /* This test removed from libpng version 1.0.13 and 1.2.0:
* if (row_info->bit_depth == 1 && * if (row_info->bit_depth == 1 &&
*/ */
#if defined(PNG_USELESS_TESTS_SUPPORTED) #ifdef PNG_USELESS_TESTS_SUPPORTED
if (row == NULL || row_info == NULL) if (row == NULL || row_info == NULL)
return; return;
#endif #endif
@ -244,8 +260,9 @@ void /* PRIVATE */
png_do_swap(png_row_infop row_info, png_bytep row) png_do_swap(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_swap"); png_debug(1, "in png_do_swap");
if ( if (
#if defined(PNG_USELESS_TESTS_SUPPORTED) #ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&
#endif #endif
row_info->bit_depth == 16) row_info->bit_depth == 16)
@ -375,8 +392,9 @@ void /* PRIVATE */
png_do_packswap(png_row_infop row_info, png_bytep row) png_do_packswap(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_packswap"); png_debug(1, "in png_do_packswap");
if ( if (
#if defined(PNG_USELESS_TESTS_SUPPORTED) #ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&
#endif #endif
row_info->bit_depth < 8) row_info->bit_depth < 8)
@ -407,7 +425,8 @@ void /* PRIVATE */
png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags) png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
{ {
png_debug(1, "in png_do_strip_filler"); png_debug(1, "in png_do_strip_filler");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL) if (row != NULL && row_info != NULL)
#endif #endif
{ {
@ -565,8 +584,9 @@ void /* PRIVATE */
png_do_bgr(png_row_infop row_info, png_bytep row) png_do_bgr(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_bgr"); png_debug(1, "in png_do_bgr");
if ( if (
#if defined(PNG_USELESS_TESTS_SUPPORTED) #ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&
#endif #endif
(row_info->color_type & PNG_COLOR_MASK_COLOR)) (row_info->color_type & PNG_COLOR_MASK_COLOR))
@ -644,9 +664,10 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp
user_transform_ptr, int user_transform_depth, int user_transform_channels) user_transform_ptr, int user_transform_depth, int user_transform_channels)
{ {
png_debug(1, "in png_set_user_transform_info"); png_debug(1, "in png_set_user_transform_info");
if (png_ptr == NULL) if (png_ptr == NULL)
return; 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_ptr = user_transform_ptr;
png_ptr->user_transform_depth = (png_byte)user_transform_depth; png_ptr->user_transform_depth = (png_byte)user_transform_depth;
png_ptr->user_transform_channels = (png_byte)user_transform_channels; png_ptr->user_transform_channels = (png_byte)user_transform_channels;
@ -668,7 +689,7 @@ png_get_user_transform_ptr(png_structp png_ptr)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return (NULL); return (NULL);
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) #ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
return ((png_voidp)png_ptr->user_transform_ptr); return ((png_voidp)png_ptr->user_transform_ptr);
#else #else
return (NULL); return (NULL);

View File

@ -1,7 +1,7 @@
/* pngwio.c - functions for data output /* pngwio.c - functions for data output
* *
* Last changed in libpng 1.2.37 [June 4, 2009] * Last changed in libpng 1.2.41 [October 5, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -38,7 +38,7 @@ png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_error(png_ptr, "Call to NULL write function"); png_error(png_ptr, "Call to NULL write function");
} }
#if !defined(PNG_NO_STDIO) #ifndef PNG_NO_STDIO
/* This is the function that does the actual writing of data. If you are /* This is the function that does the actual writing of data. If you are
* not writing to a standard C stream, you should create a replacement * not writing to a standard C stream, you should create a replacement
* write_data function and use it at run time with png_set_write_fn(), rather * write_data function and use it at run time with png_set_write_fn(), rather
@ -52,7 +52,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
#if defined(_WIN32_WCE) #ifdef _WIN32_WCE
if ( !WriteFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) ) if ( !WriteFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
check = 0; check = 0;
#else #else
@ -84,7 +84,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr); io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
if ((png_bytep)near_data == data) if ((png_bytep)near_data == data)
{ {
#if defined(_WIN32_WCE) #ifdef _WIN32_WCE
if ( !WriteFile(io_ptr, near_data, length, &check, NULL) ) if ( !WriteFile(io_ptr, near_data, length, &check, NULL) )
check = 0; check = 0;
#else #else
@ -101,7 +101,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
written = MIN(NEAR_BUF_SIZE, remaining); written = MIN(NEAR_BUF_SIZE, remaining);
png_memcpy(buf, data, written); /* Copy far buffer to near buffer */ png_memcpy(buf, data, written); /* Copy far buffer to near buffer */
#if defined(_WIN32_WCE) #ifdef _WIN32_WCE
if ( !WriteFile(io_ptr, buf, written, &err, NULL) ) if ( !WriteFile(io_ptr, buf, written, &err, NULL) )
err = 0; err = 0;
#else #else
@ -129,7 +129,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
* to disk). After png_flush is called, there should be no data pending * to disk). After png_flush is called, there should be no data pending
* writing in any buffers. * writing in any buffers.
*/ */
#if defined(PNG_WRITE_FLUSH_SUPPORTED) #ifdef PNG_WRITE_FLUSH_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_flush(png_structp png_ptr) png_flush(png_structp png_ptr)
{ {
@ -137,16 +137,16 @@ png_flush(png_structp png_ptr)
(*(png_ptr->output_flush_fn))(png_ptr); (*(png_ptr->output_flush_fn))(png_ptr);
} }
#if !defined(PNG_NO_STDIO) #ifndef PNG_NO_STDIO
void PNGAPI void PNGAPI
png_default_flush(png_structp png_ptr) png_default_flush(png_structp png_ptr)
{ {
#if !defined(_WIN32_WCE) #ifndef _WIN32_WCE
png_FILE_p io_ptr; png_FILE_p io_ptr;
#endif #endif
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
#if !defined(_WIN32_WCE) #ifndef _WIN32_WCE
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr)); io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
fflush(io_ptr); fflush(io_ptr);
#endif #endif
@ -192,7 +192,7 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
png_ptr->io_ptr = io_ptr; png_ptr->io_ptr = io_ptr;
#if !defined(PNG_NO_STDIO) #ifndef PNG_NO_STDIO
if (write_data_fn != NULL) if (write_data_fn != NULL)
png_ptr->write_data_fn = write_data_fn; png_ptr->write_data_fn = write_data_fn;
@ -202,8 +202,8 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
png_ptr->write_data_fn = write_data_fn; png_ptr->write_data_fn = write_data_fn;
#endif #endif
#if defined(PNG_WRITE_FLUSH_SUPPORTED) #ifdef PNG_WRITE_FLUSH_SUPPORTED
#if !defined(PNG_NO_STDIO) #ifndef PNG_NO_STDIO
if (output_flush_fn != NULL) if (output_flush_fn != NULL)
png_ptr->output_flush_fn = output_flush_fn; png_ptr->output_flush_fn = output_flush_fn;
@ -225,8 +225,8 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
} }
} }
#if defined(USE_FAR_KEYWORD) #ifdef USE_FAR_KEYWORD
#if defined(_MSC_VER) #ifdef _MSC_VER
void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check) void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
{ {
void *near_ptr; void *near_ptr;

View File

@ -1,7 +1,7 @@
/* pngwtran.c - transforms the data in a row for PNG writers /* pngwtran.c - transforms the data in a row for PNG writers
* *
* Last changed in libpng 1.2.37 [June 4, 2009] * Last changed in libpng 1.2.41 [October 5, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (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) if (png_ptr == NULL)
return; return;
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
if (png_ptr->transformations & PNG_USER_TRANSFORM) if (png_ptr->transformations & PNG_USER_TRANSFORM)
if (png_ptr->write_user_transform_fn != NULL) if (png_ptr->write_user_transform_fn != NULL)
(*(png_ptr->write_user_transform_fn)) /* User write transform function */ (*(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_byte pixel_depth; bits per pixel (depth*channels) */
png_ptr->row_buf + 1); /* start of pixel data for row */ png_ptr->row_buf + 1); /* start of pixel data for row */
#endif #endif
#if defined(PNG_WRITE_FILLER_SUPPORTED) #ifdef PNG_WRITE_FILLER_SUPPORTED
if (png_ptr->transformations & PNG_FILLER) if (png_ptr->transformations & PNG_FILLER)
png_do_strip_filler(&(png_ptr->row_info), png_ptr->row_buf + 1, png_do_strip_filler(&(png_ptr->row_info), png_ptr->row_buf + 1,
png_ptr->flags); png_ptr->flags);
#endif #endif
#if defined(PNG_WRITE_PACKSWAP_SUPPORTED) #ifdef PNG_WRITE_PACKSWAP_SUPPORTED
if (png_ptr->transformations & PNG_PACKSWAP) if (png_ptr->transformations & PNG_PACKSWAP)
png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1); png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif #endif
#if defined(PNG_WRITE_PACK_SUPPORTED) #ifdef PNG_WRITE_PACK_SUPPORTED
if (png_ptr->transformations & PNG_PACK) if (png_ptr->transformations & PNG_PACK)
png_do_pack(&(png_ptr->row_info), png_ptr->row_buf + 1, png_do_pack(&(png_ptr->row_info), png_ptr->row_buf + 1,
(png_uint_32)png_ptr->bit_depth); (png_uint_32)png_ptr->bit_depth);
#endif #endif
#if defined(PNG_WRITE_SWAP_SUPPORTED) #ifdef PNG_WRITE_SWAP_SUPPORTED
if (png_ptr->transformations & PNG_SWAP_BYTES) if (png_ptr->transformations & PNG_SWAP_BYTES)
png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1); png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif #endif
#if defined(PNG_WRITE_SHIFT_SUPPORTED) #ifdef PNG_WRITE_SHIFT_SUPPORTED
if (png_ptr->transformations & PNG_SHIFT) if (png_ptr->transformations & PNG_SHIFT)
png_do_shift(&(png_ptr->row_info), png_ptr->row_buf + 1, png_do_shift(&(png_ptr->row_info), png_ptr->row_buf + 1,
&(png_ptr->shift)); &(png_ptr->shift));
#endif #endif
#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) #ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
if (png_ptr->transformations & PNG_SWAP_ALPHA) if (png_ptr->transformations & PNG_SWAP_ALPHA)
png_do_write_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1); png_do_write_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif #endif
#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) #ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
if (png_ptr->transformations & PNG_INVERT_ALPHA) if (png_ptr->transformations & PNG_INVERT_ALPHA)
png_do_write_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1); png_do_write_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif #endif
#if defined(PNG_WRITE_BGR_SUPPORTED) #ifdef PNG_WRITE_BGR_SUPPORTED
if (png_ptr->transformations & PNG_BGR) if (png_ptr->transformations & PNG_BGR)
png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1); png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif #endif
#if defined(PNG_WRITE_INVERT_SUPPORTED) #ifdef PNG_WRITE_INVERT_SUPPORTED
if (png_ptr->transformations & PNG_INVERT_MONO) if (png_ptr->transformations & PNG_INVERT_MONO)
png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1); png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif #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 /* 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 * row_info bit depth should be 8 (one pixel per byte). The channels
* should be 1 (this only happens on grayscale and paletted images). * should be 1 (this only happens on grayscale and paletted images).
@ -90,8 +90,9 @@ void /* PRIVATE */
png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth) png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
{ {
png_debug(1, "in png_do_pack"); png_debug(1, "in png_do_pack");
if (row_info->bit_depth == 8 && if (row_info->bit_depth == 8 &&
#if defined(PNG_USELESS_TESTS_SUPPORTED) #ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&
#endif #endif
row_info->channels == 1) row_info->channels == 1)
@ -204,7 +205,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
} }
#endif #endif
#if defined(PNG_WRITE_SHIFT_SUPPORTED) #ifdef PNG_WRITE_SHIFT_SUPPORTED
/* Shift pixel values to take advantage of whole range. Pass the /* Shift pixel values to take advantage of whole range. Pass the
* true number of bits in bit_depth. The row should be packed * 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 * according to row_info->bit_depth. Thus, if you had a row of
@ -216,7 +217,8 @@ void /* PRIVATE */
png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth) png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
{ {
png_debug(1, "in png_do_shift"); png_debug(1, "in png_do_shift");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL && if (row != NULL && row_info != NULL &&
#else #else
if ( if (
@ -335,12 +337,13 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
} }
#endif #endif
#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) #ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_do_write_swap_alpha(png_row_infop row_info, png_bytep row) png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_write_swap_alpha"); png_debug(1, "in png_do_write_swap_alpha");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL) if (row != NULL && row_info != NULL)
#endif #endif
{ {
@ -423,12 +426,13 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
} }
#endif #endif
#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) #ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_do_write_invert_alpha(png_row_infop row_info, png_bytep row) png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_write_invert_alpha"); png_debug(1, "in png_do_write_invert_alpha");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL) if (row != NULL && row_info != NULL)
#endif #endif
{ {
@ -512,14 +516,15 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
} }
#endif #endif
#if defined(PNG_MNG_FEATURES_SUPPORTED) #ifdef PNG_MNG_FEATURES_SUPPORTED
/* Undoes intrapixel differencing */ /* Undoes intrapixel differencing */
void /* PRIVATE */ void /* PRIVATE */
png_do_write_intrapixel(png_row_infop row_info, png_bytep row) png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_write_intrapixel"); png_debug(1, "in png_do_write_intrapixel");
if ( if (
#if defined(PNG_USELESS_TESTS_SUPPORTED) #ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&
#endif #endif
(row_info->color_type & PNG_COLOR_MASK_COLOR)) (row_info->color_type & PNG_COLOR_MASK_COLOR))