comparison src/SDL_compat.c @ 2831:7173fc5c7ef6

Fixed crashes when resizing video modes
author Sam Lantinga <slouken@libsdl.org>
date Fri, 05 Dec 2008 06:19:49 +0000
parents 16fe3b867887
children 00356f22195a
comparison
equal deleted inserted replaced
2830:af3dd02cf043 2831:7173fc5c7ef6
36 static SDL_Surface *SDL_VideoSurface = NULL; 36 static SDL_Surface *SDL_VideoSurface = NULL;
37 static SDL_Surface *SDL_ShadowSurface = NULL; 37 static SDL_Surface *SDL_ShadowSurface = NULL;
38 static SDL_Surface *SDL_PublicSurface = NULL; 38 static SDL_Surface *SDL_PublicSurface = NULL;
39 static SDL_GLContext *SDL_VideoContext = NULL; 39 static SDL_GLContext *SDL_VideoContext = NULL;
40 static Uint32 SDL_VideoFlags = 0; 40 static Uint32 SDL_VideoFlags = 0;
41 static int SDL_VideoBPP = 0;
42 static char *wm_title = NULL; 41 static char *wm_title = NULL;
43 42
44 char * 43 char *
45 SDL_AudioDriverName(char *namebuf, int maxlen) 44 SDL_AudioDriverName(char *namebuf, int maxlen)
46 { 45 {
429 SDL_VideoSurface->pixels = 428 SDL_VideoSurface->pixels =
430 SDL_realloc(SDL_VideoSurface->pixels, 429 SDL_realloc(SDL_VideoSurface->pixels,
431 SDL_VideoSurface->h * SDL_VideoSurface->pitch); 430 SDL_VideoSurface->h * SDL_VideoSurface->pitch);
432 } 431 }
433 SDL_SetClipRect(SDL_VideoSurface, NULL); 432 SDL_SetClipRect(SDL_VideoSurface, NULL);
433 SDL_InvalidateMap(SDL_VideoSurface->map);
434 434
435 if (SDL_ShadowSurface) { 435 if (SDL_ShadowSurface) {
436 SDL_ShadowSurface->w = width; 436 SDL_ShadowSurface->w = width;
437 SDL_ShadowSurface->h = height; 437 SDL_ShadowSurface->h = height;
438 SDL_CalculatePitch(SDL_ShadowSurface); 438 SDL_ShadowSurface->pitch = SDL_CalculatePitch(SDL_ShadowSurface);
439 SDL_ShadowSurface->pixels = 439 SDL_ShadowSurface->pixels =
440 SDL_realloc(SDL_ShadowSurface->pixels, 440 SDL_realloc(SDL_ShadowSurface->pixels,
441 SDL_ShadowSurface->h * SDL_ShadowSurface->pitch); 441 SDL_ShadowSurface->h * SDL_ShadowSurface->pitch);
442 SDL_SetClipRect(SDL_ShadowSurface, NULL); 442 SDL_SetClipRect(SDL_ShadowSurface, NULL);
443 SDL_InvalidateMap(SDL_ShadowSurface->map);
443 } 444 }
444 445
445 ClearVideoSurface(); 446 ClearVideoSurface();
446 447
447 return 0; 448 return 0;