patch-src_modules_loaders_loader_png_c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. --- imlib2-1.4.4.orig/src/modules/loaders/loader_png.c 2010-02-11 21:02:11.000000000 +0100
  2. +++ imlib2-1.4.4/src/modules/loaders/loader_png.c 2011-03-29 21:33:23.221818699 +0200
  3. @@ -58,7 +58,7 @@ load(ImlibImage * im, ImlibProgressFunct
  4. fclose(f);
  5. return 0;
  6. }
  7. - if (setjmp(png_ptr->jmpbuf))
  8. + if (setjmp(png_jmpbuf(png_ptr)))
  9. {
  10. png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
  11. fclose(f);
  12. @@ -238,7 +238,7 @@ save(ImlibImage * im, ImlibProgressFunct
  13. png_structp png_ptr;
  14. png_infop info_ptr;
  15. DATA32 *ptr;
  16. - int x, y, j;
  17. + int x, y, j, interlace;
  18. png_bytep row_ptr, data = NULL;
  19. png_color_8 sig_bit;
  20. int pl = 0;
  21. @@ -265,7 +265,7 @@ save(ImlibImage * im, ImlibProgressFunct
  22. png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
  23. return 0;
  24. }
  25. - if (setjmp(png_ptr->jmpbuf))
  26. + if (setjmp(png_jmpbuf(png_ptr)))
  27. {
  28. fclose(f);
  29. png_destroy_write_struct(&png_ptr, (png_infopp) & info_ptr);
  30. @@ -274,11 +274,11 @@ save(ImlibImage * im, ImlibProgressFunct
  31. }
  32. /* check whether we should use interlacing */
  33. + interlace = PNG_INTERLACE_NONE;
  34. if ((tag = __imlib_GetTag(im, "interlacing")) && tag->val)
  35. {
  36. #ifdef PNG_WRITE_INTERLACING_SUPPORTED
  37. - png_ptr->interlaced = PNG_INTERLACE_ADAM7;
  38. - num_passes = png_set_interlace_handling(png_ptr);
  39. + interlace = PNG_INTERLACE_ADAM7;
  40. #endif
  41. }
  42. @@ -286,7 +286,7 @@ save(ImlibImage * im, ImlibProgressFunct
  43. if (im->flags & F_HAS_ALPHA)
  44. {
  45. png_set_IHDR(png_ptr, info_ptr, im->w, im->h, 8,
  46. - PNG_COLOR_TYPE_RGB_ALPHA, png_ptr->interlaced,
  47. + PNG_COLOR_TYPE_RGB_ALPHA, interlace,
  48. PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
  49. #ifdef WORDS_BIGENDIAN
  50. png_set_swap_alpha(png_ptr);
  51. @@ -297,7 +297,7 @@ save(ImlibImage * im, ImlibProgressFunct
  52. else
  53. {
  54. png_set_IHDR(png_ptr, info_ptr, im->w, im->h, 8, PNG_COLOR_TYPE_RGB,
  55. - png_ptr->interlaced, PNG_COMPRESSION_TYPE_BASE,
  56. + interlace, PNG_COMPRESSION_TYPE_BASE,
  57. PNG_FILTER_TYPE_BASE);
  58. data = malloc(im->w * 3 * sizeof(char));
  59. }
  60. @@ -344,6 +344,10 @@ save(ImlibImage * im, ImlibProgressFunct
  61. png_set_shift(png_ptr, &sig_bit);
  62. png_set_packing(png_ptr);
  63. +#ifdef PNG_WRITE_INTERLACING_SUPPORTED
  64. + num_passes = png_set_interlace_handling(png_ptr);
  65. +#endif
  66. +
  67. for (pass = 0; pass < num_passes; pass++)
  68. {
  69. ptr = im->data;