aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/pegasus/graphics.cpp22
-rw-r--r--engines/pegasus/graphics.h2
2 files changed, 18 insertions, 6 deletions
diff --git a/engines/pegasus/graphics.cpp b/engines/pegasus/graphics.cpp
index e37150e75a..05217fabcd 100644
--- a/engines/pegasus/graphics.cpp
+++ b/engines/pegasus/graphics.cpp
@@ -44,6 +44,7 @@ GraphicsManager::GraphicsManager(PegasusEngine *vm) : _vm(vm) {
_firstDisplayElement = _lastDisplayElement = 0;
_workArea.create(640, 480, _vm->_system->getScreenFormat());
_lastMousePosition = Common::Point(-1, -1);
+ _modifiedScreen = false;
}
GraphicsManager::~GraphicsManager() {
@@ -162,22 +163,31 @@ void GraphicsManager::updateDisplay() {
// TODO: Better logic; it does a bit more work than it probably needs to
// but it should work fine for now.
- if (bounds.intersects(_dirtyRect) && runner->validToDraw(_backLayer, _frontLayer))
+ if (bounds.intersects(_dirtyRect) && runner->validToDraw(_backLayer, _frontLayer)) {
runner->draw(bounds);
+ screenDirty = true;
+ }
}
// Copy only the dirty rect to the screen
- g_system->copyRectToScreen((byte *)_workArea.getBasePtr(_dirtyRect.left, _dirtyRect.top), _workArea.pitch, _dirtyRect.left, _dirtyRect.top, _dirtyRect.width(), _dirtyRect.height());
-
- // Mark the screen as dirty
- screenDirty = true;
+ if (screenDirty)
+ g_system->copyRectToScreen((byte *)_workArea.getBasePtr(_dirtyRect.left, _dirtyRect.top), _workArea.pitch, _dirtyRect.left, _dirtyRect.top, _dirtyRect.width(), _dirtyRect.height());
// Clear the dirty rect
_dirtyRect = Common::Rect();
}
- if (screenDirty)
+ if (screenDirty || _modifiedScreen)
g_system->updateScreen();
+
+ _modifiedScreen = false;
+}
+
+void GraphicsManager::clearScreen() {
+ Graphics::Surface *screen = g_system->lockScreen();
+ screen->fillRect(Common::Rect(0, 0, 640, 480), g_system->getScreenFormat().RGBToColor(0, 0, 0));
+ g_system->unlockScreen();
+ _modifiedScreen = true;
}
} // End of namespace Pegasus
diff --git a/engines/pegasus/graphics.h b/engines/pegasus/graphics.h
index ebaaeb2c6c..90d0f33a73 100644
--- a/engines/pegasus/graphics.h
+++ b/engines/pegasus/graphics.h
@@ -52,10 +52,12 @@ public:
tDisplayOrder getFrontOfActiveLayer() const { return _frontLayer; }
void updateDisplay();
Graphics::Surface *getWorkArea() { return &_workArea; }
+ void clearScreen();
private:
PegasusEngine *_vm;
+ bool _modifiedScreen;
Common::Rect _dirtyRect;
tDisplayOrder _backLayer, _frontLayer;
DisplayElement *_firstDisplayElement, *_lastDisplayElement;