diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/render/screenshot.cc | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/render/screenshot.cc b/src/render/screenshot.cc index adab01b..45e2299 100644 --- a/src/render/screenshot.cc +++ b/src/render/screenshot.cc @@ -29,7 +29,6 @@ int Screenshot::current_date = 0; void Screenshot::save() { - bool available = false; std::string filename; const int TYPETGA = 0; const int TYPEPNG = 1; @@ -79,6 +78,7 @@ void Screenshot::save() current_date = date_serial; } + bool available = false; do { std::stringstream filenamestr; // screenshots directory @@ -93,7 +93,8 @@ void Screenshot::save() filenamestr << "." << screenshotformat->str(); // try to open the file - FILE *handle = fopen(filenamestr.str().c_str(), "r"); + filename.assign(filenamestr.str().c_str()); + FILE *handle = fopen(filename.c_str(), "r"); if (handle) { fclose(handle); } else { @@ -110,15 +111,8 @@ void Screenshot::save() image.flip(); if (filetype == TYPEPNG) { - /* if ((Camera::width() % 8 != 0 ) || (Camera::height() % 8 != 0 )) { - image.pad(); - }*/ - render::PNG::save(filename.c_str(), image); + render::PNG::save(filenamestr.str().c_str(), image); } else if (filetype == TYPEJPG) { - /* if ((Camera::width() % 8 != 0 ) || (Camera::height() % 8 != 0 )) { - image.pad(); - } - */ render::JPG::save(filename.c_str(), image, (int) screenshotquality->value()); } else if (filetype == TYPETGA) { render::TGA::save(filename.c_str(), image); |