Browse Source

Fix palette in 8bit color mode

pull/513/head
Samuel DEVULDER 6 years ago committed by Anders Jenbo
parent
commit
319bdeddd2
  1. 5
      SourceS/sdl_compat.h

5
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;

Loading…
Cancel
Save