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/cocoa/cocoa_v.mm | |
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/cocoa/cocoa_v.mm')
-rw-r--r-- | src/video/cocoa/cocoa_v.mm | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm index f43ea9b28..2f0f2a746 100644 --- a/src/video/cocoa/cocoa_v.mm +++ b/src/video/cocoa/cocoa_v.mm @@ -72,6 +72,7 @@ #endif bool _cocoa_video_started = false; +static Palette _local_palette; ///< Current palette to use for drawing. extern bool _tab_is_down; @@ -714,9 +715,9 @@ void VideoDriver_CocoaQuartz::UpdatePalette(uint first_color, uint num_colors) for (uint i = first_color; i < first_color + num_colors; i++) { uint32 clr = 0xff000000; - clr |= (uint32)_cur_palette.palette[i].r << 16; - clr |= (uint32)_cur_palette.palette[i].g << 8; - clr |= (uint32)_cur_palette.palette[i].b; + clr |= (uint32)_local_palette.palette[i].r << 16; + clr |= (uint32)_local_palette.palette[i].g << 8; + clr |= (uint32)_local_palette.palette[i].b; this->palette[i] = clr; } @@ -725,25 +726,24 @@ void VideoDriver_CocoaQuartz::UpdatePalette(uint first_color, uint num_colors) void VideoDriver_CocoaQuartz::CheckPaletteAnim() { - if (_cur_palette.count_dirty != 0) { - Blitter *blitter = BlitterFactory::GetCurrentBlitter(); + if (!CopyPalette(_local_palette)) return; - switch (blitter->UsePaletteAnimation()) { - case Blitter::PALETTE_ANIMATION_VIDEO_BACKEND: - this->UpdatePalette(_cur_palette.first_dirty, _cur_palette.count_dirty); - break; + Blitter *blitter = BlitterFactory::GetCurrentBlitter(); - case Blitter::PALETTE_ANIMATION_BLITTER: - blitter->PaletteAnimate(_cur_palette); - break; + switch (blitter->UsePaletteAnimation()) { + case Blitter::PALETTE_ANIMATION_VIDEO_BACKEND: + this->UpdatePalette(_local_palette.first_dirty, _local_palette.count_dirty); + break; - case Blitter::PALETTE_ANIMATION_NONE: - break; + case Blitter::PALETTE_ANIMATION_BLITTER: + blitter->PaletteAnimate(_local_palette); + break; - default: - NOT_REACHED(); - } - _cur_palette.count_dirty = 0; + case Blitter::PALETTE_ANIMATION_NONE: + break; + + default: + NOT_REACHED(); } } |