widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #03208
[Merge] lp:~tino79/widelands/fix_screenshots into lp:widelands
Tino has proposed merging lp:~tino79/widelands/fix_screenshots into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1397301 in widelands: "Screenshots black"
https://bugs.launchpad.net/widelands/+bug/1397301
For more details, see:
https://code.launchpad.net/~tino79/widelands/fix_screenshots/+merge/243182
When saving a screenshot don't use alpha channel
--
Your team Widelands Developers is requested to review the proposed merge of lp:~tino79/widelands/fix_screenshots into lp:widelands.
=== modified file 'src/graphic/image_io.cc'
--- src/graphic/image_io.cc 2014-11-24 07:10:03 +0000
+++ src/graphic/image_io.cc 2014-11-28 18:44:33 +0000
@@ -104,7 +104,7 @@
surface->width(),
surface->height(),
8,
- PNG_COLOR_TYPE_RGB_ALPHA,
+ PNG_COLOR_TYPE_RGB,
PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT,
PNG_FILTER_TYPE_DEFAULT);
@@ -114,7 +114,7 @@
{
const uint16_t surf_w = surface->width();
const uint16_t surf_h = surface->height();
- const uint32_t row_size = 4 * surf_w;
+ const uint32_t row_size = 3 * surf_w;
std::unique_ptr<png_byte[]> row(new png_byte[row_size]);
@@ -127,10 +127,9 @@
for (uint32_t x = 0; x < surf_w; ++x) {
RGBAColor color;
color.set(fmt, surface->get_pixel(x, y));
- row[4 * x] = color.r;
- row[4 * x + 1] = color.g;
- row[4 * x + 2] = color.b;
- row[4 * x + 3] = color.a;
+ row[3 * x] = color.r;
+ row[3 * x + 1] = color.g;
+ row[3 * x + 2] = color.b;
}
png_write_row(png_ptr, row.get());