diff options
-rw-r--r-- | engines/titanic/game_manager.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/support/screen_manager.cpp | 16 | ||||
-rw-r--r-- | engines/titanic/support/screen_manager.h | 1 |
3 files changed, 16 insertions, 3 deletions
diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index b276405dd4..d3d9ced9d1 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -195,7 +195,7 @@ void CGameManager::update() { _bounds.combine(textCursor->getCursorBounds()); // Set the screen's modified area bounds - screenManager->setSurfaceBounds(SURFACE_BACKBUFFER, _bounds); + screenManager->setSurfaceBounds(SURFACE_PRIMARY, _bounds); // Handle redrawing the view if there is any changed area if (!_bounds.isEmpty()) { diff --git a/engines/titanic/support/screen_manager.cpp b/engines/titanic/support/screen_manager.cpp index cc9054e688..4e0f0406a0 100644 --- a/engines/titanic/support/screen_manager.cpp +++ b/engines/titanic/support/screen_manager.cpp @@ -65,6 +65,8 @@ CScreenManager *CScreenManager::setCurrent() { void CScreenManager::setSurfaceBounds(SurfaceNum surfaceNum, const Rect &r) { if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) _backSurfaces[surfaceNum]._bounds = r; + else if (surfaceNum == SURFACE_PRIMARY) + _frontSurfaceBounds = r; } int CScreenManager::setFontNumber(int fontNumber) { @@ -169,6 +171,13 @@ void OSScreenManager::fillRect(SurfaceNum surfaceNum, Rect *rect, byte r, byte g tempRect = surfaceRect; } + // Constrain the fill area to the set modification area of the surface + Rect surfaceBounds = (surfaceNum == SURFACE_PRIMARY) ? _frontSurfaceBounds : + _backSurfaces[surfaceNum]._bounds; + if (!surfaceBounds.isEmpty()) + tempRect.constrain(surfaceBounds); + + // If there is any area defined, clear it if (tempRect.isValidRect()) surface->fillRect(&tempRect, r, g, b); } @@ -189,12 +198,15 @@ void OSScreenManager::blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, Rect *bounds = &srcBounds; Rect rect2; - if (surfaceNum >= 0 && !_backSurfaces[surfaceNum]._bounds.isEmpty()) { + Rect surfaceBounds = (surfaceNum == SURFACE_PRIMARY) ? _frontSurfaceBounds : + _backSurfaces[surfaceNum]._bounds; + + if (!surfaceBounds.isEmpty()) { // Perform clipping to the bounds of the back surface rect2 = srcBounds; rect2.translate(-srcBounds.left, -srcBounds.top); rect2.translate(destPoint.x, destPoint.y); - rect2.constrain(_backSurfaces[surfaceNum]._bounds); + rect2.constrain(surfaceBounds); rect2.translate(-destPoint.x, -destPoint.y); rect2.translate(srcBounds.left, srcBounds.top); diff --git a/engines/titanic/support/screen_manager.h b/engines/titanic/support/screen_manager.h index 7140001bd4..0b99c0e65c 100644 --- a/engines/titanic/support/screen_manager.h +++ b/engines/titanic/support/screen_manager.h @@ -64,6 +64,7 @@ public: static CScreenManager *setCurrent(); public: Common::Array<VideoSurfaceEntry> _backSurfaces; + Rect _frontSurfaceBounds; CVideoSurface *_frontRenderSurface; CMouseCursor *_mouseCursor; CTextCursor *_textCursor; |