From e7d7cbe098bc1b8db41aec2a0d1ae5fa77cdde0a Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Fri, 11 Oct 2019 13:26:15 +0100 Subject: [PATCH] DiabloUI/credits: Use SDL_SetPaletteColors in SDL2 Internally, this increments the palette version, which we previously didn't do. --- SourceX/DiabloUI/credits.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SourceX/DiabloUI/credits.cpp b/SourceX/DiabloUI/credits.cpp index 5b105a0c2..428345a5a 100644 --- a/SourceX/DiabloUI/credits.cpp +++ b/SourceX/DiabloUI/credits.cpp @@ -85,14 +85,14 @@ CachedLine PrepareLine(std::size_t index) SDL_Log(SDL_GetError()); // Change the text surface color and blit again: -#ifdef USE_SDL1 - SDL_SetColorKey(text.get(), SDL_SRCCOLORKEY, 0); SDL_Color text_colors[2] = { mask_color, text_color }; +#ifdef USE_SDL1 if (SDL_SetPalette(text.get(), SDL_LOGPAL, text_colors, 0, 2) != 1) SDL_Log(SDL_GetError()); + SDL_SetColorKey(text.get(), SDL_SRCCOLORKEY, 0); #else - text->format->palette->colors[0] = mask_color; - text->format->palette->colors[1] = text_color; + if (SDL_SetPaletteColors(text->format->palette, text_colors, 0, 2) <= -1) + SDL_Log(SDL_GetError()); SDL_SetColorKey(text.get(), SDL_TRUE, 0); #endif if (SDL_BlitSurface(text.get(), nullptr, surface.get(), nullptr) <= -1)