Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 280065 Details for
Bug 362637
media-gfx/graphicsmagick-1.3.12 fails with libpng-1.5
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Upstream patches to build with libpng 1.5
graphicsmagick-1.3.12-png15.patch (text/plain), 75.88 KB, created by
Jonathan Callen (RETIRED)
on 2011-07-14 17:43:47 UTC
(
hide
)
Description:
Upstream patches to build with libpng 1.5
Filename:
MIME Type:
Creator:
Jonathan Callen (RETIRED)
Created:
2011-07-14 17:43:47 UTC
Size:
75.88 KB
patch
obsolete
>This patch combines the following changesets: > ># HG changeset patch ># User Glenn Randers-Pehrson <glennrp@comcast.net> ># Date 1269095488 18000 ># Node ID dbd750f6c173c8308ee0f72e01d6b5fefb1d3a5f ># Parent 1a34907f22d81a6815699fd6933a836189768911 >Eliminated some of the deprecated direct access to ping_info->members. > >There are still many more to fix. This is necessary in order to build with >libpng-1.5. > ># HG changeset patch ># User Glenn Randers-Pehrson <glennrp@comcast.net> ># Date 1269097681 18000 ># Node ID 26d1813360fba9f296cc671327872f00ad119dec ># Parent dbd750f6c173c8308ee0f72e01d6b5fefb1d3a5f >Eliminated more deprecated direct accesses to members of ping_info. > ># HG changeset patch ># User Glenn Randers-Pehrson <glennrp@comcast.net> ># Date 1269108190 18000 ># Node ID 83a1aa3cb27b174c2d3b9dc28f225f974b425271 ># Parent 26d1813360fba9f296cc671327872f00ad119dec >Initialized new png_info_* variables to zero. > ># HG changeset patch ># User Glenn Randers-Pehrson <glennrp@comcast.net> ># Date 1269132845 18000 ># Node ID 9dd38e78f3639e7893b2d8dbd490fcb4c96b6f4c ># Parent 83a1aa3cb27b174c2d3b9dc28f225f974b425271 >Fixed a few more deprecated direct references to ping_info struct members. > ># HG changeset patch ># User Glenn Randers-Pehrson <glennrp@comcast.net> ># Date 1269139592 18000 ># Node ID be11a55295a0b17a9b498239fe9329445be19c77 ># Parent 9dd38e78f3639e7893b2d8dbd490fcb4c96b6f4c >More deprecated usage eliminated from coders/png.c > ># HG changeset patch ># User Glenn Randers-Pehrson <glennrp@comcast.net> ># Date 1269141110 18000 ># Node ID 90470635ad86571fe1b9ec89aa40165fee35bccf ># Parent be11a55295a0b17a9b498239fe9329445be19c77 >Eliminated support of very old libpng versions (1.0.11 and earlier). > ># HG changeset patch ># User Glenn Randers-Pehrson <glennrp@comcast.net> ># Date 1269141898 18000 ># Node ID 02ac3c72b16aabac92b762646f0f57c1219afc4b ># Parent 90470635ad86571fe1b9ec89aa40165fee35bccf >final coders/png.c cleanup. > ># HG changeset patch ># User Glenn Randers-Pehrson <glennrp@comcast.net> ># Date 1269142545 18000 ># Node ID 55659c82c626a3b256e30525758947b9413e4ecb ># Parent 02ac3c72b16aabac92b762646f0f57c1219afc4b >coders/png.c: eliminated use of ping_info->rowbytes. > ># HG changeset patch ># User Glenn Randers-Pehrson <glennrp@comcast.net> ># Date 1269485348 18000 ># Node ID 4ec5a5a25cc6b8735f7f4aa39b393888fcf8f869 ># Parent 42ea10b6bc50a128c859a9374ece029d34868fd1 >A ")" was missing. > >--- a/coders/png.c >+++ b/coders/png.c >@@ -88,26 +88,7 @@ > #include "zlib.h" > > >-/* >- * TO DO: rewrite using png_get_tRNS() instead of direct access to the >- * ping and ping_info structs. >- */ >-#if PNG_LIBPNG_VER < 10400 >-# define trans_color trans_values /* Changed at libpng-1.4.0beta35 */ >-# define trans_alpha trans /* Changed at libpng-1.4.0beta74 */ >-#else >- /* We could parse PNG_LIBPNG_VER_STRING here but it's too much bother.. >- * Just don't use libpng-1.4.0beta32-34 or beta67-73 >- */ >-# ifndef PNG_USER_CHUNK_CACHE_MAX /* Added at libpng-1.4.0beta32 */ >-# define trans_color trans_values /* Changed at libpng-1.4.0beta35 */ >-# endif >-# ifndef PNG_TRANSFORM_GRAY_TO_RGB /* Added at libpng-1.4.0beta67 */ >-# define trans_alpha trans /* Changed at libpng-1.4.0beta74 */ >-# endif >-#endif >- >-#if PNG_LIBPNG_VER > 95 >+#if PNG_LIBPNG_VER > 10011 > /* > Optional declarations. Define or undefine them as you like. > */ >@@ -164,10 +145,6 @@ static SemaphoreInfo > PNG_MNG_FEATURES_SUPPORTED is disabled by default in libpng-1.0.9 and > will be enabled by default in libpng-1.2.0. > */ >-#if (PNG_LIBPNG_VER == 10009) /* work around libpng-1.0.9 bug */ >-# undef PNG_READ_EMPTY_PLTE_SUPPORTED >-# undef PNG_WRITE_EMPTY_PLTE_SUPPORTED >-#endif > #ifdef PNG_MNG_FEATURES_SUPPORTED > # ifndef PNG_READ_EMPTY_PLTE_SUPPORTED > # define PNG_READ_EMPTY_PLTE_SUPPORTED >@@ -492,7 +469,6 @@ static const char* PngColorTypeToString( > return result; > } > >-#if PNG_LIBPNG_VER > 95 > #if defined(PNG_SORT_PALETTE) > /* > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >@@ -785,7 +761,6 @@ static MagickPassFail CompressColormapTr > return(MagickPass); > } > #endif >-#endif /* PNG_LIBPNG_VER > 95 */ > #endif /* HasPNG */ > > /* >@@ -907,7 +882,7 @@ static MagickPassFail IsPNG(const unsign > extern "C" { > #endif > >-#if (PNG_LIBPNG_VER > 95) >+#if (PNG_LIBPNG_VER > 10011) > static size_t WriteBlobMSBULong(Image *image,const unsigned long value) > { > unsigned char >@@ -956,13 +931,13 @@ static void LogPNGChunk(int logging, png > " Writing %c%c%c%c chunk, length: %lu", > type[0],type[1],type[2],type[3],length); > } >-#endif /* PNG_LIBPNG_VER > 95 */ >+#endif /* PNG_LIBPNG_VER > 10011 */ > > #if defined(__cplusplus) || defined(c_plusplus) > } > #endif > >-#if PNG_LIBPNG_VER > 95 >+#if PNG_LIBPNG_VER > 10011 > /* > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > % % >@@ -1351,7 +1326,11 @@ static void PNGErrorHandler(png_struct * > " libpng-%.1024s error: %.1024s", > PNG_LIBPNG_VER_STRING, message); > (void) ThrowException2(&image->exception,CoderError,message,image->filename); >+#if (PNG_LIBPNG_VER < 10500) > longjmp(ping->jmpbuf,1); >+#else >+ png_longjmp(ping,1); >+#endif > } > > static void PNGWarningHandler(png_struct *ping,png_const_charp message) >@@ -1372,19 +1351,8 @@ static void PNGWarningHandler(png_struct > #ifdef PNG_USER_MEM_SUPPORTED > static png_voidp png_IM_malloc(png_structp png_ptr,png_uint_32 size) > { >-#if (PNG_LIBPNG_VER < 10011) >- png_voidp >- ret; >- >- png_ptr=png_ptr; >- ret=MagickAllocateMemory(png_voidp,(size_t) size); >- if (ret == NULL) >- png_error("Insufficient memory."); >- return (ret); >-#else > png_ptr=png_ptr; > return MagickAllocateMemory(png_voidp,(size_t) size); >-#endif > } > > /* >@@ -1560,11 +1528,24 @@ static Image *ReadOnePNGImage(MngInfo *m > logging, > num_text, > num_passes, >- pass; >+ pass, >+ ping_info_bit_depth, >+ ping_info_color_type, >+ ping_info_interlace_method, >+ ping_info_compression_method, >+ ping_info_filter_method, >+ ping_info_num_trans; > > PixelPacket > transparent_color; > >+ png_bytep >+ ping_trans_alpha; >+ >+ png_color_16p >+ ping_background, >+ ping_trans_color; >+ > png_info > *end_info, > *ping_info; >@@ -1572,6 +1553,11 @@ static Image *ReadOnePNGImage(MngInfo *m > png_struct > *ping; > >+ png_uint_32 >+ ping_rowbytes, >+ ping_info_width, >+ ping_info_height; >+ > png_textp > text; > >@@ -1619,23 +1605,12 @@ static Image *ReadOnePNGImage(MngInfo *m > LockSemaphoreInfo(png_semaphore); > #endif > >-#if (PNG_LIBPNG_VER < 10007) >+#if (PNG_LIBPNG_VER < 10012) > if (image_info->verbose) > printf("Your PNG library (libpng-%s) is rather old.\n", > PNG_LIBPNG_VER_STRING); > #endif > >-#if (PNG_LIBPNG_VER >= 10400) >-# ifndef PNG_TRANSFORM_GRAY_TO_RGB /* Added at libpng-1.4.0beta67 */ >- if (image_info->verbose) >- { >- printf("Your PNG library (libpng-%s) is an old beta version.\n", >- PNG_LIBPNG_VER_STRING); >- printf("Please update it.\n"); >- } >-# endif >-#endif >- > image=mng_info->image; > > /* >@@ -1665,7 +1640,7 @@ static Image *ReadOnePNGImage(MngInfo *m > ThrowReaderException(ResourceLimitError,MemoryAllocationFailed,image); > } > png_pixels=(unsigned char *) NULL; >- if (setjmp(ping->jmpbuf)) >+ if (setjmp(png_jmpbuf(ping))) > { > /* > PNG image is corrupt. >@@ -1740,18 +1715,34 @@ static Image *ReadOnePNGImage(MngInfo *m > > png_read_info(ping,ping_info); > >+ (void) png_get_IHDR(ping,ping_info, >+ &ping_info_width, >+ &ping_info_height, >+ &ping_info_bit_depth, >+ &ping_info_color_type, >+ &ping_info_interlace_method, >+ &ping_info_compression_method, >+ &ping_info_filter_method); >+ >+ (void) png_get_tRNS(ping, ping_info, &ping_trans_alpha, &ping_info_num_trans, >+ &ping_trans_color); >+ >+ (void) png_get_bKGD(ping, ping_info, &ping_background); >+ >+ ping_rowbytes=png_get_rowbytes(ping,ping_info); >+ > #if (QuantumDepth == 8) > image->depth=8; > #else >- if (ping_info->bit_depth > 8) >+ if (ping_info_bit_depth > 8) > image->depth=16; > else > image->depth=8; > #endif > >- if (ping_info->bit_depth < 8) >+ if (ping_info_bit_depth < 8) > { >- if ((ping_info->color_type == PNG_COLOR_TYPE_PALETTE)) >+ if (ping_info_color_type == PNG_COLOR_TYPE_PALETTE) > { > png_set_packing(ping); > image->depth=8; >@@ -1761,21 +1752,22 @@ static Image *ReadOnePNGImage(MngInfo *m > { > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " PNG width: %lu, height: %lu", >- (unsigned long)ping_info->width, >- (unsigned long)ping_info->height); >+ (unsigned long)ping_info_width, >+ (unsigned long)ping_info_height); > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " PNG color_type: %d, bit_depth: %d", >- ping_info->color_type, ping_info->bit_depth); >+ ping_info_color_type, ping_info_bit_depth); > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " PNG compression_method: %d", >- ping_info->compression_type); >+ ping_info_compression_method); > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " PNG interlace_method: %d, filter_method: %d", >- ping_info->interlace_type,ping_info->filter_type); >+ ping_info_interlace_method, >+ ping_info_filter_method); > } > >-#if (PNG_LIBPNG_VER > 10008) && defined(PNG_READ_iCCP_SUPPORTED) >- if (ping_info->valid & PNG_INFO_iCCP) >+#if defined(PNG_READ_iCCP_SUPPORTED) >+ if (png_get_valid(ping, ping_info, PNG_INFO_iCCP)) > { > int > compression; >@@ -1803,15 +1795,19 @@ static Image *ReadOnePNGImage(MngInfo *m > } > } > } >-#endif /* #if (PNG_LIBPNG_VER > 10008) && defined(PNG_READ_iCCP_SUPPORTED) */ >+#endif /* #if defined(PNG_READ_iCCP_SUPPORTED) */ > #if defined(PNG_READ_sRGB_SUPPORTED) > { > int > intent; > >- if (mng_info->have_global_srgb) >- image->rendering_intent=(RenderingIntent) >- (mng_info->global_srgb_intent+1); >+ if (!png_get_sRGB(ping,ping_info,&intent)) >+ { >+ if (mng_info->have_global_srgb) >+ { >+ png_set_sRGB(ping,ping_info,(mng_info->global_srgb_intent+1)); >+ } >+ } > if (png_get_sRGB(ping,ping_info,&intent)) > { > image->rendering_intent=(RenderingIntent) (intent+1); >@@ -1827,8 +1823,11 @@ static Image *ReadOnePNGImage(MngInfo *m > double > file_gamma; > >- if (mng_info->have_global_gama) >- image->gamma=mng_info->global_gamma; >+ if (!png_get_gAMA(ping,ping_info,&file_gamma)) >+ { >+ if (mng_info->have_global_gama) >+ png_set_gAMA(ping,ping_info,mng_info->global_gamma); >+ } > if (png_get_gAMA(ping,ping_info,&file_gamma)) > { > image->gamma=(float) file_gamma; >@@ -1838,9 +1837,20 @@ static Image *ReadOnePNGImage(MngInfo *m > file_gamma); > } > } >- if (mng_info->have_global_chrm) >- image->chromaticity=mng_info->global_chrm; >- if (ping_info->valid & PNG_INFO_cHRM) >+ if (!png_get_valid(ping, ping_info, PNG_INFO_cHRM)) >+ { >+ if (mng_info->have_global_chrm) >+ (void) png_set_cHRM(ping,ping_info, >+ mng_info->global_chrm.white_point.x, >+ mng_info->global_chrm.white_point.y, >+ mng_info->global_chrm.red_primary.x, >+ mng_info->global_chrm.red_primary.y, >+ mng_info->global_chrm.green_primary.x, >+ mng_info->global_chrm.green_primary.y, >+ mng_info->global_chrm.blue_primary.x, >+ mng_info->global_chrm.blue_primary.y); >+ } >+ if (png_get_valid(ping, ping_info, PNG_INFO_cHRM)) > { > (void) png_get_cHRM(ping,ping_info, > &image->chromaticity.white_point.x, >@@ -1867,12 +1877,9 @@ static Image *ReadOnePNGImage(MngInfo *m > image->chromaticity.white_point.x=0.3127f; > image->chromaticity.white_point.y=0.3290f; > } >- if (mng_info->have_global_gama || image->rendering_intent) >- ping_info->valid|=PNG_INFO_gAMA; >- if (mng_info->have_global_chrm || image->rendering_intent) >- ping_info->valid|=PNG_INFO_cHRM; > #if defined(PNG_oFFs_SUPPORTED) >- if (mng_info->mng_type == 0 && (ping_info->valid & PNG_INFO_oFFs)) >+ if (mng_info->mng_type == 0 && (png_get_valid(ping, ping_info, >+ PNG_INFO_oFFs))) > { > image->page.x=png_get_x_offset_pixels(ping, ping_info); > image->page.y=png_get_y_offset_pixels(ping, ping_info); >@@ -1885,7 +1892,17 @@ static Image *ReadOnePNGImage(MngInfo *m > } > #endif > #if defined(PNG_pHYs_SUPPORTED) >- if (ping_info->valid & PNG_INFO_pHYs) >+ if (!png_get_valid(ping, ping_info, PNG_INFO_pHYs)) >+ { >+ if (mng_info->have_global_phys) >+ { >+ png_set_pHYs(ping,ping_info, >+ mng_info->global_x_pixels_per_unit, >+ mng_info->global_y_pixels_per_unit, >+ mng_info->global_phys_unit_type); >+ } >+ } >+ if (png_get_valid(ping, ping_info, PNG_INFO_pHYs)) > { > int > unit_type; >@@ -1915,25 +1932,8 @@ static Image *ReadOnePNGImage(MngInfo *m > (unsigned long)y_resolution, > unit_type); > } >- else >- { >- if (mng_info->have_global_phys) >- { >- image->x_resolution=(float) mng_info->global_x_pixels_per_unit; >- image->y_resolution=(float) mng_info->global_y_pixels_per_unit; >- if (mng_info->global_phys_unit_type == PNG_RESOLUTION_METER) >- { >- image->units=PixelsPerCentimeterResolution; >- image->x_resolution=(double) >- mng_info->global_x_pixels_per_unit/100.0; >- image->y_resolution=(double) >- mng_info->global_y_pixels_per_unit/100.0; >- } >- ping_info->valid|=PNG_INFO_pHYs; >- } >- } > #endif >- if (ping_info->valid & PNG_INFO_PLTE) >+ if (png_get_valid(ping, ping_info, PNG_INFO_PLTE)) > { > int > number_colors; >@@ -1942,14 +1942,14 @@ static Image *ReadOnePNGImage(MngInfo *m > palette; > > (void) png_get_PLTE(ping,ping_info,&palette,&number_colors); >- if (number_colors == 0 && ping_info->color_type == >+ if (number_colors == 0 && ping_info_color_type == > PNG_COLOR_TYPE_PALETTE) > { > if (mng_info->global_plte_length) > { > png_set_PLTE(ping,ping_info,mng_info->global_plte, > (int) mng_info->global_plte_length); >- if (!(ping_info->valid & PNG_INFO_tRNS)) >+ if (!(png_get_valid(ping, ping_info, PNG_INFO_tRNS))) > if (mng_info->global_trns_length) > { > if (mng_info->global_trns_length > >@@ -1966,7 +1966,7 @@ static Image *ReadOnePNGImage(MngInfo *m > #ifndef PNG_READ_EMPTY_PLTE_SUPPORTED > mng_info->have_saved_bkgd_index || > #endif >- ping_info->valid & PNG_INFO_bKGD) >+ png_get_valid(ping, ping_info, PNG_INFO_bKGD)) > { > png_color_16 > background; >@@ -1974,9 +1974,11 @@ static Image *ReadOnePNGImage(MngInfo *m > #ifndef PNG_READ_EMPTY_PLTE_SUPPORTED > if (mng_info->have_saved_bkgd_index) > background.index=mng_info->saved_bkgd_index; >- else > #endif >- background.index=ping_info->background.index; >+ if (png_get_valid(ping, ping_info, PNG_INFO_bKGD)) >+ { >+ background.index=ping_background->index; >+ } > background.red=(png_uint_16) > mng_info->global_plte[background.index].red; > background.green=(png_uint_16) >@@ -1995,34 +1997,37 @@ static Image *ReadOnePNGImage(MngInfo *m > } > > #if defined(PNG_READ_bKGD_SUPPORTED) >- if (mng_info->have_global_bkgd && !(ping_info->valid & PNG_INFO_bKGD)) >+ if (mng_info->have_global_bkgd && >+ !(png_get_valid(ping,ping_info, PNG_INFO_bKGD))) > image->background_color=mng_info->mng_global_bkgd; >- if (ping_info->valid & PNG_INFO_bKGD) >+ if (png_get_valid(ping, ping_info, PNG_INFO_bKGD)) > { > /* > Set image background color. > */ >+ > if (logging) > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " Reading PNG bKGD chunk."); >- if (ping_info->bit_depth <= QuantumDepth) >+ >+ if (ping_info_bit_depth <= QuantumDepth) > { >- image->background_color.red=ping_info->background.red; >- image->background_color.green=ping_info->background.green; >- image->background_color.blue=ping_info->background.blue; >+ image->background_color.red = ping_background->red; >+ image->background_color.green= ping_background->green; >+ image->background_color.blue = ping_background->blue; > } > else > { > image->background_color.red= >- ScaleShortToQuantum(ping_info->background.red); >+ ScaleShortToQuantum(ping_background->red); > image->background_color.green= >- ScaleShortToQuantum(ping_info->background.green); >+ ScaleShortToQuantum(ping_background->green); > image->background_color.blue= >- ScaleShortToQuantum(ping_info->background.blue); >+ ScaleShortToQuantum(ping_background->blue); > } > } > #endif >- if (ping_info->valid & PNG_INFO_tRNS) >+ if (png_get_valid(ping, ping_info, PNG_INFO_tRNS)) > { > int > bit_mask; >@@ -2031,20 +2036,21 @@ static Image *ReadOnePNGImage(MngInfo *m > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " Reading PNG tRNS chunk."); > >- bit_mask = (1 << ping_info->bit_depth) - 1; >+ bit_mask = (1 << ping_info_bit_depth) - 1; > > /* > Image has a transparent background. > */ >+ > transparent_color.red= >- (Quantum)(ping_info->trans_color.red & bit_mask); >+ (Quantum)(ping_trans_color->red & bit_mask); > transparent_color.green= >- (Quantum) (ping_info->trans_color.green & bit_mask); >+ (Quantum) (ping_trans_color->green & bit_mask); > transparent_color.blue= >- (Quantum) (ping_info->trans_color.blue & bit_mask); >+ (Quantum) (ping_trans_color->blue & bit_mask); > transparent_color.opacity= >- (Quantum) (ping_info->trans_color.gray & bit_mask); >- if (ping_info->color_type == PNG_COLOR_TYPE_GRAY) >+ (Quantum) (ping_trans_color->gray & bit_mask); >+ if (ping_info_color_type == PNG_COLOR_TYPE_GRAY) > { > transparent_color.red=transparent_color.opacity; > transparent_color.green=transparent_color.opacity; >@@ -2052,14 +2058,9 @@ static Image *ReadOnePNGImage(MngInfo *m > } > } > #if defined(PNG_READ_sBIT_SUPPORTED) >- if (mng_info->have_global_sbit) >- { >- int >- not_valid; >- not_valid=!ping_info->valid; >- if (not_valid & PNG_INFO_sBIT) >+ if (!png_get_valid(ping, ping_info, PNG_INFO_sBIT)) >+ if (mng_info->have_global_sbit) > png_set_sBIT(ping,ping_info,&mng_info->global_sbit); >- } > #endif > num_passes=png_set_interlace_handling(ping); > png_read_update_info(ping,ping_info); >@@ -2067,13 +2068,13 @@ static Image *ReadOnePNGImage(MngInfo *m > Initialize image structure. > */ > mng_info->image_box.left=0; >- mng_info->image_box.right=(long) ping_info->width; >+ mng_info->image_box.right=(long) ping_info_width; > mng_info->image_box.top=0; >- mng_info->image_box.bottom=(long) ping_info->height; >+ mng_info->image_box.bottom=(long) ping_info_height; > if (mng_info->mng_type == 0) > { >- mng_info->mng_width=ping_info->width; >- mng_info->mng_height=ping_info->height; >+ mng_info->mng_width=ping_info_width; >+ mng_info->mng_height=ping_info_height; > mng_info->frame=mng_info->image_box; > mng_info->clip=mng_info->image_box; > } >@@ -2082,14 +2083,14 @@ static Image *ReadOnePNGImage(MngInfo *m > image->page.y=mng_info->y_off[mng_info->object_id]; > } > image->compression=ZipCompression; >- image->columns=ping_info->width; >- image->rows=ping_info->height; >- if ((ping_info->color_type == PNG_COLOR_TYPE_PALETTE) || >- (ping_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) || >- (ping_info->color_type == PNG_COLOR_TYPE_GRAY)) >+ image->columns=ping_info_width; >+ image->rows=ping_info_height; >+ if ((ping_info_color_type == PNG_COLOR_TYPE_PALETTE) || >+ (ping_info_color_type == PNG_COLOR_TYPE_GRAY_ALPHA) || >+ (ping_info_color_type == PNG_COLOR_TYPE_GRAY)) > { > image->storage_class=PseudoClass; >- image->colors=1 << ping_info->bit_depth; >+ image->colors=1 << ping_info_bit_depth; > #if (QuantumDepth == 8) > if (image->colors > 256) > image->colors=256; >@@ -2097,7 +2098,7 @@ static Image *ReadOnePNGImage(MngInfo *m > if (image->colors > 65536L) > image->colors=65536L; > #endif >- if (ping_info->color_type == PNG_COLOR_TYPE_PALETTE) >+ if (ping_info_color_type == PNG_COLOR_TYPE_PALETTE) > { > int > number_colors; >@@ -2121,7 +2122,7 @@ static Image *ReadOnePNGImage(MngInfo *m > */ > if (!AllocateImageColormap(image,image->colors)) > ThrowReaderException(ResourceLimitError,MemoryAllocationFailed,image); >- if (ping_info->color_type == PNG_COLOR_TYPE_PALETTE) >+ if (ping_info_color_type == PNG_COLOR_TYPE_PALETTE) > { > int > number_colors; >@@ -2142,7 +2143,7 @@ static Image *ReadOnePNGImage(MngInfo *m > unsigned long > scale; > >- scale=(MaxRGB/((1 << ping_info->bit_depth)-1)); >+ scale=(MaxRGB/((1 << ping_info_bit_depth)-1)); > if (scale < 1) > scale=1; > for (i=0; i < (long) image->colors; i++) >@@ -2182,10 +2183,9 @@ static Image *ReadOnePNGImage(MngInfo *m > " Reading PNG IDAT chunk(s)"); > if (num_passes > 1) > png_pixels=MagickAllocateMemory(unsigned char *, >- ping_info->rowbytes*image->rows); >+ ping_rowbytes*image->rows); > else >- png_pixels=MagickAllocateMemory(unsigned char *, >- ping_info->rowbytes); >+ png_pixels=MagickAllocateMemory(unsigned char *, ping_rowbytes); > if (png_pixels == (unsigned char *) NULL) > ThrowReaderException(ResourceLimitError,MemoryAllocationFailed,image); > >@@ -2205,20 +2205,20 @@ static Image *ReadOnePNGImage(MngInfo *m > int > depth; > >- depth=(long) ping_info->bit_depth; >+ depth=(long) ping_info_bit_depth; > #endif >- image->matte=((ping_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) || >- (ping_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) || >- (ping_info->valid & PNG_INFO_tRNS)); >+ image->matte=((ping_info_color_type == PNG_COLOR_TYPE_RGB_ALPHA) || >+ (ping_info_color_type == PNG_COLOR_TYPE_GRAY_ALPHA) || >+ (png_get_valid(ping, ping_info, PNG_INFO_tRNS))); > > for (y=0; y < (long) image->rows; y++) > { > if (num_passes > 1) >- row_offset=ping_info->rowbytes*y; >+ row_offset=ping_rowbytes*y; > else > row_offset=0; > png_read_row(ping,png_pixels+row_offset,NULL); >- if (!SetImagePixels(image,0,y,image->columns,1)) /* Was GetImagePixels() */ >+ if (!SetImagePixels(image,0,y,image->columns,1)) > break; > #if (QuantumDepth == 8) > if (depth == 16) >@@ -2229,13 +2229,13 @@ static Image *ReadOnePNGImage(MngInfo *m > > r=png_pixels+row_offset; > p=r; >- if (ping_info->color_type == PNG_COLOR_TYPE_GRAY) >+ if (ping_info_color_type == PNG_COLOR_TYPE_GRAY) > { > for (x=(long) image->columns; x > 0; x--) > { > *r++=*p++; > p++; >- if ((ping_info->valid & PNG_INFO_tRNS) && >+ if ((png_get_valid(ping, ping_info, PNG_INFO_tRNS)) && > (((*(p-2) << 8)|*(p-1)) > == transparent_color.opacity)) > { >@@ -2246,9 +2246,9 @@ static Image *ReadOnePNGImage(MngInfo *m > *r++=OpaqueOpacity; > } > } >- else if (ping_info->color_type == PNG_COLOR_TYPE_RGB) >+ else if (ping_info_color_type == PNG_COLOR_TYPE_RGB) > { >- if (ping_info->valid & PNG_INFO_tRNS) >+ if (png_get_valid(ping, ping_info, PNG_INFO_tRNS)) > for (x=(long) image->columns; x > 0; x--) > { > *r++=*p++; >@@ -2282,25 +2282,25 @@ static Image *ReadOnePNGImage(MngInfo *m > *r++=OpaqueOpacity; > } > } >- else if (ping_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) >+ else if (ping_info_color_type == PNG_COLOR_TYPE_RGB_ALPHA) > for (x=(long) (4*image->columns); x > 0; x--) > { > *r++=*p++; > p++; > } >- else if (ping_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) >+ else if (ping_info_color_type == PNG_COLOR_TYPE_GRAY_ALPHA) > for (x=(long) (2*image->columns); x > 0; x--) > { > *r++=*p++; > p++; > } > } >- if (depth == 8 && ping_info->color_type == PNG_COLOR_TYPE_GRAY) >+ if (depth == 8 && ping_info_color_type == PNG_COLOR_TYPE_GRAY) > (void) ImportImagePixelArea(image,(QuantumType) GrayQuantum, > image->depth,png_pixels+ > row_offset,0,0); >- if (ping_info->color_type == PNG_COLOR_TYPE_GRAY || >- ping_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) >+ if (ping_info_color_type == PNG_COLOR_TYPE_GRAY || >+ ping_info_color_type == PNG_COLOR_TYPE_GRAY_ALPHA) > { > image->depth=8; > (void) ImportImagePixelArea(image, >@@ -2309,12 +2309,12 @@ static Image *ReadOnePNGImage(MngInfo *m > row_offset,0,0); > image->depth=depth; > } >- else if (depth == 8 && ping_info->color_type == PNG_COLOR_TYPE_RGB) >+ else if (depth == 8 && ping_info_color_type == PNG_COLOR_TYPE_RGB) > (void) ImportImagePixelArea(image,(QuantumType) RGBQuantum, > image->depth,png_pixels+ > row_offset,0,0); >- else if (ping_info->color_type == PNG_COLOR_TYPE_RGB || >- ping_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) >+ else if (ping_info_color_type == PNG_COLOR_TYPE_RGB || >+ ping_info_color_type == PNG_COLOR_TYPE_RGB_ALPHA) > { > image->depth=8; > (void) ImportImagePixelArea(image,(QuantumType) RGBAQuantum, >@@ -2322,28 +2322,28 @@ static Image *ReadOnePNGImage(MngInfo *m > row_offset,0,0); > image->depth=depth; > } >- else if (ping_info->color_type == PNG_COLOR_TYPE_PALETTE) >+ else if (ping_info_color_type == PNG_COLOR_TYPE_PALETTE) > (void) ImportImagePixelArea(image,(QuantumType) IndexQuantum, >- ping_info->bit_depth,png_pixels+ >+ ping_info_bit_depth,png_pixels+ > row_offset,0,0); > /* FIXME, sample size ??? */ > #else /* (QuantumDepth != 8) */ > >- if (ping_info->color_type == PNG_COLOR_TYPE_GRAY) >+ if (ping_info_color_type == PNG_COLOR_TYPE_GRAY) > (void) ImportImagePixelArea(image,(QuantumType) GrayQuantum, > image->depth,png_pixels+ > row_offset,0,0); >- else if (ping_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) >+ else if (ping_info_color_type == PNG_COLOR_TYPE_GRAY_ALPHA) > (void) ImportImagePixelArea(image,(QuantumType) GrayAlphaQuantum, > image->depth,png_pixels+ > row_offset,0,0); >- else if (ping_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) >+ else if (ping_info_color_type == PNG_COLOR_TYPE_RGB_ALPHA) > (void) ImportImagePixelArea(image,(QuantumType) RGBAQuantum, > image->depth,png_pixels+ > row_offset,0,0); >- else if (ping_info->color_type == PNG_COLOR_TYPE_PALETTE) >+ else if (ping_info_color_type == PNG_COLOR_TYPE_PALETTE) > (void) ImportImagePixelArea(image,(QuantumType) IndexQuantum, >- ping_info->bit_depth,png_pixels+ >+ ping_info_bit_depth,png_pixels+ > row_offset,0,0); > /* FIXME, sample size ??? */ > else >@@ -2372,7 +2372,7 @@ static Image *ReadOnePNGImage(MngInfo *m > /* > Convert grayscale image to PseudoClass pixel packets. > */ >- image->matte=ping_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA; >+ image->matte=ping_info_color_type == PNG_COLOR_TYPE_GRAY_ALPHA; > quantum_scanline=MagickAllocateMemory(Quantum *, > (image->matte ? 2 : 1) * > image->columns*sizeof(Quantum)); >@@ -2385,7 +2385,7 @@ static Image *ReadOnePNGImage(MngInfo *m > *p; > > if (num_passes > 1) >- row_offset=ping_info->rowbytes*y; >+ row_offset=ping_rowbytes*y; > else > row_offset=0; > png_read_row(ping,png_pixels+row_offset,NULL); >@@ -2395,7 +2395,7 @@ static Image *ReadOnePNGImage(MngInfo *m > indexes=AccessMutableIndexes(image); > p=png_pixels+row_offset; > r=quantum_scanline; >- switch (ping_info->bit_depth) >+ switch (ping_info_bit_depth) > { > case 1: > { >@@ -2445,7 +2445,7 @@ static Image *ReadOnePNGImage(MngInfo *m > } > case 8: > { >- if (ping_info->color_type == 4) >+ if (ping_info_color_type == 4) > for (x=(long) image->columns; x > 0; x--) > { > *r++=*p++; >@@ -2473,7 +2473,7 @@ static Image *ReadOnePNGImage(MngInfo *m > *r=0; > *r|=(*p++); > r++; >- if (ping_info->color_type == 4) >+ if (ping_info_color_type == 4) > { > q->opacity=((*p++) << 8); > q->opacity|=(*p++); >@@ -2488,7 +2488,7 @@ static Image *ReadOnePNGImage(MngInfo *m > *r=0; > *r|=(*p++); > r++; >- if (ping_info->color_type == 4) >+ if (ping_info_color_type == 4) > { > q->opacity=((*p++) << 8); > q->opacity|=(*p++); >@@ -2499,7 +2499,7 @@ static Image *ReadOnePNGImage(MngInfo *m > #else /* QuantumDepth == 8 */ > *r++=(*p++); > p++; /* strip low byte */ >- if (ping_info->color_type == 4) >+ if (ping_info_color_type == 4) > { > q->opacity=(Quantum) (MaxRGB-(*p++)); > p++; >@@ -2549,7 +2549,7 @@ static Image *ReadOnePNGImage(MngInfo *m > " exit ReadOnePNGImage()."); > return (image); > } >- if (ping_info->valid & PNG_INFO_tRNS) >+ if (png_get_valid(ping, ping_info, PNG_INFO_tRNS)) > { > ClassType > storage_class; >@@ -2572,18 +2572,18 @@ static Image *ReadOnePNGImage(MngInfo *m > IndexPacket > index; > >- if (ping_info->color_type == PNG_COLOR_TYPE_PALETTE) >+ if (ping_info_color_type == PNG_COLOR_TYPE_PALETTE) > for (x=0; x < (long) image->columns; x++) > { > index=indexes[x]; >- if (index < ping_info->num_trans) >+ if (index < ping_info_num_trans) > q->opacity= >- ScaleCharToQuantum(255-ping_info->trans_alpha[index]); >+ ScaleCharToQuantum(255-ping_trans_alpha[index]); > else > q->opacity=OpaqueOpacity; > q++; > } >- else if (ping_info->color_type == PNG_COLOR_TYPE_GRAY) >+ else if (ping_info_color_type == PNG_COLOR_TYPE_GRAY) > for (x=0; x < (long) image->columns; x++) > { > index=indexes[x]; >@@ -2714,7 +2714,7 @@ static Image *ReadOnePNGImage(MngInfo *m > mng_info->ob[object_id]->interlace_method=interlace_method; > mng_info->ob[object_id]->compression_method=compression_method; > mng_info->ob[object_id]->filter_method=filter_method; >- if (ping_info->valid & PNG_INFO_PLTE) >+ if (png_get_valid(ping, ping_info, PNG_INFO_PLTE)) > { > int > number_colors; >@@ -5734,7 +5734,7 @@ static Image *ReadMNGImage(const ImageIn > (void) LogMagickEvent(CoderEvent,GetMagickModule(),"exit ReadMNGImage()"); > return(image); > } >-#else /* PNG_LIBPNG_VER > 95 */ >+#else /* PNG_LIBPNG_VER > 10011 */ > static Image *ReadPNGImage(const ImageInfo *image_info, > ExceptionInfo *exception) > { >@@ -5749,7 +5749,7 @@ static Image *ReadMNGImage(const ImageIn > { > return (ReadPNGImage(image_info,exception)); > } >-#endif /* PNG_LIBPNG_VER > 95 */ >+#endif /* PNG_LIBPNG_VER > 10011 */ > #endif > > /* >@@ -5960,7 +5960,7 @@ ModuleExport void UnregisterPNGImage(voi > } > > #if defined(HasPNG) >-#if PNG_LIBPNG_VER > 95 >+#if PNG_LIBPNG_VER > 10011 > /* > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > % % >@@ -6043,20 +6043,6 @@ ModuleExport void UnregisterPNGImage(voi > */ > > >-#if (PNG_LIBPNG_VER > 99 && PNG_LIBPNG_VER < 10007) >-/* This function became available in libpng version 1.0.6g. */ >-static void >-png_set_compression_buffer_size(png_structp png_ptr, png_uint_32 size) >-{ >- if (png_ptr->zbuf) >- png_free(png_ptr, png_ptr->zbuf); png_ptr->zbuf=NULL; >- png_ptr->zbuf_size=(png_size_t) size; >- png_ptr->zbuf=(png_bytep) png_malloc(png_ptr, size); >- if (!png_ptr->zbuf) >- png_error(png_ptr,"Unable to allocate zbuf"); >-} >-#endif >- > static void > png_write_raw_profile(const ImageInfo *image_info,png_struct *ping, > png_info *ping_info, const char *profile_type, >@@ -6064,7 +6050,6 @@ png_write_raw_profile(const ImageInfo *i > const unsigned char *profile_data, > png_uint_32 length) > { >-#if (PNG_LIBPNG_VER > 10005) > png_textp > text; > >@@ -6083,25 +6068,12 @@ png_write_raw_profile(const ImageInfo *i > > unsigned char > hex[16]={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; >-#endif > >-#if (PNG_LIBPNG_VER <= 10005) >- if (image_info->verbose) >- (void) printf("Not "); >- (void) image_info; >- (void) ping; >- (void) ping_info; >- (void) profile_type; >- (void) profile_description; >- (void) profile_data; >- (void) length; >-#endif > if (image_info->verbose) > { > (void) printf("writing raw profile: type=%.1024s, length=%lu\n", > profile_type, (unsigned long)length); > } >-#if (PNG_LIBPNG_VER > 10005) > text=(png_textp) png_malloc(ping,(png_uint_32) sizeof(png_text)); > description_length=strlen((const char *) profile_description); > allocated_length=(png_uint_32) (length*2 + (length >> 5) + 20 >@@ -6137,7 +6109,6 @@ png_write_raw_profile(const ImageInfo *i > png_free(ping,text[0].text); > png_free(ping,text[0].key); > png_free(ping,text); >-#endif > } > > static MagickPassFail WriteOnePNGImage(MngInfo *mng_info, >@@ -6152,17 +6123,34 @@ static MagickPassFail WriteOnePNGImage(M > > int > num_passes, >- pass; >+ pass, >+ ping_info_bit_depth = 0, >+ ping_info_color_type = 0, >+ ping_info_interlace_method = 0, >+ ping_info_compression_method = 0, >+ ping_info_filter_method = 0, >+ ping_info_num_trans = 0; >+ >+ png_bytep >+ ping_trans_alpha = NULL; > > png_colorp > palette; > >+ png_color_16 >+ ping_background, >+ ping_trans_color; >+ > png_info > *ping_info; > > png_struct > *ping; > >+ png_uint_32 >+ ping_info_width, >+ ping_info_height; >+ > long > y; > >@@ -6181,8 +6169,7 @@ static MagickPassFail WriteOnePNGImage(M > image_depth, > image_matte, > logging, >- matte, >- not_valid; >+ matte; > > unsigned long > quantum_size, /* depth for ExportImage */ >@@ -6211,6 +6198,18 @@ static MagickPassFail WriteOnePNGImage(M > return MagickFail; > } > >+ /* Initialize some stuff */ >+ ping_background.red = 0; >+ ping_background.green = 0; >+ ping_background.blue = 0; >+ ping_background.gray = 0; >+ ping_background.index = 0; >+ >+ ping_trans_color.red=0; >+ ping_trans_color.green=0; >+ ping_trans_color.blue=0; >+ ping_trans_color.gray=0; >+ > image_colors=image->colors; > image_depth=image->depth; > image_matte=image->matte; >@@ -6259,7 +6258,7 @@ static MagickPassFail WriteOnePNGImage(M > LockSemaphoreInfo(png_semaphore); > #endif > >- if (setjmp(ping->jmpbuf)) >+ if (setjmp(png_jmpbuf(ping))) > { > /* > PNG write failed. >@@ -6288,16 +6287,16 @@ static MagickPassFail WriteOnePNGImage(M > # endif > #endif > x=0; >- ping_info->width=image->columns; >- ping_info->height=image->rows; >+ ping_info_width=image->columns; >+ ping_info_height=image->rows; > if (logging) > { > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " width=%lu", >- (unsigned long)ping_info->width); >+ (unsigned long)ping_info_width); > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " height=%lu", >- (unsigned long)ping_info->height); >+ (unsigned long)ping_info_height); > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " image->depth=%u",image_depth); > } >@@ -6306,12 +6305,12 @@ static MagickPassFail WriteOnePNGImage(M > quantum_size=(image_depth > 8) ? 16:8; > > save_image_depth=image_depth; >- ping_info->bit_depth=(png_byte) save_image_depth; >+ ping_info_bit_depth=(png_byte) save_image_depth; > if (logging) > { > (void) LogMagickEvent(CoderEvent,GetMagickModule(), >- " ping_info->bit_depth=%u", >- ping_info->bit_depth); >+ " ping_info_bit_depth=%u", >+ ping_info_bit_depth); > } > #if defined(PNG_pHYs_SUPPORTED) > if ((image->x_resolution != 0) && (image->y_resolution != 0) && >@@ -6398,8 +6397,8 @@ static MagickPassFail WriteOnePNGImage(M > matte=image_matte; > if (mng_info->write_png8) > { >- ping_info->color_type=PNG_COLOR_TYPE_PALETTE; >- ping_info->bit_depth=8; >+ ping_info_color_type=PNG_COLOR_TYPE_PALETTE; >+ ping_info_bit_depth=8; > { > /* TO DO: make this a function cause it's used twice, except > for reducing the sample depth from 8. */ >@@ -6425,12 +6424,12 @@ static MagickPassFail WriteOnePNGImage(M > number_colors); > } > if (matte) >- ping_info->valid|=PNG_INFO_tRNS; >+ png_set_invalid(ping,ping_info,PNG_INFO_tRNS); > /* > Set image palette. > */ >- ping_info->color_type=PNG_COLOR_TYPE_PALETTE; >- ping_info->valid|=PNG_INFO_PLTE; >+ ping_info_color_type=PNG_COLOR_TYPE_PALETTE; >+ png_set_invalid(ping,ping_info,PNG_INFO_PLTE); > #if defined(PNG_SORT_PALETTE) > save_number_colors=image_colors; > if (CompressColormapTransFirst(image) == MagickFail) >@@ -6465,20 +6464,17 @@ static MagickPassFail WriteOnePNGImage(M > > } > png_set_PLTE(ping,ping_info,palette,(int) number_colors); >-#if (PNG_LIBPNG_VER > 10008) > MagickFreeMemory(palette); >-#endif > /* > Identify which colormap entry is transparent. > */ >- ping_info->trans_alpha=MagickAllocateMemory(unsigned char *, >- number_colors); >- if (ping_info->trans_alpha == (unsigned char *) NULL) >+ ping_trans_alpha=MagickAllocateMemory(unsigned char *, number_colors); >+ if (ping_trans_alpha == (unsigned char *) NULL) > ThrowWriterException(ResourceLimitError,MemoryAllocationFailed, > image); > assert(number_colors <= 256); > for (i=0; i < (long) number_colors; i++) >- ping_info->trans_alpha[i]=255; >+ ping_trans_alpha[i]=255; > for (y=0; y < (long) image->rows; y++) > { > register const PixelPacket >@@ -6498,29 +6494,29 @@ static MagickPassFail WriteOnePNGImage(M > > index=indexes[x]; > assert((unsigned long) index < number_colors); >- ping_info->trans_alpha[index]=(png_byte) (255- >+ ping_trans_alpha[index]=(png_byte) (255- > ScaleQuantumToChar(p->opacity)); > } > p++; > } > } >- ping_info->num_trans=0; >+ ping_info_num_trans=0; > for (i=0; i < (long) number_colors; i++) >- if (ping_info->trans_alpha[i] != 255) >- ping_info->num_trans=(unsigned short) (i+1); >- if (ping_info->num_trans == 0) >- ping_info->valid&=(~PNG_INFO_tRNS); >- if (!(ping_info->valid & PNG_INFO_tRNS)) >- ping_info->num_trans=0; >- if (ping_info->num_trans == 0) >- MagickFreeMemory(ping_info->trans_alpha); >+ if (ping_trans_alpha[i] != 255) >+ ping_info_num_trans=(unsigned short) (i+1); >+ if (ping_info_num_trans == 0) >+ png_set_invalid(ping,ping_info,PNG_INFO_tRNS); >+ if (!(png_get_valid(ping,ping_info,PNG_INFO_tRNS))) >+ ping_info_num_trans=0; >+ if (ping_info_num_trans == 0) >+ MagickFreeMemory(ping_trans_alpha); > /* > Identify which colormap entry is the background color. > */ > for (i=0; i < (long) Max(number_colors-1,1); i++) >- if (RGBColorMatchExact(ping_info->background,image->colormap[i])) >+ if (RGBColorMatchExact(ping_background,image->colormap[i])) > break; >- ping_info->background.index=(png_uint_16) i; >+ ping_background.index=(png_uint_16) i; > } > if (image_matte) > { >@@ -6530,79 +6526,79 @@ static MagickPassFail WriteOnePNGImage(M > else if (mng_info->write_png24) > { > image_matte=MagickFalse; >- ping_info->color_type=PNG_COLOR_TYPE_RGB; >+ ping_info_color_type=PNG_COLOR_TYPE_RGB; > } > else if (mng_info->write_png32) > { > image_matte=MagickTrue; >- ping_info->color_type=PNG_COLOR_TYPE_RGB_ALPHA; >+ ping_info_color_type=PNG_COLOR_TYPE_RGB_ALPHA; > } > else > { >- if (ping_info->bit_depth < 8) >- ping_info->bit_depth=8; >+ if (ping_info_bit_depth < 8) >+ ping_info_bit_depth=8; > >- ping_info->color_type=PNG_COLOR_TYPE_RGB; >+ ping_info_color_type=PNG_COLOR_TYPE_RGB; > if (characteristics.monochrome) > { > if (characteristics.opaque) > { >- ping_info->color_type=PNG_COLOR_TYPE_GRAY; >- ping_info->bit_depth=1; >+ ping_info_color_type=PNG_COLOR_TYPE_GRAY; >+ ping_info_bit_depth=1; > } > else > { >- ping_info->color_type=PNG_COLOR_TYPE_GRAY_ALPHA; >+ ping_info_color_type=PNG_COLOR_TYPE_GRAY_ALPHA; > } > } > else if (characteristics.grayscale) > { > if (characteristics.opaque) >- ping_info->color_type=PNG_COLOR_TYPE_GRAY; >+ ping_info_color_type=PNG_COLOR_TYPE_GRAY; > else >- ping_info->color_type=PNG_COLOR_TYPE_GRAY_ALPHA; >+ ping_info_color_type=PNG_COLOR_TYPE_GRAY_ALPHA; > } > else if (characteristics.palette && image_colors <= 256) > { >- ping_info->color_type=PNG_COLOR_TYPE_PALETTE; >- ping_info->bit_depth=8; >+ ping_info_color_type=PNG_COLOR_TYPE_PALETTE; >+ ping_info_bit_depth=8; > mng_info->IsPalette=MagickTrue; > } > else > { > if (characteristics.opaque) >- ping_info->color_type=PNG_COLOR_TYPE_RGB; >+ ping_info_color_type=PNG_COLOR_TYPE_RGB; > else >- ping_info->color_type=PNG_COLOR_TYPE_RGB_ALPHA; >+ ping_info_color_type=PNG_COLOR_TYPE_RGB_ALPHA; > } > if (image_info->type == BilevelType) > { > if (characteristics.monochrome) > { > if (!image_matte) >- ping_info->bit_depth=1; >+ ping_info_bit_depth=1; > } > } > if (image_info->type == GrayscaleType) >- ping_info->color_type=PNG_COLOR_TYPE_GRAY; >+ ping_info_color_type=PNG_COLOR_TYPE_GRAY; > if (image_info->type == GrayscaleMatteType) >- ping_info->color_type=PNG_COLOR_TYPE_GRAY_ALPHA; >+ ping_info_color_type=PNG_COLOR_TYPE_GRAY_ALPHA; > /* if (!mng_info->optimize && matte) */ >- /* ping_info->color_type=PNG_COLOR_TYPE_RGB_ALPHA; */ >+ /* ping_info_color_type=PNG_COLOR_TYPE_RGB_ALPHA; */ > > if (logging) > { > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " Tentative PNG color type: %s (%d)", >- PngColorTypeToString(ping_info->color_type), >- ping_info->color_type); >+ PngColorTypeToString(ping_info_color_type), >+ ping_info_color_type); > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " image_info->type: %d",image_info->type); > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " image->depth: %u",image_depth); > (void) LogMagickEvent(CoderEvent,GetMagickModule(), >- " ping_info->bit_depth: %d", >- ping_info->bit_depth); >+ " ping_info_bit_depth: %d", >+ ping_info_bit_depth); > } > > if (matte && (mng_info->optimize || mng_info->IsPalette)) >@@ -6614,10 +6610,10 @@ static MagickPassFail WriteOnePNGImage(M > { > /* > No transparent pixels are present. Change 4 or 6 to 0 or 2, >- and do not set the PNG_INFO_tRNS flag in ping_info->valid. >+ and do not set the PNG_INFO_tRNS flag. > */ > image_matte=MagickFalse; >- ping_info->color_type&=0x03; >+ ping_info_color_type&=0x03; > } > else > { >@@ -6625,13 +6621,13 @@ static MagickPassFail WriteOnePNGImage(M > mask; > > mask=0xffff; >- if (ping_info->bit_depth == 8) >+ if (ping_info_bit_depth == 8) > mask=0x00ff; >- if (ping_info->bit_depth == 4) >+ if (ping_info_bit_depth == 4) > mask=0x000f; >- if (ping_info->bit_depth == 2) >+ if (ping_info_bit_depth == 2) > mask=0x0003; >- if (ping_info->bit_depth == 1) >+ if (ping_info_bit_depth == 1) > mask=0x0001; > > /* >@@ -6655,19 +6651,20 @@ static MagickPassFail WriteOnePNGImage(M > if ((p != (const PixelPacket *) NULL) && > (p->opacity != OpaqueOpacity)) > { >- ping_info->valid|=PNG_INFO_tRNS; >- ping_info->trans_color.red=ScaleQuantumToShort(p->red)&mask; >- ping_info->trans_color.green=ScaleQuantumToShort(p->green) >+ ping_trans_color.red=ScaleQuantumToShort(p->red)&mask; >+ ping_trans_color.green=ScaleQuantumToShort(p->green) > &mask; >- ping_info->trans_color.blue=ScaleQuantumToShort(p->blue) >+ ping_trans_color.blue=ScaleQuantumToShort(p->blue) > &mask; >- ping_info->trans_color.gray= >+ ping_trans_color.gray= > (png_uint_16) ScaleQuantumToShort(PixelIntensity(p))&mask; >- ping_info->trans_color.index=(unsigned char) >+ ping_trans_color.index=(unsigned char) > (ScaleQuantumToChar(MaxRGB-p->opacity)); >+ (void) png_set_tRNS(ping, ping_info, NULL, 0, >+ &ping_trans_color); > } > } >- if (ping_info->valid & PNG_INFO_tRNS) >+ if (png_get_valid(ping, ping_info, PNG_INFO_tRNS)) > { > /* > Determine if there is one and only one transparent color >@@ -6684,7 +6681,7 @@ static MagickPassFail WriteOnePNGImage(M > { > if (p->opacity != OpaqueOpacity) > { >- if (!RGBColorMatchExact(ping_info->trans_color,*p)) >+ if (!RGBColorMatchExact(ping_trans_color,*p)) > { > break; /* Can't use RGB + tRNS for multiple > transparent colors. */ >@@ -6697,7 +6694,7 @@ static MagickPassFail WriteOnePNGImage(M > } > else > { >- if (RGBColorMatchExact(ping_info->trans_color,*p)) >+ if (RGBColorMatchExact(ping_trans_color,*p)) > break; /* Can't use RGB + tRNS when another pixel > having the same RGB samples is > transparent. */ >@@ -6708,50 +6705,50 @@ static MagickPassFail WriteOnePNGImage(M > break; > } > if (x != 0) >- ping_info->valid&=(~PNG_INFO_tRNS); >+ png_set_invalid(ping, ping_info, PNG_INFO_tRNS); > } >- if (ping_info->valid & PNG_INFO_tRNS) >+ if (png_get_valid(ping, ping_info, PNG_INFO_tRNS)) > { >- ping_info->color_type &= 0x03; /* changes 4 or 6 to 0 or 2 */ >+ ping_info_color_type &= 0x03; /* changes 4 or 6 to 0 or 2 */ > if (image_depth == 8) > { >- ping_info->trans_color.red&=0xff; >- ping_info->trans_color.green&=0xff; >- ping_info->trans_color.blue&=0xff; >- ping_info->trans_color.gray&=0xff; >+ ping_trans_color.red&=0xff; >+ ping_trans_color.green&=0xff; >+ ping_trans_color.blue&=0xff; >+ ping_trans_color.gray&=0xff; > } > } > } > matte=image_matte; >- if (ping_info->valid & PNG_INFO_tRNS) >+ if (png_get_valid(ping, ping_info, PNG_INFO_tRNS)) > image_matte=MagickFalse; > if ((mng_info->optimize || mng_info->IsPalette) && > characteristics.grayscale && (!image_matte || image_depth >= 8)) > { > if (image_matte) >- ping_info->color_type=PNG_COLOR_TYPE_GRAY_ALPHA; >+ ping_info_color_type=PNG_COLOR_TYPE_GRAY_ALPHA; > else > { >- ping_info->color_type=PNG_COLOR_TYPE_GRAY; >+ ping_info_color_type=PNG_COLOR_TYPE_GRAY; > if (save_image_depth == 16 && image_depth == 8) >- ping_info->trans_color.gray*=0x0101; >+ ping_trans_color.gray*=0x0101; > } > if (image_depth > QuantumDepth) > image_depth=QuantumDepth; > if (image_colors == 0 || image_colors-1 > MaxRGB) > image_colors=1 << image_depth; > if (image_depth > 8) >- ping_info->bit_depth=16; >+ ping_info_bit_depth=16; > else > { >- if (ping_info->color_type == PNG_COLOR_TYPE_PALETTE) >+ if (ping_info_color_type == PNG_COLOR_TYPE_PALETTE) > { >- ping_info->bit_depth=1; >- while ((int) (1 << ping_info->bit_depth) < >+ ping_info_bit_depth=1; >+ while ((int) (1 << ping_info_bit_depth) < > (long) image_colors) >- ping_info->bit_depth <<= 1; >+ ping_info_bit_depth <<= 1; > } >- else if (mng_info->optimize && ping_info->color_type == >+ else if (mng_info->optimize && ping_info_color_type == > PNG_COLOR_TYPE_GRAY && image_colors < 17 && > mng_info->IsPalette) > { >@@ -6779,11 +6776,11 @@ static MagickPassFail WriteOnePNGImage(M > depth_1_ok=MagickFalse; > } > if (depth_1_ok) >- ping_info->bit_depth=1; >+ ping_info_bit_depth=1; > else if (depth_2_ok) >- ping_info->bit_depth=2; >+ ping_info_bit_depth=2; > else if (depth_4_ok) >- ping_info->bit_depth=4; >+ ping_info_bit_depth=4; > } > } > } >@@ -6797,12 +6794,11 @@ static MagickPassFail WriteOnePNGImage(M > > number_colors=image_colors; > if (matte) >- ping_info->valid|=PNG_INFO_tRNS; >+ png_set_invalid(ping, ping_info, PNG_INFO_tRNS); > /* > Set image palette. > */ >- ping_info->color_type=PNG_COLOR_TYPE_PALETTE; >- ping_info->valid|=PNG_INFO_PLTE; >+ ping_info_color_type=PNG_COLOR_TYPE_PALETTE; > if (mng_info->have_write_global_plte && !matte) > { > png_set_PLTE(ping,ping_info,NULL,0); >@@ -6847,14 +6843,12 @@ static MagickPassFail WriteOnePNGImage(M > " Setting up PLTE chunk with %d colors", > (int) number_colors); > png_set_PLTE(ping,ping_info,palette,(int) number_colors); >-#if (PNG_LIBPNG_VER > 10008) > MagickFreeMemory(palette); >-#endif > } >- ping_info->bit_depth=1; >- while ((1UL << ping_info->bit_depth) < number_colors) >- ping_info->bit_depth <<= 1; >- ping_info->num_trans=0; >+ ping_info_bit_depth=1; >+ while ((1UL << ping_info_bit_depth) < number_colors) >+ ping_info_bit_depth <<= 1; >+ ping_info_num_trans=0; > if (matte) > { > int >@@ -6890,7 +6884,7 @@ static MagickPassFail WriteOnePNGImage(M > if (trans_alpha[index] != (png_byte) (255- > ScaleQuantumToChar(p->opacity))) > { >- ping_info->color_type= >+ ping_info_color_type= > PNG_COLOR_TYPE_RGB_ALPHA; > break; > } >@@ -6900,11 +6894,11 @@ static MagickPassFail WriteOnePNGImage(M > } > p++; > } >- if (ping_info->color_type==PNG_COLOR_TYPE_RGB_ALPHA) >+ if (ping_info_color_type==PNG_COLOR_TYPE_RGB_ALPHA) > { >- ping_info->num_trans=0; >- ping_info->valid&=(~PNG_INFO_tRNS); >- ping_info->valid&=(~PNG_INFO_PLTE); >+ ping_info_num_trans=0; >+ png_set_invalid(ping, ping_info, PNG_INFO_tRNS); >+ png_set_invalid(ping, ping_info, PNG_INFO_PLTE); > mng_info->IsPalette=MagickFalse; > (void) SyncImage(image); > if (logging) >@@ -6916,40 +6910,40 @@ static MagickPassFail WriteOnePNGImage(M > break; > } > } >- if ((ping_info->valid & PNG_INFO_tRNS)) >+ if (png_get_valid(ping, ping_info, PNG_INFO_tRNS)) > { > for (i=0; i < (long) number_colors; i++) > { > if (trans_alpha[i] == 256) > trans_alpha[i]=255; > if (trans_alpha[i] != 255) >- ping_info->num_trans=(unsigned short) (i+1); >+ ping_info_num_trans=(unsigned short) (i+1); > } > } >- if (ping_info->num_trans == 0) >- ping_info->valid&=(~PNG_INFO_tRNS); >- if (!(ping_info->valid & PNG_INFO_tRNS)) >- ping_info->num_trans=0; >- if (ping_info->num_trans != 0) >+ if (ping_info_num_trans == 0) >+ png_set_invalid(ping, ping_info, PNG_INFO_tRNS); >+ if (!png_get_valid(ping, ping_info, PNG_INFO_tRNS)) >+ ping_info_num_trans=0; >+ if (ping_info_num_trans != 0) > { >- ping_info->trans_alpha=MagickAllocateMemory( >- unsigned char *, number_colors); >- if (ping_info->trans_alpha == (unsigned char *) NULL) >- ThrowWriterException(ResourceLimitError, >- MemoryAllocationFailed,image); >- for (i=0; i < (long) number_colors; i++) >- ping_info->trans_alpha[i]=(png_byte) trans_alpha[i]; >+ for (i=0; i<256; i++) >+ ping_trans_alpha[i]=(png_byte) trans_alpha[i]; > } >+ >+ (void) png_set_tRNS(ping, ping_info, >+ ping_trans_alpha, >+ ping_info_num_trans, >+ &ping_trans_color); > } > > /* > Identify which colormap entry is the background color. > */ > for (i=0; i < (long) Max(number_colors-1,1); i++) >- if (RGBColorMatchExact(ping_info->background, >+ if (RGBColorMatchExact(ping_background, > image->colormap[i])) > break; >- ping_info->background.index=(png_uint_16) i; >+ ping_background.index=(png_uint_16) i; > } > } > else >@@ -6958,10 +6952,10 @@ static MagickPassFail WriteOnePNGImage(M > image_depth=8; > if ((save_image_depth == 16) && (image_depth == 8)) > { >- ping_info->trans_color.red*=0x0101; >- ping_info->trans_color.green*=0x0101; >- ping_info->trans_color.blue*=0x0101; >- ping_info->trans_color.gray*=0x0101; >+ ping_trans_color.red*=0x0101; >+ ping_trans_color.green*=0x0101; >+ ping_trans_color.blue*=0x0101; >+ ping_trans_color.gray*=0x0101; > } > } > >@@ -6969,7 +6963,7 @@ static MagickPassFail WriteOnePNGImage(M > Adjust background and transparency samples in sub-8-bit > grayscale files. > */ >- if (ping_info->bit_depth < 8 && ping_info->color_type == >+ if (ping_info_bit_depth < 8 && ping_info_color_type == > PNG_COLOR_TYPE_GRAY) > { > png_uint_16 >@@ -6978,7 +6972,7 @@ static MagickPassFail WriteOnePNGImage(M > png_color_16 > background; > >- maxval=(1 << ping_info->bit_depth)-1; >+ maxval=(1 << ping_info_bit_depth)-1; > > > background.gray=(png_uint_16) >@@ -6989,28 +6983,26 @@ static MagickPassFail WriteOnePNGImage(M > " Setting up bKGD chunk"); > png_set_bKGD(ping,ping_info,&background); > >- ping_info->trans_color.gray=(png_uint_16)(maxval* >- ping_info->trans_color.gray/ >- MaxRGB); >+ ping_trans_color.gray=(png_uint_16)(maxval* >+ ping_trans_color.gray/ >+ MaxRGB); > } > } > if (logging) > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " PNG color type: %s (%d)", >- PngColorTypeToString(ping_info->color_type), >- ping_info->color_type); >+ PngColorTypeToString(ping_info_color_type), >+ ping_info_color_type); > /* > Initialize compression level and filtering. > */ > if (logging) > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " Setting up deflate compression"); >-#if (PNG_LIBPNG_VER > 99) > if (logging) > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " Compression buffer size: 32768"); > png_set_compression_buffer_size(ping,32768L); >-#endif > if (logging) > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " Compression mem level: 9"); >@@ -7044,7 +7036,7 @@ static MagickPassFail WriteOnePNGImage(M > if (logging) > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " Filter_type: PNG_INTRAPIXEL_DIFFERENCING"); >- ping_info->filter_type=PNG_INTRAPIXEL_DIFFERENCING; >+ ping_info_filter_method=PNG_INTRAPIXEL_DIFFERENCING; > } > else > if (logging) >@@ -7061,8 +7053,8 @@ static MagickPassFail WriteOnePNGImage(M > if ((image_info->quality % 10) != 5) > base_filter=(int) image_info->quality % 10; > else >- if ((ping_info->color_type == PNG_COLOR_TYPE_GRAY) || >- (ping_info->color_type == PNG_COLOR_TYPE_PALETTE) || >+ if ((ping_info_color_type == PNG_COLOR_TYPE_GRAY) || >+ (ping_info_color_type == PNG_COLOR_TYPE_PALETTE) || > (image_info->quality < 50)) > base_filter=PNG_NO_FILTERS; > else >@@ -7099,7 +7091,7 @@ static MagickPassFail WriteOnePNGImage(M > { > if (LocaleCompare(profile_name,"ICM") == 0) > { >-#if (PNG_LIBPNG_VER > 10008) && defined(PNG_WRITE_iCCP_SUPPORTED) >+#if defined(PNG_WRITE_iCCP_SUPPORTED) > { > if (logging) > (void) LogMagickEvent(CoderEvent,GetMagickModule(), >@@ -7170,8 +7162,8 @@ static MagickPassFail WriteOnePNGImage(M > (void) png_set_sRGB(ping,ping_info,PerceptualIntent); > png_set_gAMA(ping,ping_info,0.45455); > } >- not_valid=(!ping_info->valid); >- if ((!mng_info->write_mng) || not_valid & PNG_INFO_sRGB) >+ if ((!mng_info->write_mng) || >+ !png_get_valid(ping, ping_info, PNG_INFO_sRGB)) > #endif > { > if (!mng_info->have_write_global_gama && (image->gamma != 0.0)) >@@ -7210,7 +7202,7 @@ static MagickPassFail WriteOnePNGImage(M > bp.x,bp.y); > } > } >- ping_info->interlace_type=(image_info->interlace == LineInterlace); >+ ping_info_interlace_method=(image_info->interlace == LineInterlace); > > if (mng_info->write_mng) > png_set_sig_bytes(ping,8); >@@ -7219,6 +7211,15 @@ static MagickPassFail WriteOnePNGImage(M > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " Writing PNG header chunks"); > >+ png_set_IHDR(ping,ping_info, >+ ping_info_width, >+ ping_info_height, >+ ping_info_bit_depth, >+ ping_info_color_type, >+ ping_info_interlace_method, >+ ping_info_compression_method, >+ ping_info_filter_method); >+ > png_write_info(ping,ping_info); > > #if (PNG_LIBPNG_VER == 10206) >@@ -7313,7 +7314,7 @@ static MagickPassFail WriteOnePNGImage(M > { > if ((!mng_info->write_png8 && !mng_info->write_png24 && > !mng_info->write_png32) && >- (!image_matte || (ping_info->bit_depth >= QuantumDepth)) && >+ (!image_matte || (ping_info_bit_depth >= QuantumDepth)) && > (mng_info->optimize || mng_info->IsPalette) && > IsGrayImage(image,&image->exception)) > { >@@ -7325,7 +7326,7 @@ static MagickPassFail WriteOnePNGImage(M > if (!AcquireImagePixels(image,0,y,image->columns,1, > &image->exception)) > break; >- if (ping_info->color_type == PNG_COLOR_TYPE_GRAY) >+ if (ping_info_color_type == PNG_COLOR_TYPE_GRAY) > { > if (mng_info->IsPalette) > (void) ExportImagePixelArea(image, >@@ -7368,14 +7369,14 @@ static MagickPassFail WriteOnePNGImage(M > " pass %d, Image Is RGB," > " PNG colortype is %s (%d)",pass, > PngColorTypeToString( >- ping_info->color_type), >- ping_info->color_type); >+ ping_info_color_type), >+ ping_info_color_type); > for (y=0; y < (long) image->rows; y++) > { > if (!AcquireImagePixels(image,0,y,image->columns,1, > &image->exception)) > break; >- if (ping_info->color_type == PNG_COLOR_TYPE_GRAY) >+ if (ping_info_color_type == PNG_COLOR_TYPE_GRAY) > { > if (image->storage_class == DirectClass) > (void) ExportImagePixelArea(image,(QuantumType) >@@ -7388,7 +7389,7 @@ static MagickPassFail WriteOnePNGImage(M > quantum_size, > png_pixels,0,0); > } >- else if (ping_info->color_type == >+ else if (ping_info_color_type == > PNG_COLOR_TYPE_GRAY_ALPHA) > (void) ExportImagePixelArea(image,(QuantumType) > GrayAlphaQuantum, >@@ -7433,12 +7434,12 @@ static MagickPassFail WriteOnePNGImage(M > if (!AcquireImagePixels(image,0,y,image->columns,1, > &image->exception)) > break; >- if (ping_info->color_type == PNG_COLOR_TYPE_GRAY) >+ if (ping_info_color_type == PNG_COLOR_TYPE_GRAY) > (void) ExportImagePixelArea(image,(QuantumType) > GrayQuantum, > quantum_size, > png_pixels,0,0); >- else if (ping_info->color_type == >+ else if (ping_info_color_type == > PNG_COLOR_TYPE_GRAY_ALPHA) > (void) ExportImagePixelArea(image,(QuantumType) > GrayAlphaQuantum, >@@ -7471,38 +7472,32 @@ static MagickPassFail WriteOnePNGImage(M > " Writing PNG image data"); > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " Width: %lu", >- (unsigned long)ping_info->width); >+ (unsigned long)ping_info_width); > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " Height: %lu", >- (unsigned long)ping_info->height); >+ (unsigned long)ping_info_height); > (void) LogMagickEvent(CoderEvent,GetMagickModule(), >- " PNG sample depth: %d",ping_info->bit_depth); >+ " PNG sample depth: %d",ping_info_bit_depth); > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " PNG color type: %s (%d)", >- PngColorTypeToString(ping_info->color_type), >- ping_info->color_type); >+ PngColorTypeToString(ping_info_color_type), >+ ping_info_color_type); > (void) LogMagickEvent(CoderEvent,GetMagickModule(), > " PNG Interlace method: %d", >- ping_info->interlace_type); >+ ping_info_interlace_method); > } > /* > Generate text chunks. > */ >-#if (PNG_LIBPNG_VER <= 10005) >- ping_info->num_text=0; >-#endif > attribute=GetImageAttribute(image,(char *) NULL); > for ( ; attribute != (const ImageAttribute *) NULL; > attribute=attribute->next) > { >-#if (PNG_LIBPNG_VER > 10005) > png_textp > text; >-#endif > > if (*attribute->key == '[') > continue; >-#if (PNG_LIBPNG_VER > 10005) > text=(png_textp) png_malloc(ping,(png_uint_32) sizeof(png_text)); > text[0].key=attribute->key; > text[0].text=attribute->value; >@@ -7519,40 +7514,6 @@ static MagickPassFail WriteOnePNGImage(M > } > png_set_text(ping,ping_info,text,1); > png_free(ping,text); >-#else >- /* Work directly with ping_info struct; >- * png_set_text before libpng version >- * 1.0.5a is leaky */ >- if (ping_info->num_text == 0) >- { >- ping_info->text=MagickAllocateMemory(png_text *, >- 256*sizeof(png_text)); >- if (ping_info->text == (png_text *) NULL) >- (void) ThrowException(&image->exception,(ExceptionType) >- ResourceLimitError,MemoryAllocationFailed, >- image->filename); >- } >- i=ping_info->num_text++; >- if (i > 255) >- (void) ThrowException(&image->exception,(ExceptionType) >- ResourceLimitError, >- "Cannot write more than 256 PNG text chunks", >- image->filename); >- ping_info->text[i].key=attribute->key; >- ping_info->text[i].text=attribute->value; >- ping_info->text[i].text_length=strlen(attribute->value); >- ping_info->text[i].compression= >- image_info->compression == NoCompression || >- (image_info->compression == UndefinedCompression && >- ping_info->text[i].text_length < 128) ? -1 : 0; >- if (logging) >- { >- (void) LogMagickEvent(CoderEvent,GetMagickModule(), >- " Setting up text chunk"); >- (void) LogMagickEvent(CoderEvent,GetMagickModule(), >- " keyword: %s",ping_info->text[i].key); >- } >-#endif > } > if (logging) > (void) LogMagickEvent(CoderEvent,GetMagickModule(), >@@ -7560,9 +7521,9 @@ static MagickPassFail WriteOnePNGImage(M > png_write_end(ping,ping_info); > if (mng_info->need_fram && (int) image->dispose == BackgroundDispose) > { >- if (mng_info->page.x || mng_info->page.y || (ping_info->width != >+ if (mng_info->page.x || mng_info->page.y || (ping_info_width != > mng_info->page.width) || >- (ping_info->height != mng_info->page.height)) >+ (ping_info_height != mng_info->page.height)) > { > unsigned char > chunk[32]; >@@ -7583,10 +7544,10 @@ static MagickPassFail WriteOnePNGImage(M > chunk[14]=0; /* clipping boundaries delta type */ > PNGLong(chunk+15,(png_uint_32) (mng_info->page.x)); /* left cb */ > PNGLong(chunk+19,(png_uint_32) (mng_info->page.x + >- ping_info->width)); >+ ping_info_width)); > PNGLong(chunk+23,(png_uint_32) (mng_info->page.y)); /* top cb */ > PNGLong(chunk+27,(png_uint_32) (mng_info->page.y + >- ping_info->height)); >+ ping_info_height)); > (void) WriteBlob(image,31,(char *) chunk); > (void) WriteBlobMSBULong(image,crc32(0,chunk,31)); > mng_info->old_framing_mode=4; >@@ -7605,7 +7566,7 @@ static MagickPassFail WriteOnePNGImage(M > > /* Save depth actually written */ > >- s[0]=(char) ping_info->bit_depth; >+ s[0]=(char) ping_info_bit_depth; > s[1]='\0'; > > (void) SetImageAttribute(image,"[png:bit-depth-written]",s); >@@ -7613,18 +7574,6 @@ static MagickPassFail WriteOnePNGImage(M > /* > Free PNG resources. > */ >-#if (PNG_LIBPNG_VER < 10007) >- if (ping_info->valid & PNG_INFO_PLTE) >- { >- MagickFreeMemory(ping_info->palette); >- ping_info->valid&=(~PNG_INFO_PLTE); >- } >-#endif >- if (ping_info->valid & PNG_INFO_tRNS) >- { >- MagickFreeMemory(ping_info->trans_alpha); >- ping_info->valid&=(~PNG_INFO_tRNS); >- } > png_destroy_write_struct(&ping,&ping_info); > > MagickFreeMemory(png_pixels); >@@ -8365,23 +8314,12 @@ static unsigned int WriteMNGImage(const > final_delay=0, > initial_delay; > >-#if (PNG_LIBPNG_VER < 10007) >+#if (PNG_LIBPNG_VER < 10200) > if (image_info->verbose) > printf("Your PNG library (libpng-%s) is rather old.\n", > PNG_LIBPNG_VER_STRING); > #endif > >-#if (PNG_LIBPNG_VER >= 10400) >-# ifndef PNG_TRANSFORM_GRAY_TO_RGB /* Added at libpng-1.4.0beta67 */ >- if (image_info->verbose) >- { >- printf("Your PNG library (libpng-%s) is an old beta version.\n", >- PNG_LIBPNG_VER_STRING); >- printf("Please update it.\n"); >- } >-# endif >-#endif >- > /* > Open image file. > */ >@@ -9196,7 +9134,7 @@ static unsigned int WriteMNGImage(const > (void) LogMagickEvent(CoderEvent,GetMagickModule(),"exit WriteMNGImage()"); > return(MagickPass); > } >-#else /* PNG_LIBPNG_VER > 95 */ >+#else /* PNG_LIBPNG_VER > 10011 */ > static unsigned int WritePNGImage(const ImageInfo *image_info,Image *image) > { > image=image; >@@ -9208,5 +9146,5 @@ static unsigned int WriteMNGImage(const > { > return (WritePNGImage(image_info,image)); > } >-#endif /* PNG_LIBPNG_VER > 95 */ >+#endif /* PNG_LIBPNG_VER > 10011 */ > #endif
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 362637
:
269047
| 280065