From 76ad5f1567807074348fc74dfe902a2cbc995038 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Tue, 23 Mar 2021 22:08:21 -0700 Subject: [PATCH] Switch: Fix image size scaling rounding (fixes #2073) --- CHANGES | 1 + src/platform/switch/main.c | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index e46816bc6..414808d3d 100644 --- a/CHANGES +++ b/CHANGES @@ -108,6 +108,7 @@ Other fixes: - Qt: Fix inability to clear hat bindings - SM83: Simplify register pair access on big endian - SM83: Disassemble STOP as one byte + - Switch: Fix GB game height in pixel accurate mode (fixes mgba.io/i/2073) - Wii: Fix crash on unloading irregularly sized GBA ROMs Misc: - 3DS: Use "wide mode" where applicable for slightly better filtering diff --git a/src/platform/switch/main.c b/src/platform/switch/main.c index 01271bf15..9c300eab1 100644 --- a/src/platform/switch/main.c +++ b/src/platform/switch/main.c @@ -359,24 +359,24 @@ static void _drawTex(struct mGUIRunner* runner, unsigned width, unsigned height, switch (screenMode) { case SM_PA: if (aspectX > aspectY) { - max = floor(1.0 / aspectX); + max = floor(1.f / aspectX); } else { - max = floor(1.0 / aspectY); + max = floor(1.f / aspectY); } - if (max >= 1.0) { + if (max >= 1.f) { break; } // Fall through case SM_AF: if (aspectX > aspectY) { - max = 1.0 / aspectX; + max = 1.f / aspectX; } else { - max = 1.0 / aspectY; + max = 1.f / aspectY; } break; case SM_SF: - aspectX = 1.0; - aspectY = 1.0; + aspectX = 1.f; + aspectY = 1.f; break; }