From efc12ffc5c905f38f1ea7889d4d9d6c14647441d Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Tue, 12 Jul 2016 14:14:01 -0500 Subject: SCI32: Avoid flash of incorrect colour when palettes are changed Avoid forcing the screen to refresh after a palette change if the screen is also about to be drawn to, as the palette change + draw is intended to be an atomic operation. --- engines/sci/graphics/frameout.cpp | 4 ++-- engines/sci/graphics/palette32.cpp | 6 ++++-- engines/sci/graphics/palette32.h | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index 44db9f870e..7bb9a4f5cf 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -573,7 +573,7 @@ void GfxFrameout::frameOut(const bool shouldShowBits, const Common::Rect &eraseR // _robot->frameAlmostVisible(); // } - _palette->updateHardware(); + _palette->updateHardware(!shouldShowBits); if (shouldShowBits) { showBits(); @@ -1144,7 +1144,7 @@ void GfxFrameout::palMorphFrameOut(const int8 *styleRanges, const ShowStyleEntry _palette->submit(nextPalette); _palette->updateFFrame(); - _palette->updateHardware(); + _palette->updateHardware(false); showBits(); _frameNowVisible = true; diff --git a/engines/sci/graphics/palette32.cpp b/engines/sci/graphics/palette32.cpp index 9d1cc655b9..1260a962f0 100644 --- a/engines/sci/graphics/palette32.cpp +++ b/engines/sci/graphics/palette32.cpp @@ -252,7 +252,7 @@ void GfxPalette32::updateFFrame() { g_sci->_gfxRemap32->remapAllTables(_nextPalette != _currentPalette); } -void GfxPalette32::updateHardware() { +void GfxPalette32::updateHardware(const bool updateScreen) { if (_currentPalette == _nextPalette) { return; } @@ -285,7 +285,9 @@ void GfxPalette32::updateHardware() { bpal[255 * 3 + 2] = 255; g_system->getPaletteManager()->setPalette(bpal, 0, 256); - g_sci->getEventManager()->updateScreen(); + if (updateScreen) { + g_sci->getEventManager()->updateScreen(); + } } void GfxPalette32::applyAll() { diff --git a/engines/sci/graphics/palette32.h b/engines/sci/graphics/palette32.h index d06541fc47..dc2158022f 100644 --- a/engines/sci/graphics/palette32.h +++ b/engines/sci/graphics/palette32.h @@ -251,7 +251,7 @@ public: bool updateForFrame(); void updateFFrame(); - void updateHardware(); + void updateHardware(const bool updateScreen = true); void applyAll(); #pragma mark - -- cgit v1.2.3