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

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

Issue 15041: Update libpng to 1.2.33. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 12 years 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/pngwrite.c ('k') | third_party/libpng/pngwutil.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 /* pngwtran.c - transforms the data in a row for PNG writers 2 /* pngwtran.c - transforms the data in a row for PNG writers
3 * 3 *
4 * Last changed in libpng 1.2.9 April 14, 2006 4 * Last changed in libpng 1.2.9 April 14, 2006
5 * For conditions of distribution and use, see copyright notice in png.h 5 * For conditions of distribution and use, see copyright notice in png.h
6 * Copyright (c) 1998-2006 Glenn Randers-Pehrson 6 * Copyright (c) 1998-2006 Glenn Randers-Pehrson
7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) 8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
9 */ 9 */
10 10
11 #define PNG_INTERNAL 11 #define PNG_INTERNAL
12 #include "png.h" 12 #include "png.h"
13 #ifdef PNG_WRITE_SUPPORTED 13 #ifdef PNG_WRITE_SUPPORTED
14 14
15 /* Transform the data according to the user's wishes. The order of 15 /* Transform the data according to the user's wishes. The order of
16 * transformations is significant. 16 * transformations is significant.
17 */ 17 */
18 void /* PRIVATE */ 18 void /* PRIVATE */
19 png_do_write_transformations(png_structp png_ptr) 19 png_do_write_transformations(png_structp png_ptr)
20 { 20 {
21 png_debug(1, "in png_do_write_transformations\n"); 21 png_debug(1, "in png_do_write_transformations\n");
22 22
23 if (png_ptr == NULL) 23 if (png_ptr == NULL)
24 return; 24 return;
25 25
26 #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) 26 #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
27 if (png_ptr->transformations & PNG_USER_TRANSFORM) 27 if (png_ptr->transformations & PNG_USER_TRANSFORM)
28 if(png_ptr->write_user_transform_fn != NULL) 28 if (png_ptr->write_user_transform_fn != NULL)
29 (*(png_ptr->write_user_transform_fn)) /* user write transform function * / 29 (*(png_ptr->write_user_transform_fn)) /* user write transform function * /
30 (png_ptr, /* png_ptr */ 30 (png_ptr, /* png_ptr */
31 &(png_ptr->row_info), /* row_info: */ 31 &(png_ptr->row_info), /* row_info: */
32 /* png_uint_32 width; width of row */ 32 /* png_uint_32 width; width of row */
33 /* png_uint_32 rowbytes; number of bytes in row */ 33 /* png_uint_32 rowbytes; number of bytes in row */
34 /* png_byte color_type; color type of pixels */ 34 /* png_byte color_type; color type of pixels */
35 /* png_byte bit_depth; bit depth of samples */ 35 /* png_byte bit_depth; bit depth of samples */
36 /* png_byte channels; number of channels (1-4) */ 36 /* png_byte channels; number of channels (1-4) */
37 /* png_byte pixel_depth; bits per pixel (depth*channels) */ 37 /* png_byte pixel_depth; bits per pixel (depth*channels) */
38 png_ptr->row_buf + 1); /* start of pixel data for row */ 38 png_ptr->row_buf + 1); /* start of pixel data for row */
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) 551 else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
552 bytes_per_pixel = 8; 552 bytes_per_pixel = 8;
553 else 553 else
554 return; 554 return;
555 555
556 for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel) 556 for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
557 { 557 {
558 png_uint_32 s0 = (*(rp ) << 8) | *(rp+1); 558 png_uint_32 s0 = (*(rp ) << 8) | *(rp+1);
559 png_uint_32 s1 = (*(rp+2) << 8) | *(rp+3); 559 png_uint_32 s1 = (*(rp+2) << 8) | *(rp+3);
560 png_uint_32 s2 = (*(rp+4) << 8) | *(rp+5); 560 png_uint_32 s2 = (*(rp+4) << 8) | *(rp+5);
561 png_uint_32 red = (png_uint_32)((s0-s1) & 0xffffL); 561 png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
562 png_uint_32 blue = (png_uint_32)((s2-s1) & 0xffffL); 562 png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
563 *(rp ) = (png_byte)((red >> 8) & 0xff); 563 *(rp ) = (png_byte)((red >> 8) & 0xff);
564 *(rp+1) = (png_byte)(red & 0xff); 564 *(rp+1) = (png_byte)(red & 0xff);
565 *(rp+4) = (png_byte)((blue >> 8) & 0xff); 565 *(rp+4) = (png_byte)((blue >> 8) & 0xff);
566 *(rp+5) = (png_byte)(blue & 0xff); 566 *(rp+5) = (png_byte)(blue & 0xff);
567 } 567 }
568 } 568 }
569 } 569 }
570 } 570 }
571 #endif /* PNG_MNG_FEATURES_SUPPORTED */ 571 #endif /* PNG_MNG_FEATURES_SUPPORTED */
572 #endif /* PNG_WRITE_SUPPORTED */ 572 #endif /* PNG_WRITE_SUPPORTED */
OLDNEW
« no previous file with comments | « third_party/libpng/pngwrite.c ('k') | third_party/libpng/pngwutil.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698