diff options
author | Patric Stout <truebrain@openttd.org> | 2021-02-20 11:15:15 +0100 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-02-20 17:08:44 +0100 |
commit | ec1dd0bf618f2c4fe17c62db9eec3b5e056574a0 (patch) | |
tree | 07ccc0fcb66cc6f73b01fc9e0cf1b29f6b82e7cb /src/video/sdl_v.cpp | |
parent | 790fa7102ec934544b427dd5fa9fc4f7099fd4da (diff) | |
download | openttd-ec1dd0bf618f2c4fe17c62db9eec3b5e056574a0.tar.xz |
Codechange: be consistent in what CheckPaletteAnim() does and when it is called
Additionally, make sure this is a class method. Later commits
will make use of this.
Diffstat (limited to 'src/video/sdl_v.cpp')
-rw-r--r-- | src/video/sdl_v.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp index 0aa216df2..ab91cb56a 100644 --- a/src/video/sdl_v.cpp +++ b/src/video/sdl_v.cpp @@ -123,8 +123,10 @@ static void InitPalette() UpdatePalette(true); } -static void CheckPaletteAnim() +void VideoDriver_SDL::CheckPaletteAnim() { + _local_palette = _cur_palette; + if (_cur_palette.count_dirty != 0) { Blitter *blitter = BlitterFactory::GetCurrentBlitter(); @@ -183,7 +185,6 @@ void VideoDriver_SDL::PaintThread() _draw_signal->wait(*_draw_mutex); while (_draw_continue) { - CheckPaletteAnim(); /* Then just draw and wait till we stop */ this->Paint(); _draw_signal->wait(lock); @@ -708,8 +709,6 @@ void VideoDriver_SDL::MainLoop() auto next_game_tick = cur_ticks; auto next_draw_tick = cur_ticks; - CheckPaletteAnim(); - std::thread draw_thread; if (_draw_threaded) { /* Initialise the mutex first, because that's the thing we *need* @@ -781,12 +780,11 @@ void VideoDriver_SDL::MainLoop() this->InputLoop(); ::InputLoop(); UpdateWindows(); - _local_palette = _cur_palette; + this->CheckPaletteAnim(); if (_draw_mutex != nullptr && !HasModalProgress()) { _draw_signal->notify_one(); } else { - CheckPaletteAnim(); this->Paint(); } } |