From 6b95371813c5df32026141e68d7e197373509d3a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 19 Mar 2017 18:38:16 +0100 Subject: [PATCH] - made a few adjustments to the clean factor calculation so that on large screens the smaller factor gets preferred. Without such tweaking the menu scale tends to get a bit too large on some screen sizes. --- src/v_video.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/v_video.cpp b/src/v_video.cpp index c942cb9fe..0a7c4614f 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -1396,6 +1396,12 @@ void V_CalcCleanFacs (int designwidth, int designheight, int realwidth, int real int cheight; int cx1, cy1, cx2, cy2; + // For larger screems always use at least a 16:9 ratio for clean factor calculation, even if the actual ratio is narrower. + if (realwidth > 1280 && (double)realwidth / realheight < 16./9) + { + realheight = realwidth * 9 / 16; + } + ratio = ActiveRatio(realwidth, realheight); if (AspectTallerThanWide(ratio)) { @@ -1413,7 +1419,7 @@ void V_CalcCleanFacs (int designwidth, int designheight, int realwidth, int real cy1 = MAX(cheight / designheight, 1); cx2 = MAX(realwidth / designwidth, 1); cy2 = MAX(realheight / designheight, 1); - if (abs(cx1 - cy1) <= abs(cx2 - cy2) || cx1 >= 4) + if (abs(cx1 - cy1) <= abs(cx2 - cy2) || MAX(cx1, cx2) >= 4) { // e.g. 640x360 looks better with this. *cleanx = cx1; *cleany = cy1;