X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/706b88074de0c288b81edac13094dd052b6cc078..1454b4426152f97530538f002f5d72cd1007155a:/src/png/pngwtran.c diff --git a/src/png/pngwtran.c b/src/png/pngwtran.c index 94d8ecc1ce..398fc41be6 100644 --- a/src/png/pngwtran.c +++ b/src/png/pngwtran.c @@ -1,9 +1,9 @@ /* pngwtran.c - transforms the data in a row for PNG writers * - * libpng version 1.2.7 - September 12, 2004 + * Last changed in libpng 1.2.9 April 14, 2006 * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2004 Glenn Randers-Pehrson + * Copyright (c) 1998-2006 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.) */ @@ -18,14 +18,14 @@ void /* PRIVATE */ png_do_write_transformations(png_structp png_ptr) { - png_debug(1, "in png_do_write_transformations\n"); + png_debug(1, "in png_do_write_transformations"); if (png_ptr == NULL) return; #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) if (png_ptr->transformations & PNG_USER_TRANSFORM) - if(png_ptr->write_user_transform_fn != NULL) + if (png_ptr->write_user_transform_fn != NULL) (*(png_ptr->write_user_transform_fn)) /* user write transform function */ (png_ptr, /* png_ptr */ &(png_ptr->row_info), /* row_info: */ @@ -60,14 +60,14 @@ png_do_write_transformations(png_structp png_ptr) png_do_shift(&(png_ptr->row_info), png_ptr->row_buf + 1, &(png_ptr->shift)); #endif -#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) - if (png_ptr->transformations & PNG_INVERT_ALPHA) - png_do_write_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1); -#endif #if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) if (png_ptr->transformations & PNG_SWAP_ALPHA) png_do_write_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1); #endif +#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) + if (png_ptr->transformations & PNG_INVERT_ALPHA) + png_do_write_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif #if defined(PNG_WRITE_BGR_SUPPORTED) if (png_ptr->transformations & PNG_BGR) png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1); @@ -86,7 +86,7 @@ png_do_write_transformations(png_structp png_ptr) void /* PRIVATE */ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth) { - png_debug(1, "in png_do_pack\n"); + png_debug(1, "in png_do_pack"); if (row_info->bit_depth == 8 && #if defined(PNG_USELESS_TESTS_SUPPORTED) row != NULL && row_info != NULL && @@ -212,7 +212,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth) void /* PRIVATE */ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth) { - png_debug(1, "in png_do_shift\n"); + png_debug(1, "in png_do_shift"); #if defined(PNG_USELESS_TESTS_SUPPORTED) if (row != NULL && row_info != NULL && #else @@ -336,7 +336,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth) void /* PRIVATE */ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row) { - png_debug(1, "in png_do_write_swap_alpha\n"); + png_debug(1, "in png_do_write_swap_alpha"); #if defined(PNG_USELESS_TESTS_SUPPORTED) if (row != NULL && row_info != NULL) #endif @@ -424,7 +424,7 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row) void /* PRIVATE */ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row) { - png_debug(1, "in png_do_write_invert_alpha\n"); + png_debug(1, "in png_do_write_invert_alpha"); #if defined(PNG_USELESS_TESTS_SUPPORTED) if (row != NULL && row_info != NULL) #endif @@ -439,9 +439,12 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row) png_uint_32 row_width = row_info->width; for (i = 0, sp = dp = row; i < row_width; i++) { + /* does nothing *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); + */ + sp+=3; dp = sp; *(dp++) = (png_byte)(255 - *(sp++)); } } @@ -454,12 +457,15 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row) for (i = 0, sp = dp = row; i < row_width; i++) { + /* does nothing *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); + */ + sp+=6; dp = sp; *(dp++) = (png_byte)(255 - *(sp++)); *(dp++) = (png_byte)(255 - *(sp++)); } @@ -489,8 +495,11 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row) for (i = 0, sp = dp = row; i < row_width; i++) { + /* does nothing *(dp++) = *(sp++); *(dp++) = *(sp++); + */ + sp+=2; dp = sp; *(dp++) = (png_byte)(255 - *(sp++)); *(dp++) = (png_byte)(255 - *(sp++)); } @@ -505,7 +514,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row) void /* PRIVATE */ png_do_write_intrapixel(png_row_infop row_info, png_bytep row) { - png_debug(1, "in png_do_write_intrapixel\n"); + png_debug(1, "in png_do_write_intrapixel"); if ( #if defined(PNG_USELESS_TESTS_SUPPORTED) row != NULL && row_info != NULL && @@ -549,8 +558,8 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row) 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) & 0xffffL); - png_uint_32 blue = (png_uint_32)((s2-s1) & 0xffffL); + png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL); + png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL); *(rp ) = (png_byte)((red >> 8) & 0xff); *(rp+1) = (png_byte)(red & 0xff); *(rp+4) = (png_byte)((blue >> 8) & 0xff);