summaryrefslogtreecommitdiff
path: root/community/widelands/6233_6232.diff
diff options
context:
space:
mode:
Diffstat (limited to 'community/widelands/6233_6232.diff')
-rw-r--r--community/widelands/6233_6232.diff59
1 files changed, 59 insertions, 0 deletions
diff --git a/community/widelands/6233_6232.diff b/community/widelands/6233_6232.diff
new file mode 100644
index 000000000..f82477607
--- /dev/null
+++ b/community/widelands/6233_6232.diff
@@ -0,0 +1,59 @@
+=== modified file 'src/graphic/graphic.cc'
+--- src/graphic/graphic.cc 2011-11-30 21:38:37 +0000
++++ src/graphic/graphic.cc 2012-02-19 17:10:12 +0000
+@@ -725,6 +725,18 @@
+ if (!png_ptr)
+ throw wexception("Graphic::save_png: could not create png struct");
+
++ png_infop info_ptr = png_create_info_struct(png_ptr);
++ if (!info_ptr) {
++ png_destroy_write_struct(&png_ptr, static_cast<png_infopp>(0));
++ throw wexception("Graphic::save_png: could not create png info struct");
++ }
++
++ // Set jump for error
++ if (setjmp(png_jmpbuf(png_ptr))) {
++ png_destroy_write_struct(&png_ptr, &info_ptr);
++ throw wexception("Graphic::save_png: Error writing PNG!");
++ }
++
+ // Set another write function. This is potentially dangerouse because the
+ // flush function is internally called by png_write_end(), this will crash
+ // on newer libpngs. See here:
+@@ -736,35 +748,14 @@
+ sw,
+ &Graphic::m_png_write_function, &Graphic::m_png_flush_function);
+
+- png_infop info_ptr = png_create_info_struct(png_ptr);
+-
+- if (!info_ptr) {
+- png_destroy_write_struct(&png_ptr, static_cast<png_infopp>(0));
+- throw wexception("Graphic::save_png: could not create png info struct");
+- }
+-
+- // Set jump for error
+- if (setjmp(png_jmpbuf(png_ptr))) {
+- png_destroy_write_struct(&png_ptr, &info_ptr);
+- throw wexception("Graphic::save_png: could not set png setjmp");
+- }
+-
+ // Fill info struct
+ png_set_IHDR
+ (png_ptr, info_ptr, pix.get_w(), pix.get_h(),
+ 8, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE,
+ PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
+
+- // png_set_strip_16(png_ptr) ;
+-
+ // Start writing
+ png_write_info(png_ptr, info_ptr);
+-
+- // Strip data down
+- png_set_filler(png_ptr, 0, PNG_FILLER_AFTER);
+-
+- png_set_packing(png_ptr);
+-
+ {
+ uint32_t surf_w = pix.get_w();
+ uint32_t surf_h = pix.get_h();
+