comparison src/video/SDL_video.c @ 488:0a111805b53a

Fixed missing cursor after shadow buffer flip (thanks Jan!)
author Sam Lantinga <slouken@libsdl.org>
date Mon, 09 Sep 2002 03:22:19 +0000
parents a888b3ae31ff
children dad72daf44b3
comparison
equal deleted inserted replaced
487:414d77a36716 488:0a111805b53a
964 SDL_VideoDevice *video = current_video; 964 SDL_VideoDevice *video = current_video;
965 SDL_VideoDevice *this = current_video; 965 SDL_VideoDevice *this = current_video;
966 966
967 if ( screen == SDL_ShadowSurface ) { 967 if ( screen == SDL_ShadowSurface ) {
968 /* Blit the shadow surface using saved mapping */ 968 /* Blit the shadow surface using saved mapping */
969 SDL_Palette *pal = screen->format->palette; 969 SDL_Palette *pal = screen->format->palette;
970 SDL_Color *saved_colors = NULL; 970 SDL_Color *saved_colors = NULL;
971 if ( pal && !(SDL_VideoSurface->flags & SDL_HWPALETTE) ) { 971 if ( pal && !(SDL_VideoSurface->flags & SDL_HWPALETTE) ) {
972 /* simulated 8bpp, use correct physical palette */ 972 /* simulated 8bpp, use correct physical palette */
973 saved_colors = pal->colors; 973 saved_colors = pal->colors;
974 if ( video->gammacols ) { 974 if ( video->gammacols ) {
975 /* gamma-corrected palette */ 975 /* gamma-corrected palette */
976 pal->colors = video->gammacols; 976 pal->colors = video->gammacols;
992 for ( i=0; i<numrects; ++i ) { 992 for ( i=0; i<numrects; ++i ) {
993 SDL_LowerBlit(SDL_ShadowSurface, &rects[i], 993 SDL_LowerBlit(SDL_ShadowSurface, &rects[i],
994 SDL_VideoSurface, &rects[i]); 994 SDL_VideoSurface, &rects[i]);
995 } 995 }
996 } 996 }
997 if ( saved_colors ) 997 if ( saved_colors ) {
998 pal->colors = saved_colors; 998 pal->colors = saved_colors;
999 }
999 1000
1000 /* Fall through to video surface update */ 1001 /* Fall through to video surface update */
1001 screen = SDL_VideoSurface; 1002 screen = SDL_VideoSurface;
1002 } 1003 }
1003 if ( screen == SDL_VideoSurface ) { 1004 if ( screen == SDL_VideoSurface ) {
1025 { 1026 {
1026 SDL_VideoDevice *video = current_video; 1027 SDL_VideoDevice *video = current_video;
1027 /* Copy the shadow surface to the video surface */ 1028 /* Copy the shadow surface to the video surface */
1028 if ( screen == SDL_ShadowSurface ) { 1029 if ( screen == SDL_ShadowSurface ) {
1029 SDL_Rect rect; 1030 SDL_Rect rect;
1030 SDL_Palette *pal = screen->format->palette; 1031 SDL_Palette *pal = screen->format->palette;
1031 SDL_Color *saved_colors = NULL; 1032 SDL_Color *saved_colors = NULL;
1032 if ( pal && !(SDL_VideoSurface->flags & SDL_HWPALETTE) ) { 1033 if ( pal && !(SDL_VideoSurface->flags & SDL_HWPALETTE) ) {
1033 /* simulated 8bpp, use correct physical palette */ 1034 /* simulated 8bpp, use correct physical palette */
1034 saved_colors = pal->colors; 1035 saved_colors = pal->colors;
1035 if ( video->gammacols ) { 1036 if ( video->gammacols ) {
1036 /* gamma-corrected palette */ 1037 /* gamma-corrected palette */
1037 pal->colors = video->gammacols; 1038 pal->colors = video->gammacols;
1043 1044
1044 rect.x = 0; 1045 rect.x = 0;
1045 rect.y = 0; 1046 rect.y = 0;
1046 rect.w = screen->w; 1047 rect.w = screen->w;
1047 rect.h = screen->h; 1048 rect.h = screen->h;
1048 SDL_LowerBlit(SDL_ShadowSurface,&rect, SDL_VideoSurface,&rect); 1049 if ( SHOULD_DRAWCURSOR(SDL_cursorstate) ) {
1049 1050 SDL_LockCursor();
1050 if ( saved_colors ) 1051 SDL_DrawCursor(SDL_ShadowSurface);
1052 SDL_LowerBlit(SDL_ShadowSurface, &rect,
1053 SDL_VideoSurface, &rect);
1054 SDL_EraseCursor(SDL_ShadowSurface);
1055 SDL_UnlockCursor();
1056 } else {
1057 SDL_LowerBlit(SDL_ShadowSurface, &rect,
1058 SDL_VideoSurface, &rect);
1059 }
1060 if ( saved_colors ) {
1051 pal->colors = saved_colors; 1061 pal->colors = saved_colors;
1062 }
1063
1064 /* Fall through to video surface update */
1052 screen = SDL_VideoSurface; 1065 screen = SDL_VideoSurface;
1053 } 1066 }
1054 if ( (screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF ) { 1067 if ( (screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF ) {
1055 SDL_VideoDevice *this = current_video; 1068 SDL_VideoDevice *this = current_video;
1056 return(video->FlipHWSurface(this, SDL_VideoSurface)); 1069 return(video->FlipHWSurface(this, SDL_VideoSurface));