aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock/screen.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2015-04-30 11:23:31 -1000
committerPaul Gilbert2015-04-30 11:23:31 -1000
commit00fd812028c6aaa9b2ec05963a66a23dabbd33ba (patch)
tree13ac71b1fcaccbf197b9a1957a2e93bb88671dcd /engines/sherlock/screen.cpp
parent56f43eff10a038a67954cd4ccc6990bb70fa6740 (diff)
downloadscummvm-rg350-00fd812028c6aaa9b2ec05963a66a23dabbd33ba.tar.gz
scummvm-rg350-00fd812028c6aaa9b2ec05963a66a23dabbd33ba.tar.bz2
scummvm-rg350-00fd812028c6aaa9b2ec05963a66a23dabbd33ba.zip
SHERLOCK: Properly restrict scene drawing to scene area
Diffstat (limited to 'engines/sherlock/screen.cpp')
-rw-r--r--engines/sherlock/screen.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp
index 3c9a10e4a1..66590c3ada 100644
--- a/engines/sherlock/screen.cpp
+++ b/engines/sherlock/screen.cpp
@@ -39,6 +39,10 @@ Screen::Screen(SherlockEngine *vm) : Surface(SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCR
Common::fill(&_cMap[0], &_cMap[PALETTE_SIZE], 0);
Common::fill(&_sMap[0], &_sMap[PALETTE_SIZE], 0);
setFont(1);
+
+ // Set dummy surface used for restricted scene drawing
+ _sceneSurface.format = Graphics::PixelFormat::createFormatCLUT8();
+ _sceneSurface.pitch = SHERLOCK_SCREEN_WIDTH;
}
Screen::~Screen() {
@@ -469,15 +473,31 @@ void Screen::makePanel(const Common::Rect &r) {
_backBuffer->hLine(r.left + 1, r.bottom - 2, r.right - 1, BUTTON_BOTTOM);
}
+/**
+ * Sets the active back buffer pointer to a restricted sub-area of the first back buffer
+ */
void Screen::setDisplayBounds(const Common::Rect &r) {
- // TODO: See if needed
+ assert(r.left == 0 && r.top == 0);
+ _sceneSurface.setPixels(_backBuffer1.getPixels());
+ _sceneSurface.w = r.width();
+ _sceneSurface.h = r.height();
+
+ _backBuffer = &_sceneSurface;
}
+
+/**
+ * Resets the active buffer pointer to point back to the full first back buffer
+ */
void Screen::resetDisplayBounds() {
- setDisplayBounds(Common::Rect(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
+ _backBuffer = &_backBuffer1;
}
+/**
+ * Return the size of the current display window
+ */
Common::Rect Screen::getDisplayBounds() {
- return Common::Rect(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT);
+ return (_backBuffer == &_sceneSurface) ? Common::Rect(0, 0, _sceneSurface.w, _sceneSurface.h) :
+ Common::Rect(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT);
}
/**