aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2013-03-02 22:36:38 -0500
committerPaul Gilbert2013-03-02 22:36:38 -0500
commit7a7b2b35e2be1e6526d8aeea2576e8c9231aa73c (patch)
tree6b7f2c3c16a5e5435f873b0c096ae108e8ab5160
parent77eb6f74eb17deda5e629457ca4ec144782fddfe (diff)
downloadscummvm-rg350-7a7b2b35e2be1e6526d8aeea2576e8c9231aa73c.tar.gz
scummvm-rg350-7a7b2b35e2be1e6526d8aeea2576e8c9231aa73c.tar.bz2
scummvm-rg350-7a7b2b35e2be1e6526d8aeea2576e8c9231aa73c.zip
HOPKINS: Added a debugger command to frame dirty rects
-rw-r--r--engines/hopkins/debugger.cpp13
-rw-r--r--engines/hopkins/debugger.h2
-rw-r--r--engines/hopkins/graphics.cpp14
-rw-r--r--engines/hopkins/graphics.h1
4 files changed, 30 insertions, 0 deletions
diff --git a/engines/hopkins/debugger.cpp b/engines/hopkins/debugger.cpp
index 0abfd1f62e..07a0c92be6 100644
--- a/engines/hopkins/debugger.cpp
+++ b/engines/hopkins/debugger.cpp
@@ -30,10 +30,23 @@ namespace Hopkins {
Debugger::Debugger() : GUI::Debugger() {
DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit));
+ DCmd_Register("rects", WRAP_METHOD(Debugger, cmd_DirtyRects));
}
void Debugger::setParent(HopkinsEngine *vm) {
_vm = vm;
}
+// Turns dirty rects on or off
+bool Debugger::cmd_DirtyRects(int argc, const char **argv) {
+ if (argc != 2) {
+ DebugPrintf("%s: [on | off]\n", argv[0]);
+ return true;
+ } else {
+ _vm->_graphicsManager._showDirtyRects = !strcmp(argv[1], "on");
+ return false;
+ }
+}
+
+
} // End of namespace Hopkins
diff --git a/engines/hopkins/debugger.h b/engines/hopkins/debugger.h
index aabc95c5f1..1ce018b38c 100644
--- a/engines/hopkins/debugger.h
+++ b/engines/hopkins/debugger.h
@@ -38,6 +38,8 @@ public:
Debugger();
virtual ~Debugger() {}
void setParent(HopkinsEngine *vm);
+
+ bool cmd_DirtyRects(int argc, const char **argv);
};
} // End of namespace Hopkins
diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp
index 0c06ef7f48..540c18f1b4 100644
--- a/engines/hopkins/graphics.cpp
+++ b/engines/hopkins/graphics.cpp
@@ -51,6 +51,7 @@ GraphicsManager::GraphicsManager() {
_vesaBuffer = NULL;
_screenBuffer = NULL;
_isPhysicalPtr = false;
+ _showDirtyRects = false;
_lineNbr2 = 0;
Agr_x = Agr_y = 0;
@@ -1142,6 +1143,13 @@ void GraphicsManager::displayDirtyRects() {
return;
lockScreen();
+
+ // Refresh the entire screen
+ Graphics::Surface *screenSurface = NULL;
+ if (_showDirtyRects) {
+ screenSurface = g_system->lockScreen();
+ g_system->copyRectToScreen(_screenBuffer, WinScan, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ }
for (uint idx = 0; idx < _dirtyRects.size(); ++idx) {
Common::Rect &r = _dirtyRects[idx];
@@ -1176,10 +1184,16 @@ void GraphicsManager::displayDirtyRects() {
byte *srcP = _videoPtr + WinScan * dstRect.top + (dstRect.left * 2);
g_system->copyRectToScreen(srcP, WinScan, dstRect.left, dstRect.top,
dstRect.width(), dstRect.height());
+
+ if (_showDirtyRects)
+ screenSurface->frameRect(dstRect, 0xffffff);
}
}
unlockScreen();
+ if (_showDirtyRects)
+ g_system->unlockScreen();
+
resetDirtyRects();
}
diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h
index bdd8fee578..54e4156982 100644
--- a/engines/hopkins/graphics.h
+++ b/engines/hopkins/graphics.h
@@ -110,6 +110,7 @@ public:
*/
Common::Array<Common::Rect> _dirtyRects;
Common::Array<Common::Rect> _refreshRects;
+ bool _showDirtyRects;
int WinScan;
byte *PAL_PIXELS;