From 74186998a2ab7f45053aa771d179dd8aa24f0d86 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Thu, 17 Jun 2021 10:34:43 +0200 Subject: 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. --- src/video/sdl_v.cpp | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) (limited to 'src/video/sdl_v.cpp') 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(); } } -- cgit v1.2.3-54-g00ecf