diff options
author | Thierry Crozat | 2017-04-24 01:06:03 +0100 |
---|---|---|
committer | Thierry Crozat | 2017-04-24 01:07:16 +0100 |
commit | a9ae691513f20018cc3798929dc6161828adfc7f (patch) | |
tree | 3e9f1b584381222ebc97367d5a01e14874bc1814 /backends/graphics/opengl | |
parent | e96c057c3d7d2deb8ff31bc7d798d455f74b399a (diff) | |
download | scummvm-rg350-a9ae691513f20018cc3798929dc6161828adfc7f.tar.gz scummvm-rg350-a9ae691513f20018cc3798929dc6161828adfc7f.tar.bz2 scummvm-rg350-a9ae691513f20018cc3798929dc6161828adfc7f.zip |
SDL: Improve debug and warning messages when saving screenshots
In particular this adds a warning when failing to save a screenshot
in OpenGL mode (there was already one in SurfaceSDL mode).
Diffstat (limited to 'backends/graphics/opengl')
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.cpp | 8 | ||||
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.h | 3 |
2 files changed, 8 insertions, 3 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index 7b41699e80..b239802a0f 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -1302,7 +1302,7 @@ const Graphics::Font *OpenGLGraphicsManager::getFontOSD() { } #endif -void OpenGLGraphicsManager::saveScreenshot(const Common::String &filename) const { +bool OpenGLGraphicsManager::saveScreenshot(const Common::String &filename) const { const uint width = _outputScreenWidth; const uint height = _outputScreenHeight; @@ -1332,7 +1332,10 @@ void OpenGLGraphicsManager::saveScreenshot(const Common::String &filename) const // Open file Common::DumpFile out; - out.open(filename); + if (!out.open(filename)) { + delete[] pixels; + return false; + } // Write BMP header out.writeByte('B'); @@ -1357,6 +1360,7 @@ void OpenGLGraphicsManager::saveScreenshot(const Common::String &filename) const // Free allocated memory delete[] pixels; + return true; } } // End of namespace OpenGL diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h index d3f8d792ba..f5f4cab305 100644 --- a/backends/graphics/opengl/opengl-graphics.h +++ b/backends/graphics/opengl/opengl-graphics.h @@ -296,8 +296,9 @@ protected: * uses Common::DumpFile for writing the screenshot. * * @param filename The output filename. + * @return true on success, false otherwise */ - void saveScreenshot(const Common::String &filename) const; + bool saveScreenshot(const Common::String &filename) const; private: // |