changeset 2831:7173fc5c7ef6

Fixed crashes when resizing video modes
author Sam Lantinga <slouken@libsdl.org>
date Fri, 05 Dec 2008 06:19:49 +0000
parents af3dd02cf043
children 0379769e8caa
files src/SDL_compat.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/SDL_compat.c	Fri Dec 05 06:19:09 2008 +0000
+++ b/src/SDL_compat.c	Fri Dec 05 06:19:49 2008 +0000
@@ -38,7 +38,6 @@
 static SDL_Surface *SDL_PublicSurface = NULL;
 static SDL_GLContext *SDL_VideoContext = NULL;
 static Uint32 SDL_VideoFlags = 0;
-static int SDL_VideoBPP = 0;
 static char *wm_title = NULL;
 
 char *
@@ -431,15 +430,17 @@
                         SDL_VideoSurface->h * SDL_VideoSurface->pitch);
     }
     SDL_SetClipRect(SDL_VideoSurface, NULL);
+    SDL_InvalidateMap(SDL_VideoSurface->map);
 
     if (SDL_ShadowSurface) {
         SDL_ShadowSurface->w = width;
         SDL_ShadowSurface->h = height;
-        SDL_CalculatePitch(SDL_ShadowSurface);
+        SDL_ShadowSurface->pitch = SDL_CalculatePitch(SDL_ShadowSurface);
         SDL_ShadowSurface->pixels =
             SDL_realloc(SDL_ShadowSurface->pixels,
                         SDL_ShadowSurface->h * SDL_ShadowSurface->pitch);
         SDL_SetClipRect(SDL_ShadowSurface, NULL);
+        SDL_InvalidateMap(SDL_ShadowSurface->map);
     }
 
     ClearVideoSurface();