moved redundant code to new function
authorHolger Schemel <info@artsoft.org>
Sat, 2 Apr 2016 17:50:35 +0000 (19:50 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 2 Apr 2016 17:50:35 +0000 (19:50 +0200)
src/libgame/sdl.c

index 08aec8dcbd0f5a9309a508d0d705c2e01560c359..4d303910b57628c4ed7169b4839d0ffc341e30ba 100644 (file)
@@ -49,6 +49,21 @@ void SDLLimitScreenUpdates(boolean enable)
   limit_screen_updates = enable;
 }
 
+static void FinalizeScreen()
+{
+  // copy global animations to render target buffer, if defined (below border)
+  if (gfx.draw_global_anim_function != NULL)
+    gfx.draw_global_anim_function(DRAW_GLOBAL_ANIM_STAGE_1);
+
+  // copy global masked border to render target buffer, if defined
+  if (gfx.draw_global_border_function != NULL)
+    gfx.draw_global_border_function(DRAW_BORDER_TO_SCREEN);
+
+  // copy global animations to render target buffer, if defined (above border)
+  if (gfx.draw_global_anim_function != NULL)
+    gfx.draw_global_anim_function(DRAW_GLOBAL_ANIM_STAGE_2);
+}
+
 static void UpdateScreen(SDL_Rect *rect)
 {
   static unsigned int update_screen_delay = 0;
@@ -88,17 +103,7 @@ static void UpdateScreen(SDL_Rect *rect)
     BlitBitmap(backbuffer, gfx.final_screen_bitmap, 0, 0,
               gfx.win_xsize, gfx.win_ysize, 0, 0);
 
-    // copy global animations to render target buffer, if defined (below border)
-    if (gfx.draw_global_anim_function != NULL)
-      gfx.draw_global_anim_function(DRAW_GLOBAL_ANIM_STAGE_1);
-
-    // copy global masked border to render target buffer, if defined
-    if (gfx.draw_global_border_function != NULL)
-      gfx.draw_global_border_function(DRAW_BORDER_TO_SCREEN);
-
-    // copy global animations to render target buffer, if defined (above border)
-    if (gfx.draw_global_anim_function != NULL)
-      gfx.draw_global_anim_function(DRAW_GLOBAL_ANIM_STAGE_2);
+    FinalizeScreen();
 
     screen = gfx.final_screen_bitmap->surface;
 
@@ -145,17 +150,7 @@ static void UpdateScreen(SDL_Rect *rect)
 #endif
 
 #if !USE_FINAL_SCREEN_BITMAP
-  // copy global animations to render target buffer, if defined (below border)
-  if (gfx.draw_global_anim_function != NULL)
-    gfx.draw_global_anim_function(DRAW_GLOBAL_ANIM_STAGE_1);
-
-  // copy global masked border to render target buffer, if defined
-  if (gfx.draw_global_border_function != NULL)
-    gfx.draw_global_border_function(DRAW_BORDER_TO_SCREEN);
-
-  // copy global animations to render target buffer, if defined (above border)
-  if (gfx.draw_global_anim_function != NULL)
-    gfx.draw_global_anim_function(DRAW_GLOBAL_ANIM_STAGE_2);
+  FinalizeScreen();
 #endif
 
 #if USE_TARGET_TEXTURE