Code will never reach SDL_SetTexturePalette since SDL_SetDisplayPalette

will fail if the display e.g. is RGB32 or RGB24. The patch will ignore
errors in SDL_SetDislayPalette.
This should also affect the opengl renderer on systems supporting
paletted textures - mine does not (NVIDIA).
With this patch the directfb drivers delivers the same results for
test_palette like the software renderer.

Kind regards,

André
This commit is contained in:
Sam Lantinga 2010-09-27 00:48:56 -07:00
parent b6d190a459
commit 1af81c30b3

View file

@ -321,7 +321,10 @@ SDL_VideoPaletteChanged(void *userdata, SDL_Palette * palette)
}
if (userdata == SDL_VideoSurface) {
if (SDL_SetDisplayPalette(palette->colors, 0, palette->ncolors) < 0) {
return -1;
/* The display surface not necessarily needs to have a palette.
* Just do nothing here and try to set the texture palette.
*/
//return -1;
}
if (SDL_SetTexturePalette
(SDL_VideoTexture, palette->colors, 0, palette->ncolors) < 0) {