From 6abea7562b1999764d684fabb0756e22ae39bf53 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sat, 8 Aug 2009 16:52:06 -0500 Subject: [PATCH] [devel] Change "trans" to "trans_alpha" --- png.c | 4 ++-- png.h | 8 ++++---- pngget.c | 10 +++++----- pngread.c | 4 ++-- pngrtran.c | 34 +++++++++++++++++----------------- pngset.c | 10 +++++----- pngtest.c | 6 +++--- pngwrite.c | 4 ++-- pngwutil.c | 4 ++-- 9 files changed, 42 insertions(+), 42 deletions(-) diff --git a/png.c b/png.c index a12ec74f9..b4c602051 100644 --- a/png.c +++ b/png.c @@ -344,8 +344,8 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask, if ((mask & PNG_FREE_TRNS) && (png_ptr->flags & PNG_FLAG_FREE_TRNS)) #endif { - png_free(png_ptr, info_ptr->trans); - info_ptr->trans = NULL; + png_free(png_ptr, info_ptr->trans_alpha); + info_ptr->trans_alpha = NULL; info_ptr->valid &= ~PNG_INFO_tRNS; #ifndef PNG_FREE_ME_SUPPORTED png_ptr->flags &= ~PNG_FLAG_FREE_TRNS; diff --git a/png.h b/png.h index a58ed7dca..441467e42 100644 --- a/png.h +++ b/png.h @@ -729,7 +729,7 @@ defined(PNG_READ_BACKGROUND_SUPPORTED) * single color specified that should be treated as fully transparent. * Data is valid if (valid & PNG_INFO_tRNS) is non-zero. */ - png_bytep trans; /* alpha values for paletted image */ + png_bytep trans_alpha; /* alpha values for paletted image */ png_color_16 trans_color; /* transparent color for non-palette image */ #endif @@ -1194,7 +1194,7 @@ struct png_struct_def #if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \ || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) - png_bytep trans; /* alpha values for paletted files */ + png_bytep trans_alpha; /* alpha values for paletted files */ png_color_16 trans_color; /* transparent color for non-paletted files */ #endif @@ -2298,13 +2298,13 @@ extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr, #if defined(PNG_tRNS_SUPPORTED) extern PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_bytep *trans, int *num_trans, + png_infop info_ptr, png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)); #endif #if defined(PNG_tRNS_SUPPORTED) extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_bytep trans, int num_trans, + png_infop info_ptr, png_bytep trans_alpha, int num_trans, png_color_16p trans_color)); #endif diff --git a/pngget.c b/pngget.c index c464fc0d9..41a56ab98 100644 --- a/pngget.c +++ b/pngget.c @@ -801,7 +801,7 @@ png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time) #if defined(PNG_tRNS_SUPPORTED) png_uint_32 PNGAPI png_get_tRNS(png_structp png_ptr, png_infop info_ptr, - png_bytep *trans, int *num_trans, png_color_16p *trans_color) + png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color) { png_uint_32 retval = 0; if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS)) @@ -809,9 +809,9 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr, png_debug1(1, "in %s retrieval function", "tRNS"); if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) { - if (trans != NULL) + if (trans_alpha != NULL) { - *trans = info_ptr->trans; + *trans_alpha = info_ptr->trans_alpha; retval |= PNG_INFO_tRNS; } @@ -826,8 +826,8 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr, retval |= PNG_INFO_tRNS; } - if (trans != NULL) - *trans = NULL; + if (trans_alpha != NULL) + *trans_alpha = NULL; } if (num_trans != NULL) { diff --git a/pngread.c b/pngread.c index bec2776d9..93dacc82c 100644 --- a/pngread.c +++ b/pngread.c @@ -1078,11 +1078,11 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) #ifdef PNG_FREE_ME_SUPPORTED if (png_ptr->free_me & PNG_FREE_TRNS) - png_free(png_ptr, png_ptr->trans); + png_free(png_ptr, png_ptr->trans_alpha); png_ptr->free_me &= ~PNG_FREE_TRNS; #else if (png_ptr->flags & PNG_FLAG_FREE_TRNS) - png_free(png_ptr, png_ptr->trans); + png_free(png_ptr, png_ptr->trans_alpha); png_ptr->flags &= ~PNG_FLAG_FREE_TRNS; #endif #endif diff --git a/pngrtran.c b/pngrtran.c index b374b339c..7fd083da5 100644 --- a/pngrtran.c +++ b/pngrtran.c @@ -859,7 +859,7 @@ png_init_read_transformations(png_structp png_ptr) int i, istop; istop=(int)png_ptr->num_trans; for (i=0; itrans[i] = (png_byte)(255 - png_ptr->trans[i]); + png_ptr->trans_alpha[i] = (png_byte)(255 - png_ptr->trans_alpha[i]); } } #endif @@ -881,7 +881,7 @@ png_init_read_transformations(png_structp png_ptr) k=0; for (i=0; inum_trans; i++) { - if (png_ptr->trans[i] != 0 && png_ptr->trans[i] != 0xff) + if (png_ptr->trans_alpha[i] != 0 && png_ptr->trans_alpha[i] != 0xff) k=1; /* Partial transparency is present */ } if (k == 0) @@ -963,26 +963,26 @@ png_init_read_transformations(png_structp png_ptr) } for (i = 0; i < num_palette; i++) { - if (i < (int)png_ptr->num_trans && png_ptr->trans[i] != 0xff) + if (i < (int)png_ptr->num_trans && png_ptr->trans_alpha[i] != 0xff) { - if (png_ptr->trans[i] == 0) + if (png_ptr->trans_alpha[i] == 0) { palette[i] = back; } - else /* if (png_ptr->trans[i] != 0xff) */ + else /* if (png_ptr->trans_alpha[i] != 0xff) */ { png_byte v, w; v = png_ptr->gamma_to_1[palette[i].red]; - png_composite(w, v, png_ptr->trans[i], back_1.red); + png_composite(w, v, png_ptr->trans_alpha[i], back_1.red); palette[i].red = png_ptr->gamma_from_1[w]; v = png_ptr->gamma_to_1[palette[i].green]; - png_composite(w, v, png_ptr->trans[i], back_1.green); + png_composite(w, v, png_ptr->trans_alpha[i], back_1.green); palette[i].green = png_ptr->gamma_from_1[w]; v = png_ptr->gamma_to_1[palette[i].blue]; - png_composite(w, v, png_ptr->trans[i], back_1.blue); + png_composite(w, v, png_ptr->trans_alpha[i], back_1.blue); palette[i].blue = png_ptr->gamma_from_1[w]; } } @@ -1102,19 +1102,19 @@ png_init_read_transformations(png_structp png_ptr) for (i = 0; i < istop; i++) { - if (png_ptr->trans[i] == 0) + if (png_ptr->trans_alpha[i] == 0) { palette[i] = back; } - else if (png_ptr->trans[i] != 0xff) + else if (png_ptr->trans_alpha[i] != 0xff) { /* The png_composite() macro is defined in png.h */ png_composite(palette[i].red, palette[i].red, - png_ptr->trans[i], back.red); + png_ptr->trans_alpha[i], back.red); png_composite(palette[i].green, palette[i].green, - png_ptr->trans[i], back.green); + png_ptr->trans_alpha[i], back.green); png_composite(palette[i].blue, palette[i].blue, - png_ptr->trans[i], back.blue); + png_ptr->trans_alpha[i], back.blue); } } @@ -1334,7 +1334,7 @@ png_do_read_transformations(png_structp png_ptr) if (png_ptr->row_info.color_type == PNG_COLOR_TYPE_PALETTE) { png_do_expand_palette(&(png_ptr->row_info), png_ptr->row_buf + 1, - png_ptr->palette, png_ptr->trans, png_ptr->num_trans); + png_ptr->palette, png_ptr->trans_alpha, png_ptr->num_trans); } else { @@ -3506,7 +3506,7 @@ png_do_gamma(png_row_infop row_info, png_bytep row, */ void /* PRIVATE */ png_do_expand_palette(png_row_infop row_info, png_bytep row, - png_colorp palette, png_bytep trans, int num_trans) + png_colorp palette, png_bytep trans_alpha, int num_trans) { int shift, value; png_bytep sp, dp; @@ -3597,7 +3597,7 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row, { case 8: { - if (trans != NULL) + if (trans_alpha != NULL) { sp = row + (png_size_t)row_width - 1; dp = row + (png_size_t)(row_width << 2) - 1; @@ -3607,7 +3607,7 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row, if ((int)(*sp) >= num_trans) *dp-- = 0xff; else - *dp-- = trans[*sp]; + *dp-- = trans_alpha[*sp]; *dp-- = palette[*sp].blue; *dp-- = palette[*sp].green; *dp-- = palette[*sp].red; diff --git a/pngset.c b/pngset.c index 6e9d21780..ec31c44a6 100644 --- a/pngset.c +++ b/pngset.c @@ -886,16 +886,16 @@ png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time) #if defined(PNG_tRNS_SUPPORTED) void PNGAPI png_set_tRNS(png_structp png_ptr, png_infop info_ptr, - png_bytep trans, int num_trans, png_color_16p trans_color) + png_bytep trans_alpha, int num_trans, png_color_16p trans_color) { png_debug1(1, "in %s storage function", "tRNS"); if (png_ptr == NULL || info_ptr == NULL) return; - if (trans != NULL) + if (trans_alpha != NULL) { /* - * It may not actually be necessary to set png_ptr->trans here; + * It may not actually be necessary to set png_ptr->trans_alpha here; * we do it for backward compatibility with the way the png_handle_tRNS * function used to do the allocation. */ @@ -905,10 +905,10 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr, #endif /* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */ - png_ptr->trans = info_ptr->trans = (png_bytep)png_malloc(png_ptr, + png_ptr->trans_alpha = info_ptr->trans_alpha = (png_bytep)png_malloc(png_ptr, (png_size_t)PNG_MAX_PALETTE_LENGTH); if (num_trans > 0 && num_trans <= PNG_MAX_PALETTE_LENGTH) - png_memcpy(info_ptr->trans, trans, (png_size_t)num_trans); + png_memcpy(info_ptr->trans_alpha, trans_alpha, (png_size_t)num_trans); } if (trans_color != NULL) diff --git a/pngtest.c b/pngtest.c index 93b37b993..53a683e2d 100644 --- a/pngtest.c +++ b/pngtest.c @@ -1045,11 +1045,11 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) #endif #if defined(PNG_tRNS_SUPPORTED) { - png_bytep trans; + png_bytep trans_alpha; int num_trans; png_color_16p trans_color; - if (png_get_tRNS(read_ptr, read_info_ptr, &trans, &num_trans, + if (png_get_tRNS(read_ptr, read_info_ptr, &trans_alpha, &num_trans, &trans_color)) { int sample_max = (1 << read_info_ptr->bit_depth); @@ -1060,7 +1060,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) ((int)trans_color->red > sample_max || (int)trans_color->green > sample_max || (int)trans_color->blue > sample_max)))) - png_set_tRNS(write_ptr, write_info_ptr, trans, num_trans, + png_set_tRNS(write_ptr, write_info_ptr, trans_alpha, num_trans, trans_color); } } diff --git a/pngwrite.c b/pngwrite.c index 29cc3d709..9e03c9881 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -157,10 +157,10 @@ png_write_info(png_structp png_ptr, png_infop info_ptr) { int j; for (j=0; j<(int)info_ptr->num_trans; j++) - info_ptr->trans[j] = (png_byte)(255 - info_ptr->trans[j]); + info_ptr->trans_alpha[j] = (png_byte)(255 - info_ptr->trans_alpha[j]); } #endif - png_write_tRNS(png_ptr, info_ptr->trans, &(info_ptr->trans_color), + png_write_tRNS(png_ptr, info_ptr->trans_alpha, &(info_ptr->trans_color), info_ptr->num_trans, info_ptr->color_type); } #endif diff --git a/pngwutil.c b/pngwutil.c index 5f1e35b05..9c92e33b8 100644 --- a/pngwutil.c +++ b/pngwutil.c @@ -1082,7 +1082,7 @@ png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x, #if defined(PNG_WRITE_tRNS_SUPPORTED) /* Write the tRNS chunk */ void /* PRIVATE */ -png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran, +png_write_tRNS(png_structp png_ptr, png_bytep trans_alpha, png_color_16p tran, int num_trans, int color_type) { #ifdef PNG_USE_LOCAL_ARRAYS @@ -1099,7 +1099,7 @@ png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran, return; } /* Write the chunk out as it is */ - png_write_chunk(png_ptr, (png_bytep)png_tRNS, trans, + png_write_chunk(png_ptr, (png_bytep)png_tRNS, trans_alpha, (png_size_t)num_trans); } else if (color_type == PNG_COLOR_TYPE_GRAY)