Imported from libpng-1.4.0beta20.tar

This commit is contained in:
Glenn Randers-Pehrson
2008-07-10 09:13:13 -05:00
parent a7dbcba1e8
commit 145f5c8164
62 changed files with 2945 additions and 11047 deletions

View File

@@ -1,24 +1,24 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
* Last changed in libpng 1.4.0 May 15, 2007
* Last changed in libpng 1.4.0 [July 10, 2008]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
* Copyright (c) 1998-2008 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.)
*/
#include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#include "pngpriv.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
/* turn on BGR-to-RGB mapping */
void PNGAPI
png_set_bgr(png_structp png_ptr)
{
png_debug(1, "in png_set_bgr\n");
if(png_ptr == NULL) return;
if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_BGR;
}
#endif
@@ -29,7 +29,7 @@ void PNGAPI
png_set_swap(png_structp png_ptr)
{
png_debug(1, "in png_set_swap\n");
if(png_ptr == NULL) return;
if (png_ptr == NULL) return;
if (png_ptr->bit_depth == 16)
png_ptr->transformations |= PNG_SWAP_BYTES;
}
@@ -41,7 +41,7 @@ void PNGAPI
png_set_packing(png_structp png_ptr)
{
png_debug(1, "in png_set_packing\n");
if(png_ptr == NULL) return;
if (png_ptr == NULL) return;
if (png_ptr->bit_depth < 8)
{
png_ptr->transformations |= PNG_PACK;
@@ -56,7 +56,7 @@ void PNGAPI
png_set_packswap(png_structp png_ptr)
{
png_debug(1, "in png_set_packswap\n");
if(png_ptr == NULL) return;
if (png_ptr == NULL) return;
if (png_ptr->bit_depth < 8)
png_ptr->transformations |= PNG_PACKSWAP;
}
@@ -67,7 +67,7 @@ void PNGAPI
png_set_shift(png_structp png_ptr, png_color_8p true_bits)
{
png_debug(1, "in png_set_shift\n");
if(png_ptr == NULL) return;
if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_SHIFT;
png_ptr->shift = *true_bits;
}
@@ -99,7 +99,7 @@ void PNGAPI
png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
{
png_debug(1, "in png_set_filler\n");
if(png_ptr == NULL) return;
if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_FILLER;
png_ptr->filler = (png_byte)filler;
if (filler_loc == PNG_FILLER_AFTER)
@@ -126,15 +126,17 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
}
}
#if !defined(PNG_1_0_X)
/* Added to libpng-1.2.7 */
void PNGAPI
png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
{
png_debug(1, "in png_set_add_alpha\n");
if(png_ptr == NULL) return;
if (png_ptr == NULL) return;
png_set_filler(png_ptr, filler, filler_loc);
png_ptr->transformations |= PNG_ADD_ALPHA;
}
#endif
#endif
@@ -144,7 +146,7 @@ void PNGAPI
png_set_swap_alpha(png_structp png_ptr)
{
png_debug(1, "in png_set_swap_alpha\n");
if(png_ptr == NULL) return;
if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_SWAP_ALPHA;
}
#endif
@@ -155,7 +157,7 @@ void PNGAPI
png_set_invert_alpha(png_structp png_ptr)
{
png_debug(1, "in png_set_invert_alpha\n");
if(png_ptr == NULL) return;
if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_INVERT_ALPHA;
}
#endif
@@ -165,7 +167,7 @@ void PNGAPI
png_set_invert_mono(png_structp png_ptr)
{
png_debug(1, "in png_set_invert_mono\n");
if(png_ptr == NULL) return;
if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_INVERT_MONO;
}
@@ -629,13 +631,13 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp
user_transform_ptr, int user_transform_depth, int user_transform_channels)
{
png_debug(1, "in png_set_user_transform_info\n");
if(png_ptr == NULL) return;
if (png_ptr == NULL) return;
#if defined(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;
#else
if(user_transform_ptr || user_transform_depth || user_transform_channels)
if (user_transform_ptr || user_transform_depth || user_transform_channels)
png_warning(png_ptr,
"This version of libpng does not support user transform info");
#endif
@@ -653,7 +655,8 @@ png_get_user_transform_ptr(png_structp png_ptr)
if (png_ptr == NULL) return (NULL);
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
return ((png_voidp)png_ptr->user_transform_ptr);
#endif
#else
return (NULL);
#endif
}
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */