diff options
author | Patric Stout <truebrain@openttd.org> | 2021-06-17 10:34:43 +0200 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-06-26 20:28:05 +0200 |
commit | 74186998a2ab7f45053aa771d179dd8aa24f0d86 (patch) | |
tree | 21642633df84c511aa24023f080d455f255874b3 /src/video/sdl_v.cpp | |
parent | 1ed7afc0a8f40325dca8f4bef0b46e5b8dc06713 (diff) | |
download | openttd-74186998a2ab7f45053aa771d179dd8aa24f0d86.tar.xz |
Codechange: use _cur_palette the same in all the drivers
It was a bit of a mixed bag. With this change, gfx.cpp is in
control who accesses _cur_palette from the video-drivers.
Diffstat (limited to 'src/video/sdl_v.cpp')
-rw-r--r-- | src/video/sdl_v.cpp | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp index 644978e1f..1b180d3b8 100644 --- a/src/video/sdl_v.cpp +++ b/src/video/sdl_v.cpp @@ -106,35 +106,30 @@ static void UpdatePalette(bool init = false) static void InitPalette() { - _local_palette = _cur_palette; - _local_palette.first_dirty = 0; - _local_palette.count_dirty = 256; + CopyPalette(_local_palette, true); UpdatePalette(true); } void VideoDriver_SDL::CheckPaletteAnim() { - _local_palette = _cur_palette; + if (!CopyPalette(_local_palette)) return; - if (_cur_palette.count_dirty != 0) { - Blitter *blitter = BlitterFactory::GetCurrentBlitter(); + Blitter *blitter = BlitterFactory::GetCurrentBlitter(); - switch (blitter->UsePaletteAnimation()) { - case Blitter::PALETTE_ANIMATION_VIDEO_BACKEND: - UpdatePalette(); - break; + switch (blitter->UsePaletteAnimation()) { + case Blitter::PALETTE_ANIMATION_VIDEO_BACKEND: + UpdatePalette(); + break; - case Blitter::PALETTE_ANIMATION_BLITTER: - blitter->PaletteAnimate(_local_palette); - break; + case Blitter::PALETTE_ANIMATION_BLITTER: + blitter->PaletteAnimate(_local_palette); + break; - case Blitter::PALETTE_ANIMATION_NONE: - break; + case Blitter::PALETTE_ANIMATION_NONE: + break; - default: - NOT_REACHED(); - } - _cur_palette.count_dirty = 0; + default: + NOT_REACHED(); } } |