From dd775b84970e7b0b60f7ea07657091145dede05d Mon Sep 17 00:00:00 2001 From: Dario Date: Tue, 11 Feb 2025 20:41:22 -0300 Subject: [PATCH] Simplify squash ratio computation. --- UnleashedRecomp/ui/options_menu.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/UnleashedRecomp/ui/options_menu.cpp b/UnleashedRecomp/ui/options_menu.cpp index a6aa9ef6..a6fb52da 100644 --- a/UnleashedRecomp/ui/options_menu.cpp +++ b/UnleashedRecomp/ui/options_menu.cpp @@ -495,16 +495,7 @@ static bool DrawCategories() for (size_t i = 0; i < g_categoryCount; i++) { textSizes[i] = g_dfsogeistdFont->CalcTextSizeA(size, FLT_MAX, 0.0f, GetCategory(i).c_str()); - - if (textSizes[i].x > maxTextWidth) - { - textSquashRatio[i] = maxTextWidth / textSizes[i].x; - } - else - { - textSquashRatio[i] = 1.0f; - } - + textSquashRatio[i] = std::min(maxTextWidth / textSizes[i].x, 1.0f); tabWidthSum += textSizes[i].x * textSquashRatio[i]; }