svnno****@sourc*****
svnno****@sourc*****
2008年 10月 8日 (水) 00:56:20 JST
Revision: 62 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=swfed&view=rev&rev=62 Author: yoya Date: 2008-10-08 00:56:20 +0900 (Wed, 08 Oct 2008) Log Message: ----------- 変数名 png_info, info_ptr を png_info_ptr に統一 Modified Paths: -------------- src/swf_png.c -------------- next part -------------- Modified: src/swf_png.c =================================================================== --- src/swf_png.c 2008-10-07 09:10:28 UTC (rev 61) +++ src/swf_png.c 2008-10-07 15:56:20 UTC (rev 62) @@ -81,7 +81,7 @@ unsigned short *width, unsigned short *height, void **colormap, int *colormap_count) { volatile png_structp png_ptr = NULL; - volatile png_infop png_info = NULL; + volatile png_infop png_info_ptr = NULL; my_png_buffer png_buff; int is_png; int bpp, color_type; @@ -109,7 +109,7 @@ if (setjmp(png_jmpbuf(png_ptr))) { fprintf(stderr, "pngconv_png2lossless: libpng error jump occured\n"); png_destroy_read_struct((png_structpp) &png_ptr, - (png_infopp) &png_info, NULL); + (png_infopp) &png_info_ptr, NULL); if (png_image_data) { for ( y = 0 ; y < png_height ; y++) { free(png_image_data[y]); @@ -118,8 +118,8 @@ } return NULL; } - png_info = png_create_info_struct(png_ptr); - if (! png_info) { + png_info_ptr = png_create_info_struct(png_ptr); + if (! png_info_ptr) { fprintf(stderr, "pngconv_png2lossless: can't create info_struct\n"); png_destroy_read_struct ((png_structpp)&png_ptr, NULL, NULL); return NULL; @@ -129,8 +129,8 @@ png_buff.data_offset = 0; png_data_read(png_ptr, &png_buff); - png_read_info(png_ptr, png_info); - png_get_IHDR(png_ptr, png_info, + png_read_info(png_ptr, png_info_ptr); + png_get_IHDR(png_ptr, png_info_ptr, &png_width, &png_height, &bpp, &color_type, NULL, NULL, NULL); *width = (unsigned short) png_width; @@ -138,8 +138,8 @@ switch(color_type) { case PNG_COLOR_TYPE_PALETTE: *format = 3; - png_get_PLTE(png_ptr, png_info, &palette, &palette_num); - if (png_get_tRNS(png_ptr, png_info, &trans, &num_trans, + png_get_PLTE(png_ptr, png_info_ptr, &palette, &palette_num); + if (png_get_tRNS(png_ptr, png_info_ptr, &trans, &num_trans, &trans_values) && (num_trans > 0)) { *tag_no = 36; // DefineBitsLossless2 } else { @@ -153,25 +153,25 @@ case PNG_COLOR_TYPE_RGB_ALPHA: *format = 5; *tag_no = 36; /* DefineBitsLossless2 */ - if (png_get_valid(png_ptr, png_info, PNG_INFO_tRNS)) + if (png_get_valid(png_ptr, png_info_ptr, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr); break; default: fprintf(stderr, "pngconv_png2lossless: color_type=%d not implemented yet.\n", color_type); png_destroy_read_struct((png_structpp)&png_ptr, - (png_infopp)&png_info, NULL); + (png_infopp)&png_info_ptr, NULL); return NULL; } if (bpp != 8) { fprintf(stderr, "pngconv_png2lossless: bpp=%d not implemented yet. accept only bpp=8\n", bpp); png_destroy_read_struct((png_structpp)&png_ptr, - (png_infopp)&png_info, NULL); + (png_infopp)&png_info_ptr, NULL); return NULL; } png_image_data = (png_bytepp) malloc(png_height * sizeof(png_bytep)); for (y=0; y < png_height; y++) { - png_image_data[y] = (png_bytep) malloc(png_get_rowbytes(png_ptr, png_info)); + png_image_data[y] = (png_bytep) malloc(png_get_rowbytes(png_ptr, png_info_ptr)); } png_read_image(png_ptr, png_image_data); /* @@ -241,7 +241,7 @@ * destruct */ png_destroy_read_struct((png_structpp) &png_ptr, - (png_infopp) &png_info, NULL); + (png_infopp) &png_info_ptr, NULL); return image_data; } @@ -253,7 +253,7 @@ int tag_no, int format, unsigned long *length) { volatile png_structp png_ptr = NULL; - volatile png_infop info_ptr = NULL; + volatile png_infop png_info_ptr = NULL; volatile my_png_buffer png_buff; png_uint_32 png_width = 0, png_height = 0; int bpp, color_type; @@ -280,11 +280,11 @@ } free(png_buff.data); png_destroy_write_struct((png_structpp) &png_ptr, - (png_infopp) &info_ptr); + (png_infopp) &png_info_ptr); return NULL; } - info_ptr = png_create_info_struct(png_ptr); - if (! info_ptr) { + png_info_ptr = png_create_info_struct(png_ptr); + if (! png_info_ptr) { fprintf(stderr, "jpegconv_lossless2png: can't create info_struct\n"); png_destroy_write_struct((png_structpp) &png_ptr, NULL); return NULL; @@ -303,11 +303,11 @@ fprintf(stderr, "jpegconv_lossless2png: format!=3 and tag_no=%d not implemented.\n", tag_no); png_destroy_write_struct((png_structpp) &png_ptr, - (png_infopp) &info_ptr); + (png_infopp) &png_info_ptr); return NULL; } png_set_filter(png_ptr, 0, PNG_ALL_FILTERS); - png_set_IHDR(png_ptr, info_ptr, + png_set_IHDR(png_ptr, png_info_ptr, png_width, png_height, bpp, color_type, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); @@ -316,7 +316,7 @@ if (index_data_count == 0) { fprintf(stderr, "jpegconv_lossless2png: index_data_count == 0 at line(%d)\n", __LINE__); png_destroy_write_struct((png_structpp) &png_ptr, - (png_infopp) &info_ptr); + (png_infopp) &png_info_ptr); return NULL; } png_palette = (png_colorp) malloc(sizeof(png_color)*index_data_count); @@ -337,14 +337,14 @@ // png_palette[i].alpha = rgba_list[i].alpha; } } - png_set_PLTE( png_ptr, info_ptr, png_palette, index_data_count); + png_set_PLTE( png_ptr, png_info_ptr, png_palette, index_data_count); free(png_palette); } - png_set_gAMA(png_ptr, info_ptr, 1.0); + png_set_gAMA(png_ptr, png_info_ptr, 1.0); png_image_data = (png_bytepp) malloc(png_height * sizeof(png_bytep)); if (color_type == PNG_COLOR_TYPE_PALETTE) { for (y=0; y < png_height; y++) { - png_image_data[y] = (png_bytep) malloc(png_get_rowbytes(png_ptr, info_ptr)); + png_image_data[y] = (png_bytep) malloc(png_get_rowbytes(png_ptr, png_info_ptr)); for (x=0; x < png_width; x++) { unsigned char *data = image_data; png_image_data[y][x] = data[x + y*((png_width +3) & -4)]; @@ -354,7 +354,7 @@ } else if (color_type == PNG_COLOR_TYPE_RGB) { swf_xrgb_t *xrgb_list = image_data; for (y=0; y < png_height; y++) { - png_image_data[y] = (png_bytep) malloc(png_get_rowbytes(png_ptr, info_ptr)) \ + png_image_data[y] = (png_bytep) malloc(png_get_rowbytes(png_ptr, png_info_ptr)) \ ; for (x=0; x < png_width; x++) { png_image_data[y][3*x] = xrgb_list[x+y*png_width].red; @@ -365,7 +365,7 @@ } else { swf_argb_t *argb_list = image_data; for (y=0; y < png_height; y++) { - png_image_data[y] = (png_bytep) malloc(png_get_rowbytes(png_ptr, info_ptr)); + png_image_data[y] = (png_bytep) malloc(png_get_rowbytes(png_ptr, png_info_ptr)); for (x=0; x < png_width; x++) { png_image_data[y][4*x] = argb_list[x+y*png_width].red; png_image_data[y][4*x+1] = argb_list[x+y*png_width].green; @@ -380,16 +380,16 @@ png_buff.data_offset = 0; png_data_write((png_structp) png_ptr, (my_png_buffer*) &png_buff); - png_write_info(png_ptr, info_ptr); + png_write_info(png_ptr, png_info_ptr); png_write_image(png_ptr, png_image_data); - png_write_end(png_ptr, info_ptr); + png_write_end(png_ptr, png_info_ptr); // for (y=0; y < png_height; y++) { free(png_image_data[y]); } free(png_image_data); png_destroy_write_struct((png_structpp) &png_ptr, - (png_infopp) &info_ptr); + (png_infopp) &png_info_ptr); *length = png_buff.data_offset; return png_buff.data; }