From 2ed9a02bea9f3454d622d68341ba3039b0dd2d21 Mon Sep 17 00:00:00 2001 From: shagu Date: Fri, 22 Nov 2024 21:00:10 +0100 Subject: [PATCH] pixelperfect: use pre-calculated min values --- modules/pixelperfect.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/pixelperfect.lua b/modules/pixelperfect.lua index 6ac2a5c3..7393275c 100644 --- a/modules/pixelperfect.lua +++ b/modules/pixelperfect.lua @@ -1,4 +1,13 @@ pfUI:RegisterModule("pixelperfect", "vanilla:tbc", function () + -- pre-calculated min values + local statics = { + [4] = 1.4222222222222, + [5] = 1.1377777777778, + [6] = 0.94814814814815, + [7] = 0.81269841269841, + [8] = 0.71111111111111, + } + -- pixel perfect local function pixelperfect() local conf = tonumber(C.global.pixelperfect) @@ -19,6 +28,7 @@ pfUI:RegisterModule("pixelperfect", "vanilla:tbc", function () for screenwidth, screenheight in gfind(resolution, "(.+)x(.+)") do local screenheight = tonumber(screenheight) / 8 local scale = 768 / ( screenheight * conf ) + scale = math.max(statics[conf] or 0, scale) SetCVar("uiScale", scale) SetCVar("useUiScale", 1)