|
From: <av...@us...> - 2012-02-13 01:10:46
|
Revision: 3770
http://sc2.svn.sourceforge.net/sc2/?rev=3770&view=rev
Author: avolkov
Date: 2012-02-13 01:10:40 +0000 (Mon, 13 Feb 2012)
Log Message:
-----------
Consolidate duplicate screen init functions
Modified Paths:
--------------
trunk/sc2/src/libs/graphics/sdl/opengl.c
trunk/sc2/src/libs/graphics/sdl/pure.c
trunk/sc2/src/libs/graphics/sdl/sdl_common.c
trunk/sc2/src/libs/graphics/sdl/sdl_common.h
Modified: trunk/sc2/src/libs/graphics/sdl/opengl.c
===================================================================
--- trunk/sc2/src/libs/graphics/sdl/opengl.c 2012-02-13 01:08:15 UTC (rev 3769)
+++ trunk/sc2/src/libs/graphics/sdl/opengl.c 2012-02-13 01:10:40 UTC (rev 3770)
@@ -69,31 +69,7 @@
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)
{
int videomode_flags;
Modified: trunk/sc2/src/libs/graphics/sdl/pure.c
===================================================================
--- trunk/sc2/src/libs/graphics/sdl/pure.c 2012-02-13 01:08:15 UTC (rev 3769)
+++ trunk/sc2/src/libs/graphics/sdl/pure.c 2012-02-13 01:10:40 UTC (rev 3770)
@@ -47,30 +47,6 @@
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.
Modified: trunk/sc2/src/libs/graphics/sdl/sdl_common.c
===================================================================
--- trunk/sc2/src/libs/graphics/sdl/sdl_common.c 2012-02-13 01:08:15 UTC (rev 3769)
+++ trunk/sc2/src/libs/graphics/sdl/sdl_common.c 2012-02-13 01:10:40 UTC (rev 3770)
@@ -352,3 +352,27 @@
{
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;
+}
Modified: trunk/sc2/src/libs/graphics/sdl/sdl_common.h
===================================================================
--- trunk/sc2/src/libs/graphics/sdl/sdl_common.h 2012-02-13 01:08:15 UTC (rev 3769)
+++ trunk/sc2/src/libs/graphics/sdl/sdl_common.h 2012-02-13 01:10:40 UTC (rev 3770)
@@ -48,4 +48,7 @@
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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|