Imported from libpng-1.2.1beta1.tar

This commit is contained in:
Glenn Randers-Pehrson
2001-10-18 20:55:13 -05:00
parent 10781048be
commit 5a0be341ba
55 changed files with 376 additions and 184 deletions

View File

@@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
* libpng 1.2.0 - September 1, 2001
* libpng 1.2.1beta1 - October 19, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -742,7 +742,7 @@ png_init_read_transformations(png_structp png_ptr)
}
#endif
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
#if defined(PNG_READ_BACKGROUND_SUPPORTED) && defined(PNG_READ_GAMMA_SUPPORTED)
png_ptr->background_1 = png_ptr->background;
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
@@ -901,7 +901,7 @@ png_init_read_transformations(png_structp png_ptr)
}
else
/* transformation does not include PNG_BACKGROUND */
#endif
#endif /* PNG_READ_BACKGROUND_SUPPORTED */
if (color_type == PNG_COLOR_TYPE_PALETTE)
{
png_colorp palette = png_ptr->palette;
@@ -919,7 +919,7 @@ png_init_read_transformations(png_structp png_ptr)
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
else
#endif
#endif
#endif /* PNG_READ_GAMMA_SUPPORTED && PNG_FLOATING_POINT_SUPPORTED */
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
/* No GAMMA transformation */
if ((png_ptr->transformations & PNG_BACKGROUND) &&
@@ -952,7 +952,7 @@ png_init_read_transformations(png_structp png_ptr)
}
}
}
#endif
#endif /* PNG_READ_BACKGROUND_SUPPORTED */
#if defined(PNG_READ_SHIFT_SUPPORTED)
if ((png_ptr->transformations & PNG_SHIFT) &&
@@ -977,7 +977,7 @@ png_init_read_transformations(png_structp png_ptr)
png_ptr->palette[i].blue >>= sb;
}
}
#endif
#endif /* PNG_READ_SHIFT_SUPPORTED */
}
#if !defined(PNG_READ_GAMMA_SUPPORTED) && !defined(PNG_READ_SHIFT_SUPPORTED) \
&& !defined(PNG_READ_BACKGROUND_SUPPORTED)
@@ -1227,12 +1227,15 @@ From Andreas Dilger e-mail to png-implement, 26 March 1998:
((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_values), &(png_ptr->background),
&(png_ptr->background_1),
&(png_ptr->trans_values), &(png_ptr->background)
#if defined(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,
png_ptr->gamma_16_from_1, png_ptr->gamma_16_to_1,
png_ptr->gamma_shift);
png_ptr->gamma_shift
#endif
);
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED)
@@ -2545,11 +2548,14 @@ png_correct_palette(png_structp png_ptr, png_colorp palette,
*/
void /* PRIVATE */
png_do_background(png_row_infop row_info, png_bytep row,
png_color_16p trans_values, png_color_16p background,
png_color_16p background_1,
png_color_16p trans_values, png_color_16p background
#if defined(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,
png_uint_16pp gamma_16_to_1, int gamma_shift)
png_uint_16pp gamma_16_to_1, int gamma_shift
#endif
)
{
png_bytep sp, dp;
png_uint_32 i;
@@ -2932,6 +2938,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
{
*dp = *sp;
}
#if defined(PNG_READ_GAMMA_SUPPORTED)
else if (a == 0)
{
*dp = (png_byte)background->gray;
@@ -2940,6 +2947,9 @@ png_do_background(png_row_infop row_info, png_bytep row,
{
png_composite(*dp, *sp, a, background_1->gray);
}
#else
*dp = (png_byte)background->gray;
#endif
}
}
}
@@ -2963,12 +2973,17 @@ 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)
else if (a == 0)
#else
else
#endif
{
/* background is already in screen gamma */
*dp = (png_byte)((background->gray >> 8) & 0xff);
*(dp + 1) = (png_byte)(background->gray & 0xff);
}
#if defined(PNG_READ_GAMMA_SUPPORTED)
else
{
png_uint_16 g, v, w;
@@ -2979,6 +2994,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
*dp = (png_byte)((w >> 8) & 0xff);
*(dp + 1) = (png_byte)(w & 0xff);
}
#endif
}
}
else
@@ -2993,11 +3009,16 @@ png_do_background(png_row_infop row_info, png_bytep row,
{
png_memcpy(dp, sp, 2);
}
#if defined(PNG_READ_GAMMA_SUPPORTED)
else if (a == 0)
#else
else
#endif
{
*dp = (png_byte)((background->gray >> 8) & 0xff);
*(dp + 1) = (png_byte)(background->gray & 0xff);
}
#if defined(PNG_READ_GAMMA_SUPPORTED)
else
{
png_uint_16 g, v;
@@ -3007,6 +3028,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
*dp = (png_byte)((v >> 8) & 0xff);
*(dp + 1) = (png_byte)(v & 0xff);
}
#endif
}
}
}