diff options
author | Eugene Sandulenko | 2016-02-14 13:37:24 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2016-02-14 17:13:21 +0100 |
commit | 9c8d0352ad5078606c1b854a599e964c1d4d1ad2 (patch) | |
tree | 51d59d4e8b8f3f5558d267a7d4ea9368af3877db /engines | |
parent | d91b52052de0b7a5e33529b2bcced1b97488a773 (diff) | |
download | scummvm-rg350-9c8d0352ad5078606c1b854a599e964c1d4d1ad2.tar.gz scummvm-rg350-9c8d0352ad5078606c1b854a599e964c1d4d1ad2.tar.bz2 scummvm-rg350-9c8d0352ad5078606c1b854a599e964c1d4d1ad2.zip |
WAGE: Avoid potential race condition in cursor drawing code
Diffstat (limited to 'engines')
-rw-r--r-- | engines/wage/gui.cpp | 15 | ||||
-rw-r--r-- | engines/wage/gui.h | 3 |
2 files changed, 17 insertions, 1 deletions
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index 819f5881c4..5267e4ee5d 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -131,7 +131,12 @@ static void cursorTimerHandler(void *refCon) { if (!gui->_cursorOff) gui->_cursorState = !gui->_cursorState; - g_system->copyRectToScreen(gui->_screen.getBasePtr(x, y), gui->_screen.pitch, x, y, 1, kCursorHeight); + gui->_cursorRect.left = x; + gui->_cursorRect.right = x + 1; + gui->_cursorRect.top = y; + gui->_cursorRect.bottom = y + kCursorHeight; + + gui->_cursorDirty = true; } Gui::Gui(WageEngine *engine) { @@ -141,6 +146,7 @@ Gui::Gui(WageEngine *engine) { _consoleDirty = true; _bordersDirty = true; _menuDirty = true; + _cursorDirty = false; _consoleFullRedraw = true; _screen.create(g_system->getWidth(), g_system->getHeight(), Graphics::PixelFormat::createFormatCLUT8()); @@ -252,6 +258,13 @@ void Gui::draw() { if (_menuDirty) _menu->render(); + if (_cursorDirty) { + g_system->copyRectToScreen(_screen.getBasePtr(_cursorRect.left, _cursorRect.top), _screen.pitch, + _cursorRect.left, _cursorRect.top, _cursorRect.width(), _cursorRect.height()); + + _cursorDirty = false; + } + _sceneDirty = false; _consoleDirty = false; _bordersDirty = false; diff --git a/engines/wage/gui.h b/engines/wage/gui.h index f679faa5cd..8cdc827bf0 100644 --- a/engines/wage/gui.h +++ b/engines/wage/gui.h @@ -138,6 +138,9 @@ public: Patterns _patterns; + bool _cursorDirty; + Common::Rect _cursorRect; + private: Graphics::Surface _console; Menu *_menu; |