From 319bdeddd242bb79c5145fd81ee68d584d4b220e Mon Sep 17 00:00:00 2001 From: Samuel DEVULDER Date: Mon, 2 Dec 2019 23:27:50 +0100 Subject: [PATCH] Fix palette in 8bit color mode --- SourceS/sdl_compat.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/SourceS/sdl_compat.h b/SourceS/sdl_compat.h index 39fdee029..71cc42a9c 100644 --- a/SourceS/sdl_compat.h +++ b/SourceS/sdl_compat.h @@ -66,6 +66,11 @@ inline int SDLC_SetSurfaceAndPaletteColors(SDL_Surface *surface, SDL_Palette *pa } if (colors != (palette->colors + firstcolor)) SDL_memcpy(palette->colors + firstcolor, colors, ncolors * sizeof(*colors)); + + #if SDL1_VIDEO_MODE_BPP == 8 + // When the video surface is 8bit, we need to set the output pallet as well. + SDL_SetColors(SDL_GetVideoSurface(), colors, firstcolor, ncolors); + #endif // In SDL1, the surface always has its own distinct palette, so we need to // update it as well. return SDL_SetPalette(surface, SDL_LOGPAL, colors, firstcolor, ncolors) - 1;