diff options
author | Torbjörn Andersson | 2005-10-04 18:19:14 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2005-10-04 18:19:14 +0000 |
commit | 0719a4e6c27a10af41303aa961812b3dde333045 (patch) | |
tree | 7f0f3c5a42832d9399baad024939ffc558737d51 /saga/gfx.cpp | |
parent | ba306c80f4a59b73f7cf4dc51e90c1bf37e223ff (diff) | |
download | scummvm-rg350-0719a4e6c27a10af41303aa961812b3dde333045.tar.gz scummvm-rg350-0719a4e6c27a10af41303aa961812b3dde333045.tar.bz2 scummvm-rg350-0719a4e6c27a10af41303aa961812b3dde333045.zip |
I misunderstood sev on how sf75() should work. Perhaps this is better?
svn-id: r18932
Diffstat (limited to 'saga/gfx.cpp')
-rw-r--r-- | saga/gfx.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/saga/gfx.cpp b/saga/gfx.cpp index 121bd7cb19..c18115e7e9 100644 --- a/saga/gfx.cpp +++ b/saga/gfx.cpp @@ -182,12 +182,30 @@ void Gfx::setPalette(const PalEntry *pal) { } void Gfx::setPaletteColor(int n, int r, int g, int b) { - _currentPal[4 * n + 0] = r; - _currentPal[4 * n + 1] = g; - _currentPal[4 * n + 2] = b; - _currentPal[4 * n + 3] = 0; + bool update = false; - _system->setPalette(_currentPal, n, 1); + // This function may get called a lot. To avoid forcing full-screen + // updates, only update the palette if the color actually changes. + + if (_currentPal[4 * n + 0] != r) { + _currentPal[4 * n + 0] = r; + update = true; + } + if (_currentPal[4 * n + 1] != g) { + _currentPal[4 * n + 1] = g; + update = true; + } + if (_currentPal[4 * n + 2] != b) { + _currentPal[4 * n + 2] = b; + update = true; + } + if (_currentPal[4 * n + 3] != 0) { + _currentPal[4 * n + 3] = 0; + update = true; + } + + if (update) + _system->setPalette(_currentPal, n, 1); } void Gfx::getCurrentPal(PalEntry *src_pal) { |