foxygit / doom Log in
commit 7dd42ec073e68d4c9a32418215704368e2088fc0
Author:     Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Fri May 19 08:36:32 2017 +0200
Commit:     Fabian Greffrath <fabian@greffrath.com>
CommitDate: Fri May 19 08:36:32 2017 +0200

    video: omit drawing to screen until the window resize has finished
---
 src/i_video.c | 35 +++++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/src/i_video.c b/src/i_video.c
index ab31229a..75238f0f 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -709,24 +709,31 @@ void I_FinishUpdate (void)
     if (noblit)
         return;

-    if (need_resize && SDL_GetTicks() > last_resize_time + 500)
+    if (need_resize)
     {
-        int flags;
-        // When the window is resized (we're not in fullscreen mode),
-        // save the new window size.
-        flags = SDL_GetWindowFlags(screen);
-        if ((flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == 0)
+        if (SDL_GetTicks() > last_resize_time + 500)
         {
-            SDL_GetWindowSize(screen, &window_width, &window_height);
+            int flags;
+            // When the window is resized (we're not in fullscreen mode),
+            // save the new window size.
+            flags = SDL_GetWindowFlags(screen);
+            if ((flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == 0)
+            {
+                SDL_GetWindowSize(screen, &window_width, &window_height);

-            // Adjust the window by resizing again so that the window
-            // is the right aspect ratio.
-            AdjustWindowSize();
-            SDL_SetWindowSize(screen, window_width, window_height);
+                // Adjust the window by resizing again so that the window
+                // is the right aspect ratio.
+                AdjustWindowSize();
+                SDL_SetWindowSize(screen, window_width, window_height);
+            }
+            CreateUpscaledTexture(false);
+            need_resize = false;
+            palette_to_set = true;
+        }
+        else
+        {
+            return;
         }
-        CreateUpscaledTexture(false);
-        need_resize = false;
-        palette_to_set = true;
     }

     UpdateGrab();