diff --git a/engines/tony/debugger.cpp b/engines/tony/debugger.cpp index 8beb7285a4df..75e58d68d43e 100644 --- a/engines/tony/debugger.cpp +++ b/engines/tony/debugger.cpp @@ -30,6 +30,7 @@ namespace Tony { Debugger::Debugger() : GUI::Debugger() { DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); DCmd_Register("scene", WRAP_METHOD(Debugger, Cmd_Scene)); + DCmd_Register("dirty_rects", WRAP_METHOD(Debugger, Cmd_DirtyRects)); } static int strToInt(const char *s) { @@ -113,4 +114,17 @@ bool Debugger::Cmd_Scene(int argc, const char **argv) { return false; } +/** + * Turns showing dirty rects on or off + */ +bool Debugger::Cmd_DirtyRects(int argc, const char **argv) { + if (argc != 2) { + DebugPrintf("Usage; %s [on | off]\n", argv[0]); + return true; + } else { + _vm->_window.showDirtyRects(strcmp(argv[1], "on") == 0); + return false; + } +} + } // End of namespace Tony diff --git a/engines/tony/debugger.h b/engines/tony/debugger.h index c5ed5e417ef8..85ba9d75b677 100644 --- a/engines/tony/debugger.h +++ b/engines/tony/debugger.h @@ -35,6 +35,7 @@ class Debugger : public GUI::Debugger { protected: bool Cmd_Scene(int argc, const char **argv); + bool Cmd_DirtyRects(int argc, const char **argv); }; } // End of namespace Tony diff --git a/engines/tony/window.cpp b/engines/tony/window.cpp index bf0094ff2a43..a35e765b6c03 100644 --- a/engines/tony/window.cpp +++ b/engines/tony/window.cpp @@ -27,6 +27,7 @@ */ #include "common/scummsys.h" +#include "graphics/surface.h" #include "util.h" #include "tony/window.h" #include "tony/game.h" @@ -40,6 +41,7 @@ namespace Tony { \****************************************************************************/ RMWindow::RMWindow() { + _showDirtyRects = false; } RMWindow::~RMWindow() { @@ -126,11 +128,25 @@ void RMWindow::getNewFrame(RMGfxTargetBuffer &bigBuf, Common::Rect *rcBoundEllip Common::List dirtyRects = bigBuf.getDirtyRects(); Common::List::iterator i; + // If showing dirty rects, copy the entire screen background and set up a surface pointer + Graphics::Surface *s = NULL; + if (_showDirtyRects) { + g_system->copyRectToScreen(lpBuf, RM_SX * 2, 0, 0, RM_SX, RM_SY); + s = g_system->lockScreen(); + } + for (i = dirtyRects.begin(); i != dirtyRects.end(); ++i) { Common::Rect &r = *i; const byte *lpSrc = lpBuf + (RM_SX * 2) * r.top + (r.left * 2); g_system->copyRectToScreen(lpSrc, RM_SX * 2, r.left, r.top, r.width(), r.height()); + + if (_showDirtyRects) + // Frame the copied area with a rectangle + s->frameRect(r, 0xffffff); } + + if (_showDirtyRects) + g_system->unlockScreen(); } if (_bGrabThumbnail) { diff --git a/engines/tony/window.h b/engines/tony/window.h index 6189dd391fc7..562e5fe06270 100644 --- a/engines/tony/window.h +++ b/engines/tony/window.h @@ -57,14 +57,12 @@ class RMWindow { void plotLines(const byte *lpBuf, const Common::Point ¢er, int x, int y); protected: -// void * /*LPDIRECTDRAWCLIPPER*/ _MainClipper; -// void * /*LPDIRECTDRAWCLIPPER*/ _BackClipper; - int fps, fcount; int lastsecond, lastfcount; int mskRed, mskGreen, mskBlue; bool _wiping; + bool _showDirtyRects; bool _bGrabScreenshot; bool _bGrabThumbnail; @@ -99,6 +97,7 @@ class RMWindow { int getFps() const { return fps; } + void showDirtyRects(bool v) { _showDirtyRects = v; } }; } // End of namespace Tony