From 49df9c415595a7aa104ff5463372118ec874a4c2 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sun, 17 Jan 2021 15:43:04 +0100 Subject: Codechange: [Win32] Use _local_palette for most operations Other drivers do this too, and this makes the world a bit more the same. --- src/video/win32_v.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index 2f464fae2..9e1df8473 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -73,24 +73,24 @@ static Palette _local_palette; static void MakePalette() { + _cur_palette.first_dirty = 0; + _cur_palette.count_dirty = 256; + _local_palette = _cur_palette; + LOGPALETTE *pal = (LOGPALETTE*)alloca(sizeof(LOGPALETTE) + (256 - 1) * sizeof(PALETTEENTRY)); pal->palVersion = 0x300; pal->palNumEntries = 256; for (uint i = 0; i != 256; i++) { - pal->palPalEntry[i].peRed = _cur_palette.palette[i].r; - pal->palPalEntry[i].peGreen = _cur_palette.palette[i].g; - pal->palPalEntry[i].peBlue = _cur_palette.palette[i].b; + pal->palPalEntry[i].peRed = _local_palette.palette[i].r; + pal->palPalEntry[i].peGreen = _local_palette.palette[i].g; + pal->palPalEntry[i].peBlue = _local_palette.palette[i].b; pal->palPalEntry[i].peFlags = 0; } _wnd.gdi_palette = CreatePalette(pal); if (_wnd.gdi_palette == nullptr) usererror("CreatePalette failed!\n"); - - _cur_palette.first_dirty = 0; - _cur_palette.count_dirty = 256; - _local_palette = _cur_palette; } static void UpdatePalette(HDC dc, uint start, uint count) -- cgit v1.2.3-54-g00ecf