1.1 --- a/src/video/SDL_video.c Tue Jul 03 09:22:57 2007 +0000
1.2 +++ b/src/video/SDL_video.c Tue Jul 03 09:39:09 2007 +0000
1.3 @@ -1142,16 +1142,18 @@
1.4 ncolors * sizeof(*colors));
1.5 }
1.6
1.7 - vidpal = SDL_VideoSurface->format->palette;
1.8 - if ( (screen == SDL_ShadowSurface) && vidpal ) {
1.9 - /*
1.10 - * This is a shadow surface, and the physical
1.11 - * framebuffer is also indexed. Propagate the
1.12 - * changes to its logical palette so that
1.13 - * updates are always identity blits
1.14 - */
1.15 - SDL_memcpy(vidpal->colors + firstcolor, colors,
1.16 - ncolors * sizeof(*colors));
1.17 + if ( current_video && SDL_VideoSurface ) {
1.18 + vidpal = SDL_VideoSurface->format->palette;
1.19 + if ( (screen == SDL_ShadowSurface) && vidpal ) {
1.20 + /*
1.21 + * This is a shadow surface, and the physical
1.22 + * framebuffer is also indexed. Propagate the
1.23 + * changes to its logical palette so that
1.24 + * updates are always identity blits
1.25 + */
1.26 + SDL_memcpy(vidpal->colors + firstcolor, colors,
1.27 + ncolors * sizeof(*colors));
1.28 + }
1.29 }
1.30 SDL_FormatChanged(screen);
1.31 }
1.32 @@ -1244,13 +1246,13 @@
1.33 int gotall;
1.34 int palsize;
1.35
1.36 - if ( ! current_video ) {
1.37 + if ( !screen ) {
1.38 return 0;
1.39 }
1.40 - if ( screen != SDL_PublicSurface ) {
1.41 + if ( !current_video || screen != SDL_PublicSurface ) {
1.42 /* only screens have physical palettes */
1.43 which &= ~SDL_PHYSPAL;
1.44 - } else if( (screen->flags & SDL_HWPALETTE) != SDL_HWPALETTE ) {
1.45 + } else if ( (screen->flags & SDL_HWPALETTE) != SDL_HWPALETTE ) {
1.46 /* hardware palettes required for split colormaps */
1.47 which |= SDL_PHYSPAL | SDL_LOGPAL;
1.48 }
1.49 @@ -1283,16 +1285,14 @@
1.50 * program's idea of what the screen looks like, but changes
1.51 * its actual appearance.
1.52 */
1.53 - if(!video)
1.54 - return gotall; /* video not yet initialized */
1.55 - if(!video->physpal && !(which & SDL_LOGPAL) ) {
1.56 + if ( !video->physpal && !(which & SDL_LOGPAL) ) {
1.57 /* Lazy physical palette allocation */
1.58 int size;
1.59 SDL_Palette *pp = SDL_malloc(sizeof(*pp));
1.60 if ( !pp ) {
1.61 return 0;
1.62 }
1.63 - current_video->physpal = pp;
1.64 + video->physpal = pp;
1.65 pp->ncolors = pal->ncolors;
1.66 size = pp->ncolors * sizeof(SDL_Color);
1.67 pp->colors = SDL_malloc(size);