comparison src/SDL_compat.c @ 2854:e92d58afcbda

Fixed updating the video surface when the palette changes
author Sam Lantinga <slouken@libsdl.org>
date Sun, 07 Dec 2008 22:48:06 +0000
parents 7046f9567045
children 99210400e8b9
comparison
equal deleted inserted replaced
2853:6258fa7cd300 2854:e92d58afcbda
636 if (SDL_VideoSurface->format->palette) { 636 if (SDL_VideoSurface->format->palette) {
637 SDL_VideoSurface->flags |= SDL_HWPALETTE; 637 SDL_VideoSurface->flags |= SDL_HWPALETTE;
638 SDL_DitherColors(SDL_VideoSurface->format->palette->colors, 638 SDL_DitherColors(SDL_VideoSurface->format->palette->colors,
639 SDL_VideoSurface->format->BitsPerPixel); 639 SDL_VideoSurface->format->BitsPerPixel);
640 SDL_AddPaletteWatch(SDL_VideoSurface->format->palette, 640 SDL_AddPaletteWatch(SDL_VideoSurface->format->palette,
641 SDL_VideoPaletteChanged, NULL); 641 SDL_VideoPaletteChanged, SDL_VideoSurface);
642 SDL_SetPaletteColors(SDL_VideoSurface->format->palette, 642 SDL_SetPaletteColors(SDL_VideoSurface->format->palette,
643 SDL_VideoSurface->format->palette->colors, 0, 643 SDL_VideoSurface->format->palette->colors, 0,
644 SDL_VideoSurface->format->palette->ncolors); 644 SDL_VideoSurface->format->palette->ncolors);
645 } 645 }
646 646
662 SDL_VideoSurface->format->palette); 662 SDL_VideoSurface->format->palette);
663 } else { 663 } else {
664 SDL_DitherColors(SDL_ShadowSurface->format->palette->colors, 664 SDL_DitherColors(SDL_ShadowSurface->format->palette->colors,
665 SDL_ShadowSurface->format->BitsPerPixel); 665 SDL_ShadowSurface->format->BitsPerPixel);
666 } 666 }
667 SDL_AddPaletteWatch(SDL_ShadowSurface->format->palette,
668 SDL_VideoPaletteChanged, SDL_ShadowSurface);
667 } 669 }
668 } 670 }
669 SDL_PublicSurface = 671 SDL_PublicSurface =
670 (SDL_ShadowSurface ? SDL_ShadowSurface : SDL_VideoSurface); 672 (SDL_ShadowSurface ? SDL_ShadowSurface : SDL_VideoSurface);
671 673