removed some global variables from function parameters
authorHolger Schemel <info@artsoft.org>
Sat, 2 Apr 2016 09:48:03 +0000 (11:48 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 2 Apr 2016 09:48:03 +0000 (11:48 +0200)
src/libgame/sdl.c
src/libgame/sdl.h
src/libgame/system.c

index a73bae86f314896acace4666261f575344b0cb36..65930a7c7b9068769664b65763276c4130cd7d98 100644 (file)
@@ -383,8 +383,7 @@ void SDLInitVideoDisplay(void)
 #endif
 }
 
-void SDLInitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window,
-                       boolean fullscreen)
+void SDLInitVideoBuffer(boolean fullscreen)
 {
   video.window_scaling_percent = setup.window_scaling_percent;
   video.window_scaling_quality = setup.window_scaling_quality;
@@ -398,7 +397,7 @@ void SDLInitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window,
 #endif
 
   /* open SDL video output device (window or fullscreen mode) */
-  if (!SDLSetVideoMode(backbuffer, fullscreen))
+  if (!SDLSetVideoMode(fullscreen))
     Error(ERR_EXIT, "setting video mode failed");
 
   /* !!! SDL2 can only set the window icon if the window already exists !!! */
@@ -426,10 +425,10 @@ void SDLInitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window,
      should never be drawn to directly, it would do no harm nevertheless. */
 
   /* create additional (symbolic) buffer for double-buffering */
-  ReCreateBitmap(window, video.width, video.height, video.depth);
+  ReCreateBitmap(&window, video.width, video.height, video.depth);
 }
 
-static boolean SDLCreateScreen(DrawBuffer **backbuffer, boolean fullscreen)
+static boolean SDLCreateScreen(boolean fullscreen)
 {
   SDL_Surface *new_surface = NULL;
 
@@ -605,21 +604,21 @@ static boolean SDLCreateScreen(DrawBuffer **backbuffer, boolean fullscreen)
     fullscreen_enabled = fullscreen;
 #endif
 
-  if (*backbuffer == NULL)
-    *backbuffer = CreateBitmapStruct();
+  if (backbuffer == NULL)
+    backbuffer = CreateBitmapStruct();
 
-  (*backbuffer)->width  = video.width;
-  (*backbuffer)->height = video.height;
+  backbuffer->width  = video.width;
+  backbuffer->height = video.height;
 
-  if ((*backbuffer)->surface)
-    SDL_FreeSurface((*backbuffer)->surface);
+  if (backbuffer->surface)
+    SDL_FreeSurface(backbuffer->surface);
 
-  (*backbuffer)->surface = new_surface;
+  backbuffer->surface = new_surface;
 
   return (new_surface != NULL);
 }
 
-boolean SDLSetVideoMode(DrawBuffer **backbuffer, boolean fullscreen)
+boolean SDLSetVideoMode(boolean fullscreen)
 {
   boolean success = FALSE;
 
@@ -628,7 +627,7 @@ boolean SDLSetVideoMode(DrawBuffer **backbuffer, boolean fullscreen)
   if (fullscreen && !video.fullscreen_enabled && video.fullscreen_available)
   {
     /* switch display to fullscreen mode, if available */
-    success = SDLCreateScreen(backbuffer, TRUE);
+    success = SDLCreateScreen(TRUE);
 
     if (!success)
     {
@@ -644,7 +643,7 @@ boolean SDLSetVideoMode(DrawBuffer **backbuffer, boolean fullscreen)
   if ((!fullscreen && video.fullscreen_enabled) || !success)
   {
     /* switch display to window mode */
-    success = SDLCreateScreen(backbuffer, FALSE);
+    success = SDLCreateScreen(FALSE);
 
     if (!success)
     {
index 3a00cb1136a5ea745960b8d776dc97b68b85e77d..3b3266178c56aed9820ace30e8e7d0bc2b76b1d7 100644 (file)
@@ -451,8 +451,8 @@ void SDLSetWindowTitle(void);
 
 void SDLLimitScreenUpdates(boolean);
 void SDLInitVideoDisplay(void);
-void SDLInitVideoBuffer(DrawBuffer **, DrawWindow **, boolean);
-boolean SDLSetVideoMode(DrawBuffer **, boolean);
+void SDLInitVideoBuffer(boolean);
+boolean SDLSetVideoMode(boolean);
 void SDLCreateBitmapContent(Bitmap *, int, int, int);
 void SDLFreeBitmapPointers(Bitmap *);
 void SDLCopyArea(Bitmap *, Bitmap *, int, int, int, int, int, int, int);
index 8df809cd787ba19cdc91041866a11d432c397597..3e49544cecc5f34918957491756ac27b5b194d7e 100644 (file)
@@ -380,7 +380,7 @@ void InitVideoBuffer(int width, int height, int depth, boolean fullscreen)
 
   video.window_scaling_available = WINDOW_SCALING_STATUS;
 
-  SDLInitVideoBuffer(&backbuffer, &window, fullscreen);
+  SDLInitVideoBuffer(fullscreen);
 
   video.initialized = TRUE;
 
@@ -886,7 +886,7 @@ void KeyboardAutoRepeatOff(void)
 
 boolean SetVideoMode(boolean fullscreen)
 {
-  return SDLSetVideoMode(&backbuffer, fullscreen);
+  return SDLSetVideoMode(fullscreen);
 }
 
 boolean ChangeVideoModeIfNeeded(boolean fullscreen)