| Index: third_party/libpng/pngrtran.c
|
| ===================================================================
|
| --- third_party/libpng/pngrtran.c (revision 7204)
|
| +++ third_party/libpng/pngrtran.c (working copy)
|
| @@ -1,7 +1,7 @@
|
|
|
| /* pngrtran.c - transforms the data in a row for PNG readers
|
| *
|
| - * Last changed in libpng 1.2.27 [April 29, 2008]
|
| + * Last changed in libpng 1.2.30 [August 15, 2008]
|
| * For conditions of distribution and use, see copyright notice in png.h
|
| * Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
| * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
| @@ -15,7 +15,6 @@
|
|
|
| #define PNG_INTERNAL
|
| #include "png.h"
|
| -
|
| #if defined(PNG_READ_SUPPORTED)
|
|
|
| /* Set the action on getting a CRC error for an ancillary or critical chunk. */
|
| @@ -24,7 +23,7 @@
|
| {
|
| png_debug(1, "in png_set_crc_action\n");
|
| /* Tell libpng how we react to CRC errors in critical chunks */
|
| - if(png_ptr == NULL) return;
|
| + if (png_ptr == NULL) return;
|
| switch (crit_action)
|
| {
|
| case PNG_CRC_NO_CHANGE: /* leave setting as is */
|
| @@ -39,7 +38,8 @@
|
| PNG_FLAG_CRC_CRITICAL_IGNORE;
|
| 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.");
|
| + png_warning(png_ptr,
|
| + "Can't discard critical data on CRC error.");
|
| case PNG_CRC_ERROR_QUIT: /* error/quit */
|
| case PNG_CRC_DEFAULT:
|
| default:
|
| @@ -81,7 +81,7 @@
|
| int need_expand, double background_gamma)
|
| {
|
| png_debug(1, "in png_set_background\n");
|
| - if(png_ptr == NULL) return;
|
| + if (png_ptr == NULL) return;
|
| if (background_gamma_code == PNG_BACKGROUND_GAMMA_UNKNOWN)
|
| {
|
| png_warning(png_ptr, "Application must supply a known background gamma");
|
| @@ -103,7 +103,7 @@
|
| png_set_strip_16(png_structp png_ptr)
|
| {
|
| png_debug(1, "in png_set_strip_16\n");
|
| - if(png_ptr == NULL) return;
|
| + if (png_ptr == NULL) return;
|
| png_ptr->transformations |= PNG_16_TO_8;
|
| }
|
| #endif
|
| @@ -113,7 +113,7 @@
|
| png_set_strip_alpha(png_structp png_ptr)
|
| {
|
| png_debug(1, "in png_set_strip_alpha\n");
|
| - if(png_ptr == NULL) return;
|
| + if (png_ptr == NULL) return;
|
| png_ptr->flags |= PNG_FLAG_STRIP_ALPHA;
|
| }
|
| #endif
|
| @@ -143,7 +143,7 @@
|
| int full_dither)
|
| {
|
| png_debug(1, "in png_set_dither\n");
|
| - if(png_ptr == NULL) return;
|
| + if (png_ptr == NULL) return;
|
| png_ptr->transformations |= PNG_DITHER;
|
|
|
| if (!full_dither)
|
| @@ -151,7 +151,7 @@
|
| int i;
|
|
|
| png_ptr->dither_index = (png_bytep)png_malloc(png_ptr,
|
| - (png_uint_32)(num_palette * png_sizeof (png_byte)));
|
| + (png_uint_32)(num_palette * png_sizeof(png_byte)));
|
| for (i = 0; i < num_palette; i++)
|
| png_ptr->dither_index[i] = (png_byte)i;
|
| }
|
| @@ -167,7 +167,7 @@
|
|
|
| /* initialize an array to sort colors */
|
| png_ptr->dither_sort = (png_bytep)png_malloc(png_ptr,
|
| - (png_uint_32)(num_palette * png_sizeof (png_byte)));
|
| + (png_uint_32)(num_palette * png_sizeof(png_byte)));
|
|
|
| /* initialize the dither_sort array */
|
| for (i = 0; i < num_palette; i++)
|
| @@ -274,7 +274,7 @@
|
| }
|
| }
|
| png_free(png_ptr, png_ptr->dither_sort);
|
| - png_ptr->dither_sort=NULL;
|
| + png_ptr->dither_sort = NULL;
|
| }
|
| else
|
| {
|
| @@ -292,13 +292,13 @@
|
| png_dsortp t;
|
| png_dsortpp hash;
|
|
|
| - t=NULL;
|
| + t = NULL;
|
|
|
| /* initialize palette index arrays */
|
| png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr,
|
| - (png_uint_32)(num_palette * png_sizeof (png_byte)));
|
| + (png_uint_32)(num_palette * png_sizeof(png_byte)));
|
| png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr,
|
| - (png_uint_32)(num_palette * png_sizeof (png_byte)));
|
| + (png_uint_32)(num_palette * png_sizeof(png_byte)));
|
|
|
| /* initialize the sort array */
|
| for (i = 0; i < num_palette; i++)
|
| @@ -308,10 +308,10 @@
|
| }
|
|
|
| hash = (png_dsortpp)png_malloc(png_ptr, (png_uint_32)(769 *
|
| - png_sizeof (png_dsortp)));
|
| + png_sizeof(png_dsortp)));
|
| for (i = 0; i < 769; i++)
|
| hash[i] = NULL;
|
| -/* png_memset(hash, 0, 769 * png_sizeof (png_dsortp)); */
|
| +/* png_memset(hash, 0, 769 * png_sizeof(png_dsortp)); */
|
|
|
| num_new_palette = num_palette;
|
|
|
| @@ -436,8 +436,8 @@
|
| png_free(png_ptr, hash);
|
| png_free(png_ptr, png_ptr->palette_to_index);
|
| png_free(png_ptr, png_ptr->index_to_palette);
|
| - png_ptr->palette_to_index=NULL;
|
| - png_ptr->index_to_palette=NULL;
|
| + png_ptr->palette_to_index = NULL;
|
| + png_ptr->index_to_palette = NULL;
|
| }
|
| num_palette = maximum_colors;
|
| }
|
| @@ -459,10 +459,10 @@
|
| png_size_t num_entries = ((png_size_t)1 << total_bits);
|
|
|
| png_ptr->palette_lookup = (png_bytep )png_malloc(png_ptr,
|
| - (png_uint_32)(num_entries * png_sizeof (png_byte)));
|
| + (png_uint_32)(num_entries * png_sizeof(png_byte)));
|
|
|
| png_memset(png_ptr->palette_lookup, 0, num_entries *
|
| - png_sizeof (png_byte));
|
| + png_sizeof(png_byte));
|
|
|
| distance = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_entries *
|
| png_sizeof(png_byte)));
|
| @@ -527,7 +527,7 @@
|
| png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma)
|
| {
|
| png_debug(1, "in png_set_gamma\n");
|
| - if(png_ptr == NULL) return;
|
| + if (png_ptr == NULL) return;
|
| if ((fabs(scrn_gamma * file_gamma - 1.0) > PNG_GAMMA_THRESHOLD) ||
|
| (png_ptr->color_type & PNG_COLOR_MASK_ALPHA) ||
|
| (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE))
|
| @@ -546,7 +546,7 @@
|
| png_set_expand(png_structp png_ptr)
|
| {
|
| png_debug(1, "in png_set_expand\n");
|
| - if(png_ptr == NULL) return;
|
| + if (png_ptr == NULL) return;
|
| png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
|
| png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
|
| }
|
| @@ -573,7 +573,7 @@
|
| png_set_palette_to_rgb(png_structp png_ptr)
|
| {
|
| png_debug(1, "in png_set_palette_to_rgb\n");
|
| - if(png_ptr == NULL) return;
|
| + if (png_ptr == NULL) return;
|
| png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
|
| png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
|
| }
|
| @@ -584,7 +584,7 @@
|
| png_set_expand_gray_1_2_4_to_8(png_structp png_ptr)
|
| {
|
| png_debug(1, "in png_set_expand_gray_1_2_4_to_8\n");
|
| - if(png_ptr == NULL) return;
|
| + if (png_ptr == NULL) return;
|
| png_ptr->transformations |= PNG_EXPAND;
|
| png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
|
| }
|
| @@ -597,7 +597,7 @@
|
| png_set_gray_1_2_4_to_8(png_structp png_ptr)
|
| {
|
| png_debug(1, "in png_set_gray_1_2_4_to_8\n");
|
| - if(png_ptr == NULL) return;
|
| + if (png_ptr == NULL) return;
|
| png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
|
| }
|
| #endif
|
| @@ -635,7 +635,7 @@
|
| {
|
| int red_fixed = (int)((float)red*100000.0 + 0.5);
|
| int green_fixed = (int)((float)green*100000.0 + 0.5);
|
| - if(png_ptr == NULL) return;
|
| + if (png_ptr == NULL) return;
|
| png_set_rgb_to_gray_fixed(png_ptr, error_action, red_fixed, green_fixed);
|
| }
|
| #endif
|
| @@ -645,7 +645,7 @@
|
| png_fixed_point red, png_fixed_point green)
|
| {
|
| png_debug(1, "in png_set_rgb_to_gray\n");
|
| - if(png_ptr == NULL) return;
|
| + if (png_ptr == NULL) return;
|
| switch(error_action)
|
| {
|
| case 1: png_ptr->transformations |= PNG_RGB_TO_GRAY;
|
| @@ -659,18 +659,19 @@
|
| png_ptr->transformations |= PNG_EXPAND;
|
| #else
|
| {
|
| - png_warning(png_ptr, "Cannot do RGB_TO_GRAY without EXPAND_SUPPORTED.");
|
| + png_warning(png_ptr,
|
| + "Cannot do RGB_TO_GRAY without EXPAND_SUPPORTED.");
|
| png_ptr->transformations &= ~PNG_RGB_TO_GRAY;
|
| }
|
| #endif
|
| {
|
| png_uint_16 red_int, green_int;
|
| - if(red < 0 || green < 0)
|
| + if (red < 0 || green < 0)
|
| {
|
| red_int = 6968; /* .212671 * 32768 + .5 */
|
| green_int = 23434; /* .715160 * 32768 + .5 */
|
| }
|
| - else if(red + green < 100000L)
|
| + else if (red + green < 100000L)
|
| {
|
| red_int = (png_uint_16)(((png_uint_32)red*32768L)/100000L);
|
| green_int = (png_uint_16)(((png_uint_32)green*32768L)/100000L);
|
| @@ -683,7 +684,8 @@
|
| }
|
| png_ptr->rgb_to_gray_red_coeff = red_int;
|
| png_ptr->rgb_to_gray_green_coeff = green_int;
|
| - png_ptr->rgb_to_gray_blue_coeff = (png_uint_16)(32768-red_int-green_int);
|
| + png_ptr->rgb_to_gray_blue_coeff =
|
| + (png_uint_16)(32768 - red_int - green_int);
|
| }
|
| }
|
| #endif
|
| @@ -696,13 +698,13 @@
|
| read_user_transform_fn)
|
| {
|
| png_debug(1, "in png_set_read_user_transform_fn\n");
|
| - if(png_ptr == NULL) return;
|
| + if (png_ptr == NULL) return;
|
| #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
|
| png_ptr->transformations |= PNG_USER_TRANSFORM;
|
| png_ptr->read_user_transform_fn = read_user_transform_fn;
|
| #endif
|
| #ifdef PNG_LEGACY_SUPPORTED
|
| - if(read_user_transform_fn)
|
| + if (read_user_transform_fn)
|
| png_warning(png_ptr,
|
| "This version of libpng does not support user transforms");
|
| #endif
|
| @@ -717,7 +719,7 @@
|
| {
|
| png_debug(1, "in png_init_read_transformations\n");
|
| #if defined(PNG_USELESS_TESTS_SUPPORTED)
|
| - if(png_ptr != NULL)
|
| + if (png_ptr != NULL)
|
| #endif
|
| {
|
| #if defined(PNG_READ_BACKGROUND_SUPPORTED) || defined(PNG_READ_SHIFT_SUPPORTED) \
|
| @@ -818,7 +820,7 @@
|
| {
|
| /* invert the alpha channel (in tRNS) unless the pixels are
|
| going to be expanded, in which case leave it for later */
|
| - int i,istop;
|
| + int i, istop;
|
| istop=(int)png_ptr->num_trans;
|
| for (i=0; i<istop; i++)
|
| png_ptr->trans[i] = (png_byte)(255 - png_ptr->trans[i]);
|
| @@ -839,7 +841,7 @@
|
| && (fabs(png_ptr->screen_gamma * png_ptr->gamma - 1.0)
|
| < PNG_GAMMA_THRESHOLD))
|
| {
|
| - int i,k;
|
| + int i, k;
|
| k=0;
|
| for (i=0; i<png_ptr->num_trans; i++)
|
| {
|
| @@ -1110,7 +1112,7 @@
|
| }
|
| #if !defined(PNG_READ_GAMMA_SUPPORTED) && !defined(PNG_READ_SHIFT_SUPPORTED) \
|
| && !defined(PNG_READ_BACKGROUND_SUPPORTED)
|
| - if(png_ptr)
|
| + if (png_ptr)
|
| return;
|
| #endif
|
| }
|
| @@ -1239,11 +1241,11 @@
|
|
|
| #if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) && \
|
| defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
|
| - if(png_ptr->transformations & PNG_USER_TRANSFORM)
|
| + if (png_ptr->transformations & PNG_USER_TRANSFORM)
|
| {
|
| - if(info_ptr->bit_depth < png_ptr->user_transform_depth)
|
| + if (info_ptr->bit_depth < png_ptr->user_transform_depth)
|
| info_ptr->bit_depth = png_ptr->user_transform_depth;
|
| - if(info_ptr->channels < png_ptr->user_transform_channels)
|
| + if (info_ptr->channels < png_ptr->user_transform_channels)
|
| info_ptr->channels = png_ptr->user_transform_channels;
|
| }
|
| #endif
|
| @@ -1251,10 +1253,10 @@
|
| info_ptr->pixel_depth = (png_byte)(info_ptr->channels *
|
| info_ptr->bit_depth);
|
|
|
| - info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth,info_ptr->width);
|
| + info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, info_ptr->width);
|
|
|
| #if !defined(PNG_READ_EXPAND_SUPPORTED)
|
| - if(png_ptr)
|
| + if (png_ptr)
|
| return;
|
| #endif
|
| }
|
| @@ -1273,7 +1275,7 @@
|
| char msg[50];
|
|
|
| png_snprintf2(msg, 50,
|
| - "NULL row buffer for row %ld, pass %d", png_ptr->row_number,
|
| + "NULL row buffer for row %ld, pass %d", (long)png_ptr->row_number,
|
| png_ptr->pass);
|
| png_error(png_ptr, msg);
|
| #else
|
| @@ -1324,13 +1326,13 @@
|
| {
|
| int rgb_error =
|
| png_do_rgb_to_gray(png_ptr, &(png_ptr->row_info), png_ptr->row_buf + 1);
|
| - if(rgb_error)
|
| + if (rgb_error)
|
| {
|
| png_ptr->rgb_to_gray_status=1;
|
| - if((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
|
| + if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
|
| PNG_RGB_TO_GRAY_WARN)
|
| png_warning(png_ptr, "png_do_rgb_to_gray found nongray pixel");
|
| - if((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
|
| + if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
|
| PNG_RGB_TO_GRAY_ERR)
|
| png_error(png_ptr, "png_do_rgb_to_gray found nongray pixel");
|
| }
|
| @@ -1414,7 +1416,7 @@
|
| {
|
| png_do_dither((png_row_infop)&(png_ptr->row_info), png_ptr->row_buf + 1,
|
| png_ptr->palette_lookup, png_ptr->dither_index);
|
| - if(png_ptr->row_info.rowbytes == (png_uint_32)0)
|
| + if (png_ptr->row_info.rowbytes == (png_uint_32)0)
|
| png_error(png_ptr, "png_do_dither returned rowbytes=0");
|
| }
|
| #endif
|
| @@ -1476,7 +1478,7 @@
|
| #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
|
| if (png_ptr->transformations & PNG_USER_TRANSFORM)
|
| {
|
| - if(png_ptr->read_user_transform_fn != NULL)
|
| + if (png_ptr->read_user_transform_fn != NULL)
|
| (*(png_ptr->read_user_transform_fn)) /* user read transform function */
|
| (png_ptr, /* png_ptr */
|
| &(png_ptr->row_info), /* row_info: */
|
| @@ -1488,9 +1490,9 @@
|
| /* 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)
|
| - if(png_ptr->user_transform_depth)
|
| + if (png_ptr->user_transform_depth)
|
| png_ptr->row_info.bit_depth = png_ptr->user_transform_depth;
|
| - if(png_ptr->user_transform_channels)
|
| + if (png_ptr->user_transform_channels)
|
| png_ptr->row_info.channels = png_ptr->user_transform_channels;
|
| #endif
|
| png_ptr->row_info.pixel_depth = (png_byte)(png_ptr->row_info.bit_depth *
|
| @@ -1967,7 +1969,7 @@
|
| #endif
|
| row_info->color_type == PNG_COLOR_TYPE_GRAY)
|
| {
|
| - if(row_info->bit_depth == 8)
|
| + if (row_info->bit_depth == 8)
|
| {
|
| /* This changes the data from G to GX */
|
| if (flags & PNG_FLAG_FILLER_AFTER)
|
| @@ -1999,7 +2001,7 @@
|
| row_info->rowbytes = row_width * 2;
|
| }
|
| }
|
| - else if(row_info->bit_depth == 16)
|
| + else if (row_info->bit_depth == 16)
|
| {
|
| /* This changes the data from GG to GGXX */
|
| if (flags & PNG_FLAG_FILLER_AFTER)
|
| @@ -2039,7 +2041,7 @@
|
| } /* COLOR_TYPE == GRAY */
|
| else if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
| {
|
| - if(row_info->bit_depth == 8)
|
| + if (row_info->bit_depth == 8)
|
| {
|
| /* This changes the data from RGB to RGBX */
|
| if (flags & PNG_FLAG_FILLER_AFTER)
|
| @@ -2075,7 +2077,7 @@
|
| row_info->rowbytes = row_width * 4;
|
| }
|
| }
|
| - else if(row_info->bit_depth == 16)
|
| + else if (row_info->bit_depth == 16)
|
| {
|
| /* This changes the data from RRGGBB to RRGGBBXX */
|
| if (flags & PNG_FLAG_FILLER_AFTER)
|
| @@ -2202,7 +2204,7 @@
|
| row_info->color_type |= PNG_COLOR_MASK_COLOR;
|
| row_info->pixel_depth = (png_byte)(row_info->channels *
|
| row_info->bit_depth);
|
| - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width);
|
| + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
|
| }
|
| }
|
| #endif
|
| @@ -2210,8 +2212,10 @@
|
| #if defined(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/>
|
| - * Copyright (c) 1998-01-04 Charles Poynton poynton at inforamp.net
|
| + * <http://www.inforamp.net/~poynton/> (THIS LINK IS DEAD June 2008)
|
| + * New link:
|
| + * <http://www.poynton.com/notes/colour_and_gamma/>
|
| + * Charles Poynton poynton at poynton.com
|
| *
|
| * Y = 0.212671 * R + 0.715160 * G + 0.072169 * B
|
| *
|
| @@ -2262,14 +2266,14 @@
|
| png_byte red = png_ptr->gamma_to_1[*(sp++)];
|
| png_byte green = png_ptr->gamma_to_1[*(sp++)];
|
| png_byte blue = png_ptr->gamma_to_1[*(sp++)];
|
| - if(red != green || red != blue)
|
| + if (red != green || red != blue)
|
| {
|
| rgb_error |= 1;
|
| *(dp++) = png_ptr->gamma_from_1[
|
| - (rc*red+gc*green+bc*blue)>>15];
|
| + (rc*red + gc*green + bc*blue)>>15];
|
| }
|
| else
|
| - *(dp++) = *(sp-1);
|
| + *(dp++) = *(sp - 1);
|
| }
|
| }
|
| else
|
| @@ -2282,13 +2286,13 @@
|
| png_byte red = *(sp++);
|
| png_byte green = *(sp++);
|
| png_byte blue = *(sp++);
|
| - if(red != green || red != blue)
|
| + if (red != green || red != blue)
|
| {
|
| rgb_error |= 1;
|
| - *(dp++) = (png_byte)((rc*red+gc*green+bc*blue)>>15);
|
| + *(dp++) = (png_byte)((rc*red + gc*green + bc*blue)>>15);
|
| }
|
| else
|
| - *(dp++) = *(sp-1);
|
| + *(dp++) = *(sp - 1);
|
| }
|
| }
|
| }
|
| @@ -2309,7 +2313,7 @@
|
| green = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2;
|
| blue = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2;
|
|
|
| - if(red == green && red == blue)
|
| + if (red == green && red == blue)
|
| w = red;
|
| else
|
| {
|
| @@ -2343,7 +2347,7 @@
|
| green = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2;
|
| blue = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2;
|
|
|
| - if(red != green || red != blue)
|
| + if (red != green || red != blue)
|
| rgb_error |= 1;
|
| gray16 = (png_uint_16)((rc*red + gc*green + bc*blue)>>15);
|
| *(dp++) = (png_byte)((gray16>>8) & 0xff);
|
| @@ -2366,7 +2370,7 @@
|
| png_byte red = png_ptr->gamma_to_1[*(sp++)];
|
| png_byte green = png_ptr->gamma_to_1[*(sp++)];
|
| png_byte blue = png_ptr->gamma_to_1[*(sp++)];
|
| - if(red != green || red != blue)
|
| + if (red != green || red != blue)
|
| rgb_error |= 1;
|
| *(dp++) = png_ptr->gamma_from_1
|
| [(rc*red + gc*green + bc*blue)>>15];
|
| @@ -2383,7 +2387,7 @@
|
| png_byte red = *(sp++);
|
| png_byte green = *(sp++);
|
| png_byte blue = *(sp++);
|
| - if(red != green || red != blue)
|
| + if (red != green || red != blue)
|
| rgb_error |= 1;
|
| *(dp++) = (png_byte)((rc*red + gc*green + bc*blue)>>15);
|
| *(dp++) = *(sp++); /* alpha */
|
| @@ -2406,7 +2410,7 @@
|
| green = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2;
|
| blue = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2;
|
|
|
| - if(red == green && red == blue)
|
| + if (red == green && red == blue)
|
| w = red;
|
| else
|
| {
|
| @@ -2440,7 +2444,7 @@
|
| red = (png_uint_16)((*(sp)<<8) | *(sp+1)); sp+=2;
|
| green = (png_uint_16)((*(sp)<<8) | *(sp+1)); sp+=2;
|
| blue = (png_uint_16)((*(sp)<<8) | *(sp+1)); sp+=2;
|
| - if(red != green || red != blue)
|
| + if (red != green || red != blue)
|
| rgb_error |= 1;
|
| gray16 = (png_uint_16)((rc*red + gc*green + bc*blue)>>15);
|
| *(dp++) = (png_byte)((gray16>>8) & 0xff);
|
| @@ -2455,7 +2459,7 @@
|
| row_info->color_type &= ~PNG_COLOR_MASK_COLOR;
|
| row_info->pixel_depth = (png_byte)(row_info->channels *
|
| row_info->bit_depth);
|
| - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width);
|
| + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
|
| }
|
| return rgb_error;
|
| }
|
| @@ -3373,7 +3377,7 @@
|
| row_info->channels--;
|
| row_info->pixel_depth = (png_byte)(row_info->channels *
|
| row_info->bit_depth);
|
| - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width);
|
| + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
|
| }
|
| }
|
| }
|
| @@ -3832,7 +3836,7 @@
|
| dp = row + (row_info->rowbytes << 1) - 1;
|
| for (i = 0; i < row_width; i++)
|
| {
|
| - if (*(sp-1) == gray_high && *(sp) == gray_low)
|
| + if (*(sp - 1) == gray_high && *(sp) == gray_low)
|
| {
|
| *dp-- = 0;
|
| *dp-- = 0;
|
| @@ -3911,7 +3915,7 @@
|
| row_info->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
|
| row_info->channels = 4;
|
| row_info->pixel_depth = (png_byte)(row_info->bit_depth << 2);
|
| - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width);
|
| + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
|
| }
|
| }
|
| }
|
| @@ -3964,7 +3968,7 @@
|
| row_info->color_type = PNG_COLOR_TYPE_PALETTE;
|
| row_info->channels = 1;
|
| row_info->pixel_depth = row_info->bit_depth;
|
| - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width);
|
| + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
|
| }
|
| else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA &&
|
| palette_lookup != NULL && row_info->bit_depth == 8)
|
| @@ -3993,7 +3997,7 @@
|
| row_info->color_type = PNG_COLOR_TYPE_PALETTE;
|
| row_info->channels = 1;
|
| row_info->pixel_depth = row_info->bit_depth;
|
| - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width);
|
| + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
|
| }
|
| else if (row_info->color_type == PNG_COLOR_TYPE_PALETTE &&
|
| dither_lookup && row_info->bit_depth == 8)
|
| @@ -4062,7 +4066,7 @@
|
| png_ptr->gamma_from_1 = (png_bytep)png_malloc(png_ptr,
|
| (png_uint_32)256);
|
|
|
| - if(png_ptr->screen_gamma > 0.000001)
|
| + if (png_ptr->screen_gamma > 0.000001)
|
| g = 1.0 / png_ptr->screen_gamma;
|
| else
|
| g = png_ptr->gamma; /* probably doing rgb_to_gray */
|
| @@ -4122,7 +4126,7 @@
|
| g = 1.0;
|
|
|
| png_ptr->gamma_16_table = (png_uint_16pp)png_malloc(png_ptr,
|
| - (png_uint_32)(num * png_sizeof (png_uint_16p)));
|
| + (png_uint_32)(num * png_sizeof(png_uint_16p)));
|
|
|
| if (png_ptr->transformations & (PNG_16_TO_8 | PNG_BACKGROUND))
|
| {
|
| @@ -4132,7 +4136,7 @@
|
| for (i = 0; i < num; i++)
|
| {
|
| png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr,
|
| - (png_uint_32)(256 * png_sizeof (png_uint_16)));
|
| + (png_uint_32)(256 * png_sizeof(png_uint_16)));
|
| }
|
|
|
| g = 1.0 / g;
|
| @@ -4162,7 +4166,7 @@
|
| for (i = 0; i < num; i++)
|
| {
|
| png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr,
|
| - (png_uint_32)(256 * png_sizeof (png_uint_16)));
|
| + (png_uint_32)(256 * png_sizeof(png_uint_16)));
|
|
|
| ig = (((png_uint_32)i * (png_uint_32)png_gamma_shift[shift]) >> 4);
|
| for (j = 0; j < 256; j++)
|
| @@ -4182,12 +4186,12 @@
|
| g = 1.0 / (png_ptr->gamma);
|
|
|
| png_ptr->gamma_16_to_1 = (png_uint_16pp)png_malloc(png_ptr,
|
| - (png_uint_32)(num * png_sizeof (png_uint_16p )));
|
| + (png_uint_32)(num * png_sizeof(png_uint_16p )));
|
|
|
| for (i = 0; i < num; i++)
|
| {
|
| png_ptr->gamma_16_to_1[i] = (png_uint_16p)png_malloc(png_ptr,
|
| - (png_uint_32)(256 * png_sizeof (png_uint_16)));
|
| + (png_uint_32)(256 * png_sizeof(png_uint_16)));
|
|
|
| ig = (((png_uint_32)i *
|
| (png_uint_32)png_gamma_shift[shift]) >> 4);
|
| @@ -4199,18 +4203,18 @@
|
| }
|
| }
|
|
|
| - if(png_ptr->screen_gamma > 0.000001)
|
| + if (png_ptr->screen_gamma > 0.000001)
|
| g = 1.0 / png_ptr->screen_gamma;
|
| else
|
| g = png_ptr->gamma; /* probably doing rgb_to_gray */
|
|
|
| png_ptr->gamma_16_from_1 = (png_uint_16pp)png_malloc(png_ptr,
|
| - (png_uint_32)(num * png_sizeof (png_uint_16p)));
|
| + (png_uint_32)(num * png_sizeof(png_uint_16p)));
|
|
|
| for (i = 0; i < num; i++)
|
| {
|
| png_ptr->gamma_16_from_1[i] = (png_uint_16p)png_malloc(png_ptr,
|
| - (png_uint_32)(256 * png_sizeof (png_uint_16)));
|
| + (png_uint_32)(256 * png_sizeof(png_uint_16)));
|
|
|
| ig = (((png_uint_32)i *
|
| (png_uint_32)png_gamma_shift[shift]) >> 4);
|
| @@ -4275,11 +4279,11 @@
|
|
|
| for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
| {
|
| - png_uint_32 s0 = (*(rp ) << 8) | *(rp+1);
|
| - png_uint_32 s1 = (*(rp+2) << 8) | *(rp+3);
|
| - png_uint_32 s2 = (*(rp+4) << 8) | *(rp+5);
|
| - png_uint_32 red = (png_uint_32)((s0+s1+65536L) & 0xffffL);
|
| - png_uint_32 blue = (png_uint_32)((s2+s1+65536L) & 0xffffL);
|
| + png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
|
| + png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
|
| + png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
|
| + png_uint_32 red = (png_uint_32)((s0 + s1 + 65536L) & 0xffffL);
|
| + png_uint_32 blue = (png_uint_32)((s2 + s1 + 65536L) & 0xffffL);
|
| *(rp ) = (png_byte)((red >> 8) & 0xff);
|
| *(rp+1) = (png_byte)(red & 0xff);
|
| *(rp+4) = (png_byte)((blue >> 8) & 0xff);
|
|
|