aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/support/screen_manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/support/screen_manager.cpp')
-rw-r--r--engines/titanic/support/screen_manager.cpp16
1 files changed, 14 insertions, 2 deletions
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);