summaryrefslogtreecommitdiff
path: root/src/video/sdl2_v.cpp
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-06-17 10:34:43 +0200
committerPatric Stout <github@truebrain.nl>2021-06-26 20:28:05 +0200
commit74186998a2ab7f45053aa771d179dd8aa24f0d86 (patch)
tree21642633df84c511aa24023f080d455f255874b3 /src/video/sdl2_v.cpp
parent1ed7afc0a8f40325dca8f4bef0b46e5b8dc06713 (diff)
downloadopenttd-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/sdl2_v.cpp')
-rw-r--r--src/video/sdl2_v.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/video/sdl2_v.cpp b/src/video/sdl2_v.cpp
index 98c04fd85..875491652 100644
--- a/src/video/sdl2_v.cpp
+++ b/src/video/sdl2_v.cpp
@@ -43,9 +43,7 @@ void VideoDriver_SDL_Base::MakeDirty(int left, int top, int width, int height)
void VideoDriver_SDL_Base::CheckPaletteAnim()
{
- if (_cur_palette.count_dirty == 0) return;
-
- this->local_palette = _cur_palette;
+ if (!CopyPalette(this->local_palette)) return;
this->MakeDirty(0, 0, _screen.width, _screen.height);
}
@@ -131,10 +129,7 @@ void VideoDriver_SDL_Base::ClientSizeChanged(int w, int h, bool force)
{
/* Allocate backing store of the new size. */
if (this->AllocateBackingStore(w, h, force)) {
- /* Mark all palette colours dirty. */
- _cur_palette.first_dirty = 0;
- _cur_palette.count_dirty = 256;
- this->local_palette = _cur_palette;
+ CopyPalette(this->local_palette, true);
BlitterFactory::GetCurrentBlitter()->PostResize();