diff options
author | Colin Snover | 2017-05-06 00:00:04 -0500 |
---|---|---|
committer | Colin Snover | 2017-05-06 10:38:58 -0500 |
commit | 8b49313af30a283b7b9517b69c10a148e099cf01 (patch) | |
tree | 6e53d1ecde746f1aa7f5e1193b09ef2180dfb67d /engines/sci | |
parent | 91df45c6c5f11d6426a7c390e50932dd3016504e (diff) | |
download | scummvm-rg350-8b49313af30a283b7b9517b69c10a148e099cf01.tar.gz scummvm-rg350-8b49313af30a283b7b9517b69c10a148e099cf01.tar.bz2 scummvm-rg350-8b49313af30a283b7b9517b69c10a148e099cf01.zip |
SCI32: Fix terrible rendering performance when vsync is enabled
More than one call to OSystem::updateScreen per frame on systems
with vsync ruins performance because the call is blocked until
the next vsync interval.
This also fixes bad rendering performance with the OpenGL backend.
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/graphics/cursor32.cpp | 5 | ||||
-rw-r--r-- | engines/sci/graphics/frameout.cpp | 4 | ||||
-rw-r--r-- | engines/sci/graphics/palette32.cpp | 6 | ||||
-rw-r--r-- | engines/sci/graphics/palette32.h | 5 | ||||
-rw-r--r-- | engines/sci/sci.cpp | 8 |
5 files changed, 16 insertions, 12 deletions
diff --git a/engines/sci/graphics/cursor32.cpp b/engines/sci/graphics/cursor32.cpp index 2f74873229..624714619e 100644 --- a/engines/sci/graphics/cursor32.cpp +++ b/engines/sci/graphics/cursor32.cpp @@ -122,7 +122,6 @@ void GfxCursor32::drawToHardware(const DrawRegion &source) { byte *sourcePixel = source.data + (sourceYOffset * source.rect.width()) + sourceXOffset; g_system->copyRectToScreen(sourcePixel, source.rect.width(), drawRect.left, drawRect.top, drawRect.width(), drawRect.height()); - g_system->updateScreen(); } void GfxCursor32::unhide() { @@ -381,6 +380,10 @@ void GfxCursor32::deviceMoved(Common::Point &position) { position.y = _restrictedArea.bottom - 1; } + if (_position == position) { + return; + } + _position = position; g_system->warpMouse(position.x, position.y); diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index e0506e67ac..b4c842dd4a 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -439,7 +439,7 @@ void GfxFrameout::frameOut(const bool shouldShowBits, const Common::Rect &eraseR robotPlayer.frameAlmostVisible(); } - _palette->updateHardware(!shouldShowBits); + _palette->updateHardware(); if (shouldShowBits) { showBits(); @@ -547,7 +547,7 @@ void GfxFrameout::palMorphFrameOut(const int8 *styleRanges, PlaneShowStyle *show _palette->submit(nextPalette); _palette->updateFFrame(); - _palette->updateHardware(false); + _palette->updateHardware(); showBits(); } diff --git a/engines/sci/graphics/palette32.cpp b/engines/sci/graphics/palette32.cpp index d13ae2c097..de85b71a2c 100644 --- a/engines/sci/graphics/palette32.cpp +++ b/engines/sci/graphics/palette32.cpp @@ -455,7 +455,7 @@ void GfxPalette32::updateFFrame() { g_sci->_gfxRemap32->remapAllTables(_nextPalette != _currentPalette); } -void GfxPalette32::updateHardware(const bool updateScreen) { +void GfxPalette32::updateHardware() { if (_currentPalette == _nextPalette && !_gammaChanged) { return; } @@ -494,10 +494,6 @@ void GfxPalette32::updateHardware(const bool updateScreen) { } g_system->getPaletteManager()->setPalette(bpal, 0, 256); - if (updateScreen) { - g_system->updateScreen(); - } - _gammaChanged = false; } diff --git a/engines/sci/graphics/palette32.h b/engines/sci/graphics/palette32.h index 267ec39d96..0fcd7e00ab 100644 --- a/engines/sci/graphics/palette32.h +++ b/engines/sci/graphics/palette32.h @@ -240,11 +240,8 @@ public: /** * Copies all entries from `nextPalette` to `currentPalette` and updates the * backend's raw palette. - * - * @param updateScreen If true, this call will also tell the backend to draw - * to the screen. */ - void updateHardware(const bool updateScreen = true); + void updateHardware(); private: ResourceManager *_resMan; diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 026c423d75..9d6e4e0451 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -816,6 +816,14 @@ void SciEngine::sleep(uint32 msecs) { for (;;) { // let backend process events and update the screen _eventMan->getSciEvent(SCI_EVENT_PEEK); +#ifdef ENABLE_SCI32 + // If a game is in a wait loop, kFrameOut is not called, but mouse + // movement is still occurring and the screen needs to be updated to + // reflect it + if (getSciVersion() >= SCI_VERSION_2) { + g_system->updateScreen(); + } +#endif time = g_system->getMillis(); if (time + 10 < wakeUpTime) { g_system->delayMillis(10); |