summaryrefslogtreecommitdiff
path: root/community-staging/widelands/6233_6232.diff
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2012-07-30 00:02:11 +0000
committerroot <root@rshg054.dnsready.net>2012-07-30 00:02:11 +0000
commit4982c269b318734d01ad30c6592fbb73565ceb12 (patch)
treef8696db6a843a65a264dbfed979f087b1d62c011 /community-staging/widelands/6233_6232.diff
parentddab05fd84b7fa1d67fcd18b532f0427189d8df1 (diff)
Mon Jul 30 00:02:11 UTC 2012
Diffstat (limited to 'community-staging/widelands/6233_6232.diff')
-rw-r--r--community-staging/widelands/6233_6232.diff59
1 files changed, 59 insertions, 0 deletions
diff --git a/community-staging/widelands/6233_6232.diff b/community-staging/widelands/6233_6232.diff
new file mode 100644
index 000000000..f82477607
--- /dev/null
+++ b/community-staging/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();
+