diff --git a/sc2/src/libs/graphics/sdl/opengl.c b/sc2/src/libs/graphics/sdl/opengl.c index 1f87f0e35..be8b68832 100644 --- a/sc2/src/libs/graphics/sdl/opengl.c +++ b/sc2/src/libs/graphics/sdl/opengl.c @@ -69,30 +69,6 @@ static TFB_GRAPHICS_BACKEND opengl_unscaled_backend = { TFB_GL_ColorLayer }; -static SDL_Surface * -Create_Screen (SDL_Surface *templat, int w, int h) -{ - SDL_Surface *newsurf = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, - templat->format->BitsPerPixel, - templat->format->Rmask, templat->format->Gmask, - templat->format->Bmask, 0); - if (newsurf == 0) { - log_add (log_Error, "Couldn't create screen buffers: %s", - SDL_GetError()); - } - return newsurf; -} - -static int -ReInit_Screen (SDL_Surface **screen, SDL_Surface *templat, int w, int h) -{ - if (*screen) - SDL_FreeSurface (*screen); - *screen = Create_Screen (templat, w, h); - - return *screen == 0 ? -1 : 0; -} - static int AttemptColorDepth (int flags, int width, int height, int bpp) { diff --git a/sc2/src/libs/graphics/sdl/pure.c b/sc2/src/libs/graphics/sdl/pure.c index c6af4d3ef..96a7ecf66 100644 --- a/sc2/src/libs/graphics/sdl/pure.c +++ b/sc2/src/libs/graphics/sdl/pure.c @@ -47,30 +47,6 @@ static TFB_GRAPHICS_BACKEND pure_unscaled_backend = { TFB_Pure_ScreenLayer, TFB_Pure_ColorLayer }; -static SDL_Surface * -Create_Screen (SDL_Surface *templat, int w, int h) -{ - SDL_Surface *newsurf = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, - templat->format->BitsPerPixel, - templat->format->Rmask, templat->format->Gmask, - templat->format->Bmask, 0); - if (newsurf == 0) { - log_add (log_Error, "Couldn't create screen buffers: %s", - SDL_GetError()); - } - return newsurf; -} - -static int -ReInit_Screen (SDL_Surface **screen, SDL_Surface *templat, int w, int h) -{ - if (*screen) - SDL_FreeSurface (*screen); - *screen = Create_Screen (templat, w, h); - - return *screen == 0 ? -1 : 0; -} - // We cannot rely on SDL_DisplayFormatAlpha() anymore. It can return // formats that we do not expect (SDL v1.2.14 on Mac OSX). Mac likes // ARGB surfaces, but SDL_DisplayFormatAlpha thinks that only RGBA are fast. diff --git a/sc2/src/libs/graphics/sdl/sdl_common.c b/sc2/src/libs/graphics/sdl/sdl_common.c index 423fe0c47..389ed73b3 100644 --- a/sc2/src/libs/graphics/sdl/sdl_common.c +++ b/sc2/src/libs/graphics/sdl/sdl_common.c @@ -352,3 +352,27 @@ TFB_SetGamma (float gamma) { return (SDL_SetGamma (gamma, gamma, gamma) == 0); } + +SDL_Surface * +Create_Screen (SDL_Surface *templat, int w, int h) +{ + SDL_Surface *newsurf = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, + templat->format->BitsPerPixel, + templat->format->Rmask, templat->format->Gmask, + templat->format->Bmask, 0); + if (newsurf == 0) { + log_add (log_Error, "Couldn't create screen buffers: %s", + SDL_GetError()); + } + return newsurf; +} + +int +ReInit_Screen (SDL_Surface **screen, SDL_Surface *templat, int w, int h) +{ + if (*screen) + SDL_FreeSurface (*screen); + *screen = Create_Screen (templat, w, h); + + return *screen == 0 ? -1 : 0; +} diff --git a/sc2/src/libs/graphics/sdl/sdl_common.h b/sc2/src/libs/graphics/sdl/sdl_common.h index 80ac94bb5..091bcde3f 100644 --- a/sc2/src/libs/graphics/sdl/sdl_common.h +++ b/sc2/src/libs/graphics/sdl/sdl_common.h @@ -48,4 +48,7 @@ extern SDL_Surface *format_conv_surf; SDL_Surface* TFB_DisplayFormatAlpha (SDL_Surface *surface); +SDL_Surface* Create_Screen (SDL_Surface *templat, int w, int h); +int ReInit_Screen (SDL_Surface **screen, SDL_Surface *templat, int w, int h); + #endif