From 0c8e33764c5ee1250eae94e1f93c7262398e20dd Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 7 Jul 2014 21:21:05 -0700 Subject: [PATCH] Fixed bug 2628 - invalidate surface->map in SDL_SurfacePalette() Wei Mingzhi surface->map should be invalidated in SDL_SetSurfacePalette(), otherwise the palette would not be effective when blitting to another non-8bit surface which we previously blitted to. --- src/video/SDL_surface.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index 7caf0fc51b421..ccf89ca1c69b7 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -145,7 +145,12 @@ SDL_SetSurfacePalette(SDL_Surface * surface, SDL_Palette * palette) if (!surface) { return SDL_SetError("SDL_SetSurfacePalette() passed a NULL surface"); } - return SDL_SetPixelFormatPalette(surface->format, palette); + if (SDL_SetPixelFormatPalette(surface->format, palette) < 0) { + return -1; + } + SDL_InvalidateMap(surface->map); + + return 0; } int