diff --git a/sc2/src/libs/graphics/sdl/opengl.c b/sc2/src/libs/graphics/sdl/opengl.c index a7d506e86..d8fe33fa6 100644 --- a/sc2/src/libs/graphics/sdl/opengl.c +++ b/sc2/src/libs/graphics/sdl/opengl.c @@ -280,6 +280,16 @@ TFB_GL_InitGraphics (int driver, int flags, int width, int height) return 0; } +void +TFB_GL_UninitGraphics (void) +{ + int i; + + for (i = 0; i < TFB_GFX_NUMSCREENS; i++) { + UnInit_Screen (&GL_Screens[i].scaled); + } +} + static void TFB_GL_UploadTransitionScreen (void) { diff --git a/sc2/src/libs/graphics/sdl/sdl1_common.c b/sc2/src/libs/graphics/sdl/sdl1_common.c index b3de02a30..5c675e12d 100644 --- a/sc2/src/libs/graphics/sdl/sdl1_common.c +++ b/sc2/src/libs/graphics/sdl/sdl1_common.c @@ -62,6 +62,8 @@ TFB_PreInit (void) log_add (log_Fatal, "Could not initialize SDL: %s.", SDL_GetError ()); exit (EXIT_FAILURE); } + + atexit (TFB_PreQuit); } static void @@ -223,9 +225,9 @@ TFB_SupportsHardwareScaling (void) static SDL_Surface * Create_Screen (SDL_Surface *templat, int w, int h) { - SDL_Surface *newsurf = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h + SDL_Surface *newsurf = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, templat->format->BitsPerPixel, - templat->format->Rmask, templat->format->GMask, + templat->format->Rmask, templat->format->Gmask, templat->format->Bmask, 0); if (newsurf == 0) { log_add (log_Error, "Couldn't create screen buffes: %s",