From 2c54ddf701bbbd3cde512db1dccd7d9acccf02ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=98yvind=20Kol=C3=A5s?= <pippin@gimp.org>
Date: Sat, 21 Oct 2023 06:45:30 +0200
Subject: [PATCH] st3m_gfx: fix scale factor when changing default mode

---
 components/st3m/st3m_gfx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/components/st3m/st3m_gfx.c b/components/st3m/st3m_gfx.c
index 16f49f3348..2b7c5e9a25 100644
--- a/components/st3m/st3m_gfx.c
+++ b/components/st3m/st3m_gfx.c
@@ -183,7 +183,7 @@ static Ctx *st3m_gfx_ctx_int(st3m_gfx_mode mode) {
 }
 
 static void st3m_gfx_viewport_transform(Ctx *ctx, int reset) {
-    int scale = st3m_gfx_scale(_st3m_gfx_mode);
+    int scale = st3m_gfx_scale(_st3m_gfx_mode ? _st3m_gfx_mode : default_mode);
     int32_t offset_x = FLOW3R_BSP_DISPLAY_WIDTH / 2 / scale;
     int32_t offset_y = FLOW3R_BSP_DISPLAY_HEIGHT / 2 / scale;
     if (reset)
-- 
GitLab