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.
This commit is contained in:
Patric Stout
2021-06-17 10:34:43 +02:00
committed by Patric Stout
parent 1ed7afc0a8
commit 74186998a2
11 changed files with 98 additions and 95 deletions

View File

@@ -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();
}
}