shithub: choc

Download patch

ref: a9173b09d799006ab09e3def8c4b43b6b8668c1a
parent: dd2c93f86c6fb18a983570c60012a503d1aa539a
author: Fabian Greffrath <fabian@greffrath.com>
date: Fri Sep 18 04:20:56 EDT 2015

create a new texture only if the upscale factor has changed

--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1016,12 +1016,8 @@
     const int w_scale = (w / SCREENWIDTH) + 1;
     const int h_scale = (h / SCREENHEIGHT) + 1;
     int upscale;
+    static int upscale_old;
 
-    if (texture_upscaled)
-    {
-        SDL_DestroyTexture(texture_upscaled);
-    }
-
     // When the screen or window dimensions do not match the aspect ratio
     // of the texture, the rendered area is scaled down to fit
 
@@ -1029,9 +1025,25 @@
 
     // Limit upscaling factor to 6 (1920x1200)
 
-    if (upscale > 6)
+    if (upscale < 2)
     {
+        upscale = 2;
+    }
+    else if (upscale > 6)
+    {
         upscale = 6;
+    }
+
+    if (upscale == upscale_old)
+    {
+        return;
+    }
+
+    upscale_old = upscale;
+
+    if (texture_upscaled)
+    {
+        SDL_DestroyTexture(texture_upscaled);
     }
 
     // Set the scaling quality for rendering the upscaled texture to "linear",