diff options
author | Einar Johan Trøan Sømåen | 2013-02-06 13:09:33 +0100 |
---|---|---|
committer | Einar Johan Trøan Sømåen | 2013-02-06 13:40:36 +0100 |
commit | 09303f6d1a7c32916e14ee5436b7d7f146c26dc5 (patch) | |
tree | 1de3e04e74e0fb0fb8124865c9a1e743e6eb990e /engines/wintermute/base | |
parent | 74e32bd3329b8d7b19d97ddff140fb23b901c2d6 (diff) | |
download | scummvm-rg350-09303f6d1a7c32916e14ee5436b7d7f146c26dc5.tar.gz scummvm-rg350-09303f6d1a7c32916e14ee5436b7d7f146c26dc5.tar.bz2 scummvm-rg350-09303f6d1a7c32916e14ee5436b7d7f146c26dc5.zip |
WINTERMUTE: Get rid of BaseImage.h inclusion in BaseGame.
Diffstat (limited to 'engines/wintermute/base')
-rw-r--r-- | engines/wintermute/base/base_game.cpp | 22 | ||||
-rw-r--r-- | engines/wintermute/base/gfx/base_image.cpp | 2 | ||||
-rw-r--r-- | engines/wintermute/base/gfx/base_image.h | 2 | ||||
-rw-r--r-- | engines/wintermute/base/gfx/base_renderer.cpp | 17 | ||||
-rw-r--r-- | engines/wintermute/base/gfx/base_renderer.h | 1 |
5 files changed, 22 insertions, 22 deletions
diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index e02842a6c1..0248c349e7 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -34,7 +34,6 @@ #include "engines/wintermute/base/base_file_manager.h" #include "engines/wintermute/base/font/base_font.h" #include "engines/wintermute/base/font/base_font_storage.h" -#include "engines/wintermute/base/gfx/base_image.h" #include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/base/base_keyboard_state.h" #include "engines/wintermute/base/base_parser.h" @@ -1577,14 +1576,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack fileNum++; } - bool ret = false; - BaseImage *image = _gameRef->_renderer->takeScreenshot(); - if (image) { - ret = DID_SUCCEED(image->saveBMPFile(filename)); - delete image; - } else { - ret = false; - } + bool ret = _gameRef->_renderer->saveScreenShot(filename); stack->pushBool(ret); return STATUS_OK; @@ -1599,17 +1591,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack int sizeX = stack->pop()->getInt(_renderer->_width); int sizeY = stack->pop()->getInt(_renderer->_height); - bool ret = false; - BaseImage *image = _gameRef->_renderer->takeScreenshot(); - if (image) { - ret = DID_SUCCEED(image->resize(sizeX, sizeY)); - if (ret) { - ret = DID_SUCCEED(image->saveBMPFile(filename)); - } - delete image; - } else { - ret = false; - } + bool ret = _gameRef->_renderer->saveScreenShot(filename, sizeX, sizeY); stack->pushBool(ret); return STATUS_OK; diff --git a/engines/wintermute/base/gfx/base_image.cpp b/engines/wintermute/base/gfx/base_image.cpp index 05037cd177..75de95128f 100644 --- a/engines/wintermute/base/gfx/base_image.cpp +++ b/engines/wintermute/base/gfx/base_image.cpp @@ -105,7 +105,7 @@ void BaseImage::copyFrom(const Graphics::Surface *surface) { } ////////////////////////////////////////////////////////////////////////// -bool BaseImage::saveBMPFile(const char *filename) const { +bool BaseImage::saveBMPFile(const Common::String &filename) const { warning("BaseImage::saveBMPFile - stubbed"); // TODO return false; } diff --git a/engines/wintermute/base/gfx/base_image.h b/engines/wintermute/base/gfx/base_image.h index 6d01b84184..017305e5d0 100644 --- a/engines/wintermute/base/gfx/base_image.h +++ b/engines/wintermute/base/gfx/base_image.h @@ -55,7 +55,7 @@ public: byte getAlphaAt(int x, int y) const; bool writeBMPToStream(Common::WriteStream *stream) const; bool resize(int newWidth, int newHeight); - bool saveBMPFile(const char *filename) const; + bool saveBMPFile(const Common::String &filename) const; bool copyFrom(BaseImage *origImage, int newWidth = 0, int newHeight = 0); void copyFrom(const Graphics::Surface *surface); private: diff --git a/engines/wintermute/base/gfx/base_renderer.cpp b/engines/wintermute/base/gfx/base_renderer.cpp index 6c230d2411..c20881e425 100644 --- a/engines/wintermute/base/gfx/base_renderer.cpp +++ b/engines/wintermute/base/gfx/base_renderer.cpp @@ -29,6 +29,7 @@ #include "engines/wintermute/base/base_active_rect.h" #include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/base/gfx/base_surface.h" +#include "engines/wintermute/base/gfx/base_image.h" #include "engines/wintermute/base/base_sub_frame.h" #include "engines/wintermute/base/base_region.h" #include "engines/wintermute/platform_osystem.h" @@ -344,6 +345,22 @@ void BaseRenderer::addRectToList(BaseActiveRect *rect) { _rectList.push_back(rect); } +bool BaseRenderer::saveScreenShot(const Common::String &filename, int sizeX, int sizeY) { + BaseImage *image = takeScreenshot(); + if (image) { + if (sizeX != 0 && sizeY != 0) { + if (!DID_SUCCEED(image->resize(sizeX, sizeY))) { + delete image; + return false; + } + } + image->saveBMPFile(filename); + delete image; + return true; + } + return false; +} + ////////////////////////////////////////////////////////////////////////// bool BaseRenderer::displayIndicator() { if (!_indicatorDisplay || !_indicatorProgress) { diff --git a/engines/wintermute/base/gfx/base_renderer.h b/engines/wintermute/base/gfx/base_renderer.h index 9bc195f1e1..5a24e0179a 100644 --- a/engines/wintermute/base/gfx/base_renderer.h +++ b/engines/wintermute/base/gfx/base_renderer.h @@ -61,6 +61,7 @@ public: * @return a BaseImage containing the current screen-buffer. */ virtual BaseImage *takeScreenshot() = 0; + virtual bool saveScreenShot(const Common::String &filename, int sizeX = 0, int sizeY = 0); virtual bool setViewport(int left, int top, int right, int bottom); virtual bool setViewport(Rect32 *rect); virtual Rect32 getViewPort() = 0; |