shithub: choc

Download patch

ref: dd2c93f86c6fb18a983570c60012a503d1aa539a
parent: 893f988ef36da034df99e981de453cd37dd830ba
author: Fabian Greffrath <[email protected]>
date: Thu Sep 17 14:30:10 EDT 2015

Video: In fullscreen mode, use desktop dimensions to calculate texture size

We do not change the video mode to run fullscreen but scale to fill
the desktop that "screen" is assigned to. So, use desktop dimensions
to calculate the size of the upscaled texture.

--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1835,6 +1835,22 @@
                 w, h, SDL_GetError());
     }
 
+    // If we are running fullscreen, the whole screen is our "window".
+
+    if (fullscreen)
+    {
+        SDL_DisplayMode mode;
+
+        // We do not change the video mode to run fullscreen but scale to fill
+        // the desktop that "screen" is assigned to. So, use desktop dimensions
+        // to calculate the size of the upscaled texture.
+
+        SDL_GetDesktopDisplayMode(SDL_GetWindowDisplayIndex(screen), &mode);
+
+        h = mode.h;
+        w = mode.w;
+    }
+
     // The SDL_RENDERER_TARGETTEXTURE flag is required to render the
     // intermediate texture into the upscaled texture.