HOPKINS: Added a debugger command to frame dirty rects

This commit is contained in:
Paul Gilbert 2013-03-02 22:36:38 -05:00
parent 77eb6f74eb
commit 7a7b2b35e2
4 changed files with 30 additions and 0 deletions

View File

@ -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

View File

@ -38,6 +38,8 @@ public:
Debugger();
virtual ~Debugger() {}
void setParent(HopkinsEngine *vm);
bool cmd_DirtyRects(int argc, const char **argv);
};
} // End of namespace Hopkins

View File

@ -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();
}

View File

@ -110,6 +110,7 @@ public:
*/
Common::Array<Common::Rect> _dirtyRects;
Common::Array<Common::Rect> _refreshRects;
bool _showDirtyRects;
int WinScan;
byte *PAL_PIXELS;