Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: third_party/libpng/pngrtran.c

Issue 7464050: libpng: update to 1.2.45 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/libpng/pngmem.c ('k') | third_party/libpng/pngrutil.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* pngrtran.c - transforms the data in a row for PNG readers 2 /* pngrtran.c - transforms the data in a row for PNG readers
3 * 3 *
4 * Last changed in libpng 1.2.43 [February 25, 2010] 4 * Last changed in libpng 1.2.45 [July 7, 2011]
5 * Copyright (c) 1998-2010 Glenn Randers-Pehrson 5 * Copyright (c) 1998-2011 Glenn Randers-Pehrson
6 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 6 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
7 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) 7 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
8 * 8 *
9 * This code is released under the libpng license. 9 * This code is released under the libpng license.
10 * For conditions of distribution and use, see the disclaimer 10 * For conditions of distribution and use, see the disclaimer
11 * and license in png.h 11 * and license in png.h
12 * 12 *
13 * This file contains functions optionally called by an application 13 * This file contains functions optionally called by an application
14 * in order to tell libpng how to handle data when reading a PNG. 14 * in order to tell libpng how to handle data when reading a PNG.
15 * Transformations that are used in both reading and writing are 15 * Transformations that are used in both reading and writing are
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED 669 #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
670 #ifdef PNG_FLOATING_POINT_SUPPORTED 670 #ifdef PNG_FLOATING_POINT_SUPPORTED
671 /* Convert a RGB image to a grayscale of the same width. This allows us, 671 /* Convert a RGB image to a grayscale of the same width. This allows us,
672 * for example, to convert a 24 bpp RGB image into an 8 bpp grayscale image. 672 * for example, to convert a 24 bpp RGB image into an 8 bpp grayscale image.
673 */ 673 */
674 674
675 void PNGAPI 675 void PNGAPI
676 png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red, 676 png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red,
677 double green) 677 double green)
678 { 678 {
679 int red_fixed = (int)((float)red*100000.0 + 0.5); 679 int red_fixed, green_fixed;
680 int green_fixed = (int)((float)green*100000.0 + 0.5);
681 if (png_ptr == NULL) 680 if (png_ptr == NULL)
682 return; 681 return;
682 if (red > 21474.83647 || red < -21474.83648 ||
683 green > 21474.83647 || green < -21474.83648)
684 {
685 png_warning(png_ptr, "ignoring out of range rgb_to_gray coefficients");
686 red_fixed = -1;
687 green_fixed = -1;
688 }
689 else
690 {
691 red_fixed = (int)((float)red*100000.0 + 0.5);
692 green_fixed = (int)((float)green*100000.0 + 0.5);
693 }
683 png_set_rgb_to_gray_fixed(png_ptr, error_action, red_fixed, green_fixed); 694 png_set_rgb_to_gray_fixed(png_ptr, error_action, red_fixed, green_fixed);
684 } 695 }
685 #endif 696 #endif
686 697
687 void PNGAPI 698 void PNGAPI
688 png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action, 699 png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
689 png_fixed_point red, png_fixed_point green) 700 png_fixed_point red, png_fixed_point green)
690 { 701 {
691 png_debug(1, "in png_set_rgb_to_gray"); 702 png_debug(1, "in png_set_rgb_to_gray");
692 703
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 void /* PRIVATE */ 1200 void /* PRIVATE */
1190 png_read_transform_info(png_structp png_ptr, png_infop info_ptr) 1201 png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
1191 { 1202 {
1192 png_debug(1, "in png_read_transform_info"); 1203 png_debug(1, "in png_read_transform_info");
1193 1204
1194 #ifdef PNG_READ_EXPAND_SUPPORTED 1205 #ifdef PNG_READ_EXPAND_SUPPORTED
1195 if (png_ptr->transformations & PNG_EXPAND) 1206 if (png_ptr->transformations & PNG_EXPAND)
1196 { 1207 {
1197 if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) 1208 if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
1198 { 1209 {
1199 if (png_ptr->num_trans && 1210 if (png_ptr->num_trans)
1200 (png_ptr->transformations & PNG_EXPAND_tRNS))
1201 info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA; 1211 info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
1202 else 1212 else
1203 info_ptr->color_type = PNG_COLOR_TYPE_RGB; 1213 info_ptr->color_type = PNG_COLOR_TYPE_RGB;
1204 info_ptr->bit_depth = 8; 1214 info_ptr->bit_depth = 8;
1205 info_ptr->num_trans = 0; 1215 info_ptr->num_trans = 0;
1206 } 1216 }
1207 else 1217 else
1208 { 1218 {
1209 if (png_ptr->num_trans) 1219 if (png_ptr->num_trans)
1210 { 1220 {
(...skipping 3237 matching lines...) Expand 10 before | Expand all | Expand 10 after
4448 *(rp ) = (png_byte)((red >> 8) & 0xff); 4458 *(rp ) = (png_byte)((red >> 8) & 0xff);
4449 *(rp+1) = (png_byte)(red & 0xff); 4459 *(rp+1) = (png_byte)(red & 0xff);
4450 *(rp+4) = (png_byte)((blue >> 8) & 0xff); 4460 *(rp+4) = (png_byte)((blue >> 8) & 0xff);
4451 *(rp+5) = (png_byte)(blue & 0xff); 4461 *(rp+5) = (png_byte)(blue & 0xff);
4452 } 4462 }
4453 } 4463 }
4454 } 4464 }
4455 } 4465 }
4456 #endif /* PNG_MNG_FEATURES_SUPPORTED */ 4466 #endif /* PNG_MNG_FEATURES_SUPPORTED */
4457 #endif /* PNG_READ_SUPPORTED */ 4467 #endif /* PNG_READ_SUPPORTED */
OLDNEW
« no previous file with comments | « third_party/libpng/pngmem.c ('k') | third_party/libpng/pngrutil.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698