aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBlockMen <nmuelll@web.de>2014-09-03 19:20:06 +0200
committerBlockMen <nmuelll@web.de>2014-09-03 19:41:29 +0200
commit8948907431b329074f98f380c1f4be4bee0b2e3c (patch)
tree112ed4ad85ce3a07058cbc50f688cb0c03e3bc9f /src
parentb2102bfe49002f1ac10ca8288f5337e9feec7f65 (diff)
downloadminetest-8948907431b329074f98f380c1f4be4bee0b2e3c.tar.gz
minetest-8948907431b329074f98f380c1f4be4bee0b2e3c.tar.bz2
minetest-8948907431b329074f98f380c1f4be4bee0b2e3c.zip
Change screenshot colorformat properly
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 6ac320af8..cb5fe8046 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -2068,22 +2068,29 @@ void the_game(bool &kill, bool random_input, InputHandler *input,
}
else if(input->wasKeyDown(getKeySetting("keymap_screenshot")))
{
- irr::video::IImage* const image = driver->createScreenShot(video::ECF_R8G8B8);
- if (image) {
- irr::c8 filename[256];
- snprintf(filename, 256, "%s" DIR_DELIM "screenshot_%u.png",
+ irr::video::IImage* const raw_image = driver->createScreenShot();
+ if (raw_image) {
+ irr::video::IImage* const image = driver->createImage(video::ECF_R8G8B8,
+ raw_image->getDimension());
+
+ if (image) {
+ raw_image->copyTo(image);
+ irr::c8 filename[256];
+ snprintf(filename, sizeof(filename), "%s" DIR_DELIM "screenshot_%u.png",
g_settings->get("screenshot_path").c_str(),
device->getTimer()->getRealTime());
- if (driver->writeImageToFile(image, filename)) {
- std::wstringstream sstr;
- sstr<<"Saved screenshot to '"<<filename<<"'";
- infostream<<"Saved screenshot to '"<<filename<<"'"<<std::endl;
- statustext = sstr.str();
- statustext_time = 0;
- } else{
- infostream<<"Failed to save screenshot '"<<filename<<"'"<<std::endl;
+ if (driver->writeImageToFile(image, filename)) {
+ std::wstringstream sstr;
+ sstr << "Saved screenshot to '" << filename << "'";
+ infostream << "Saved screenshot to '" << filename << "'" << std::endl;
+ statustext = sstr.str();
+ statustext_time = 0;
+ } else {
+ infostream << "Failed to save screenshot '" << filename << "'" << std::endl;
+ }
+ image->drop();
}
- image->drop();
+ raw_image->drop();
}
}
else if(input->wasKeyDown(getKeySetting("keymap_toggle_hud")))