ref: 073465c31d1cbdd42685c79b35f738bb385592d3
parent: 5ff1698982eb861a55031de14654a195a6895006
author: Mike Swanson <[email protected]>
date: Sat Mar 17 21:08:56 EDT 2018
video: Don't enforce an 8:5 ratio when correction is not enabled. As outlined in #968, this removes the 8:5 ratio in both fullscreen and windowed modes, allowing the game screen to scale to any arbitrary resolution or window size, no black borders visible!
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -290,16 +290,19 @@
// ratio consistent with the aspect_ratio_correct variable.
static void AdjustWindowSize(void)
{
- if (window_width * actualheight <= window_height * SCREENWIDTH)
+ if (aspect_ratio_correct)
{
- // We round up window_height if the ratio is not exact; this leaves
- // the result stable.
- window_height = (window_width * actualheight + SCREENWIDTH - 1) / SCREENWIDTH;
+ if (window_width * actualheight <= window_height * SCREENWIDTH)
+ {
+ // We round up window_height if the ratio is not exact; this leaves
+ // the result stable.
+ window_height = (window_width * actualheight + SCREENWIDTH - 1) / SCREENWIDTH;
+ }
+ else
+ {
+ window_width = window_height * SCREENWIDTH / actualheight;
+ }
}
- else
- {
- window_width = window_height * SCREENWIDTH / actualheight;
- }
}
static void HandleWindowEvent(SDL_WindowEvent *event)
@@ -1240,9 +1243,12 @@
// time this also defines the aspect ratio that is preserved while scaling
// and stretching the texture into the window.
- SDL_RenderSetLogicalSize(renderer,
- SCREENWIDTH,
- actualheight);
+ if (aspect_ratio_correct)
+ {
+ SDL_RenderSetLogicalSize(renderer,
+ SCREENWIDTH,
+ actualheight);
+ }
// Force integer scales for resolution-independent rendering.