< prev index next >
src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c
Print this page
*** 27,38 ****
* This file is available under and governed by the GNU General Public
* License version 2 only, as published by the Free Software Foundation.
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
! * Last changed in libpng 1.6.24 [August 4, 2016]
! * Copyright (c) 1998-2002,2004,2006-2016 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.)
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
--- 27,38 ----
* This file is available under and governed by the GNU General Public
* License version 2 only, as published by the Free Software Foundation.
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
! * Last changed in libpng 1.6.33 [September 28, 2017]
! * Copyright (c) 1998-2002,2004,2006-2017 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.)
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
*** 75,84 ****
--- 75,85 ----
break;
case PNG_CRC_WARN_DISCARD: /* Not a valid action for critical data */
png_warning(png_ptr,
"Can't discard critical data on CRC error");
+ /* FALLTHROUGH */
case PNG_CRC_ERROR_QUIT: /* Error/quit */
case PNG_CRC_DEFAULT:
default:
png_ptr->flags &= ~PNG_FLAG_CRC_CRITICAL_MASK;
*** 455,465 ****
if (full_quantize == 0)
{
int i;
png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr,
! (png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
for (i = 0; i < num_palette; i++)
png_ptr->quantize_index[i] = (png_byte)i;
}
if (num_palette > maximum_colors)
--- 456,466 ----
if (full_quantize == 0)
{
int i;
png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr,
! (png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte))));
for (i = 0; i < num_palette; i++)
png_ptr->quantize_index[i] = (png_byte)i;
}
if (num_palette > maximum_colors)
*** 472,482 ****
int i;
/* Initialize an array to sort colors */
png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr,
! (png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
/* Initialize the quantize_sort array */
for (i = 0; i < num_palette; i++)
png_ptr->quantize_sort[i] = (png_byte)i;
--- 473,483 ----
int i;
/* Initialize an array to sort colors */
png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr,
! (png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte))));
/* Initialize the quantize_sort array */
for (i = 0; i < num_palette; i++)
png_ptr->quantize_sort[i] = (png_byte)i;
*** 606,627 ****
t = NULL;
/* Initialize palette index arrays */
png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr,
! (png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr,
! (png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
/* Initialize the sort array */
for (i = 0; i < num_palette; i++)
{
png_ptr->index_to_palette[i] = (png_byte)i;
png_ptr->palette_to_index[i] = (png_byte)i;
}
! hash = (png_dsortpp)png_calloc(png_ptr, (png_uint_32)(769 *
(sizeof (png_dsortp))));
num_new_palette = num_palette;
/* Initial wild guess at how far apart the farthest pixel
--- 607,630 ----
t = NULL;
/* Initialize palette index arrays */
png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr,
! (png_alloc_size_t)((png_uint_32)num_palette *
! (sizeof (png_byte))));
png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr,
! (png_alloc_size_t)((png_uint_32)num_palette *
! (sizeof (png_byte))));
/* Initialize the sort array */
for (i = 0; i < num_palette; i++)
{
png_ptr->index_to_palette[i] = (png_byte)i;
png_ptr->palette_to_index[i] = (png_byte)i;
}
! hash = (png_dsortpp)png_calloc(png_ptr, (png_alloc_size_t)(769 *
(sizeof (png_dsortp))));
num_new_palette = num_palette;
/* Initial wild guess at how far apart the farthest pixel
*** 648,658 ****
if (d <= max_d)
{
t = (png_dsortp)png_malloc_warn(png_ptr,
! (png_uint_32)(sizeof (png_dsort)));
if (t == NULL)
break;
t->next = hash[d];
--- 651,661 ----
if (d <= max_d)
{
t = (png_dsortp)png_malloc_warn(png_ptr,
! (png_alloc_size_t)(sizeof (png_dsort)));
if (t == NULL)
break;
t->next = hash[d];
*** 773,785 ****
int num_green = (1 << PNG_QUANTIZE_GREEN_BITS);
int num_blue = (1 << PNG_QUANTIZE_BLUE_BITS);
png_size_t num_entries = ((png_size_t)1 << total_bits);
png_ptr->palette_lookup = (png_bytep)png_calloc(png_ptr,
! (png_uint_32)(num_entries * (sizeof (png_byte))));
! distance = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_entries *
(sizeof (png_byte))));
memset(distance, 0xff, num_entries * (sizeof (png_byte)));
for (i = 0; i < num_palette; i++)
--- 776,788 ----
int num_green = (1 << PNG_QUANTIZE_GREEN_BITS);
int num_blue = (1 << PNG_QUANTIZE_BLUE_BITS);
png_size_t num_entries = ((png_size_t)1 << total_bits);
png_ptr->palette_lookup = (png_bytep)png_calloc(png_ptr,
! (png_alloc_size_t)(num_entries * (sizeof (png_byte))));
! distance = (png_bytep)png_malloc(png_ptr, (png_alloc_size_t)(num_entries *
(sizeof (png_byte))));
memset(distance, 0xff, num_entries * (sizeof (png_byte)));
for (i = 0; i < num_palette; i++)
*** 1279,1289 ****
break;
default:
case 8:
! /* FALL THROUGH (Already 8 bits) */
case 16:
/* Already a full 16 bits */
break;
}
--- 1282,1292 ----
break;
default:
case 8:
! /* FALLTHROUGH */ /* (Already 8 bits) */
case 16:
/* Already a full 16 bits */
break;
}
*** 2960,2970 ****
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
/* Reduce RGB files to grayscale, with or without alpha
* using the equation given in Poynton's ColorFAQ of 1998-01-04 at
* <http://www.inforamp.net/~poynton/> (THIS LINK IS DEAD June 2008 but
* versions dated 1998 through November 2002 have been archived at
! * http://web.archive.org/web/20000816232553/http://www.inforamp.net/
* ~poynton/notes/colour_and_gamma/ColorFAQ.txt )
* Charles Poynton poynton at poynton.com
*
* Y = 0.212671 * R + 0.715160 * G + 0.072169 * B
*
--- 2963,2973 ----
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
/* Reduce RGB files to grayscale, with or without alpha
* using the equation given in Poynton's ColorFAQ of 1998-01-04 at
* <http://www.inforamp.net/~poynton/> (THIS LINK IS DEAD June 2008 but
* versions dated 1998 through November 2002 have been archived at
! * https://web.archive.org/web/20000816232553/www.inforamp.net/
* ~poynton/notes/colour_and_gamma/ColorFAQ.txt )
* Charles Poynton poynton at poynton.com
*
* Y = 0.212671 * R + 0.715160 * G + 0.072169 * B
*
*** 4328,4338 ****
{
{
if (num_trans > 0)
{
sp = row + (png_size_t)row_width - 1;
! dp = row + (png_size_t)(row_width << 2) - 1;
for (i = 0; i < row_width; i++)
{
if ((int)(*sp) >= num_trans)
*dp-- = 0xff;
--- 4331,4341 ----
{
{
if (num_trans > 0)
{
sp = row + (png_size_t)row_width - 1;
! dp = row + ((png_size_t)row_width << 2) - 1;
for (i = 0; i < row_width; i++)
{
if ((int)(*sp) >= num_trans)
*dp-- = 0xff;
*** 4489,4499 ****
{
if (row_info->bit_depth == 8)
{
gray = gray & 0xff;
sp = row + (png_size_t)row_width - 1;
! dp = row + (png_size_t)(row_width << 1) - 1;
for (i = 0; i < row_width; i++)
{
if ((*sp & 0xffU) == gray)
*dp-- = 0;
--- 4492,4502 ----
{
if (row_info->bit_depth == 8)
{
gray = gray & 0xff;
sp = row + (png_size_t)row_width - 1;
! dp = row + ((png_size_t)row_width << 1) - 1;
for (i = 0; i < row_width; i++)
{
if ((*sp & 0xffU) == gray)
*dp-- = 0;
*** 4545,4555 ****
{
png_byte red = (png_byte)(trans_color->red & 0xff);
png_byte green = (png_byte)(trans_color->green & 0xff);
png_byte blue = (png_byte)(trans_color->blue & 0xff);
sp = row + (png_size_t)row_info->rowbytes - 1;
! dp = row + (png_size_t)(row_width << 2) - 1;
for (i = 0; i < row_width; i++)
{
if (*(sp - 2) == red && *(sp - 1) == green && *(sp) == blue)
*dp-- = 0;
--- 4548,4558 ----
{
png_byte red = (png_byte)(trans_color->red & 0xff);
png_byte green = (png_byte)(trans_color->green & 0xff);
png_byte blue = (png_byte)(trans_color->blue & 0xff);
sp = row + (png_size_t)row_info->rowbytes - 1;
! dp = row + ((png_size_t)row_width << 2) - 1;
for (i = 0; i < row_width; i++)
{
if (*(sp - 2) == red && *(sp - 1) == green && *(sp) == blue)
*dp-- = 0;
*** 4568,4578 ****
png_byte blue_high = (png_byte)((trans_color->blue >> 8) & 0xff);
png_byte red_low = (png_byte)(trans_color->red & 0xff);
png_byte green_low = (png_byte)(trans_color->green & 0xff);
png_byte blue_low = (png_byte)(trans_color->blue & 0xff);
sp = row + row_info->rowbytes - 1;
! dp = row + (png_size_t)(row_width << 3) - 1;
for (i = 0; i < row_width; i++)
{
if (*(sp - 5) == red_high &&
*(sp - 4) == red_low &&
*(sp - 3) == green_high &&
--- 4571,4581 ----
png_byte blue_high = (png_byte)((trans_color->blue >> 8) & 0xff);
png_byte red_low = (png_byte)(trans_color->red & 0xff);
png_byte green_low = (png_byte)(trans_color->green & 0xff);
png_byte blue_low = (png_byte)(trans_color->blue & 0xff);
sp = row + row_info->rowbytes - 1;
! dp = row + ((png_size_t)row_width << 3) - 1;
for (i = 0; i < row_width; i++)
{
if (*(sp - 5) == red_high &&
*(sp - 4) == red_low &&
*(sp - 3) == green_high &&
*** 4627,4637 ****
* simply by byte replication in place (copying backwards).
*/
png_byte *sp = row + row_info->rowbytes; /* source, last byte + 1 */
png_byte *dp = sp + row_info->rowbytes; /* destination, end + 1 */
while (dp > sp)
! dp[-2] = dp[-1] = *--sp, dp -= 2;
row_info->rowbytes *= 2;
row_info->bit_depth = 16;
row_info->pixel_depth = (png_byte)(row_info->channels * 16);
}
--- 4630,4642 ----
* simply by byte replication in place (copying backwards).
*/
png_byte *sp = row + row_info->rowbytes; /* source, last byte + 1 */
png_byte *dp = sp + row_info->rowbytes; /* destination, end + 1 */
while (dp > sp)
! {
! dp[-2] = dp[-1] = *--sp; dp -= 2;
! }
row_info->rowbytes *= 2;
row_info->bit_depth = 16;
row_info->pixel_depth = (png_byte)(row_info->channels * 16);
}
< prev index next >