Fixed missing cursor after shadow buffer flip (thanks Jan!)
authorSam Lantinga <slouken@libsdl.org>
Mon, 09 Sep 2002 03:22:19 +0000
changeset 4880a111805b53a
parent 487 414d77a36716
child 489 d90349051cab
Fixed missing cursor after shadow buffer flip (thanks Jan!)
src/video/SDL_video.c
     1.1 --- a/src/video/SDL_video.c	Mon Sep 02 21:42:15 2002 +0000
     1.2 +++ b/src/video/SDL_video.c	Mon Sep 09 03:22:19 2002 +0000
     1.3 @@ -966,9 +966,9 @@
     1.4  
     1.5  	if ( screen == SDL_ShadowSurface ) {
     1.6  		/* Blit the shadow surface using saved mapping */
     1.7 -	        SDL_Palette *pal = screen->format->palette;
     1.8 +		SDL_Palette *pal = screen->format->palette;
     1.9  		SDL_Color *saved_colors = NULL;
    1.10 -	        if ( pal && !(SDL_VideoSurface->flags & SDL_HWPALETTE) ) {
    1.11 +		if ( pal && !(SDL_VideoSurface->flags & SDL_HWPALETTE) ) {
    1.12  			/* simulated 8bpp, use correct physical palette */
    1.13  			saved_colors = pal->colors;
    1.14  			if ( video->gammacols ) {
    1.15 @@ -994,8 +994,9 @@
    1.16  						SDL_VideoSurface, &rects[i]);
    1.17  			}
    1.18  		}
    1.19 -		if ( saved_colors )
    1.20 +		if ( saved_colors ) {
    1.21  			pal->colors = saved_colors;
    1.22 +		}
    1.23  
    1.24  		/* Fall through to video surface update */
    1.25  		screen = SDL_VideoSurface;
    1.26 @@ -1027,9 +1028,9 @@
    1.27  	/* Copy the shadow surface to the video surface */
    1.28  	if ( screen == SDL_ShadowSurface ) {
    1.29  		SDL_Rect rect;
    1.30 -	        SDL_Palette *pal = screen->format->palette;
    1.31 +		SDL_Palette *pal = screen->format->palette;
    1.32  		SDL_Color *saved_colors = NULL;
    1.33 -	        if ( pal && !(SDL_VideoSurface->flags & SDL_HWPALETTE) ) {
    1.34 +		if ( pal && !(SDL_VideoSurface->flags & SDL_HWPALETTE) ) {
    1.35  			/* simulated 8bpp, use correct physical palette */
    1.36  			saved_colors = pal->colors;
    1.37  			if ( video->gammacols ) {
    1.38 @@ -1045,10 +1046,22 @@
    1.39  		rect.y = 0;
    1.40  		rect.w = screen->w;
    1.41  		rect.h = screen->h;
    1.42 -		SDL_LowerBlit(SDL_ShadowSurface,&rect, SDL_VideoSurface,&rect);
    1.43 +		if ( SHOULD_DRAWCURSOR(SDL_cursorstate) ) {
    1.44 +			SDL_LockCursor();
    1.45 +			SDL_DrawCursor(SDL_ShadowSurface);
    1.46 +			SDL_LowerBlit(SDL_ShadowSurface, &rect,
    1.47 +					SDL_VideoSurface, &rect);
    1.48 +			SDL_EraseCursor(SDL_ShadowSurface);
    1.49 +			SDL_UnlockCursor();
    1.50 +		} else {
    1.51 +			SDL_LowerBlit(SDL_ShadowSurface, &rect,
    1.52 +					SDL_VideoSurface, &rect);
    1.53 +		}
    1.54 +		if ( saved_colors ) {
    1.55 +			pal->colors = saved_colors;
    1.56 +		}
    1.57  
    1.58 -		if ( saved_colors )
    1.59 -			pal->colors = saved_colors;
    1.60 +		/* Fall through to video surface update */
    1.61  		screen = SDL_VideoSurface;
    1.62  	}
    1.63  	if ( (screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF ) {