Skip to content

Commit

Permalink
Fixed bug 2628 - invalidate surface->map in SDL_SurfacePalette()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
slouken committed Jul 8, 2014
1 parent 97bdefe commit 0c8e337
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/video/SDL_surface.c
Expand Up @@ -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
Expand Down

0 comments on commit 0c8e337

Please sign in to comment.