From 600fb7cc220c69e9cdd23ef2e276251cb334540c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 10 Dec 2023 12:37:35 +0100 Subject: [PATCH] Minor cleanups --- Common/UI/Screen.cpp | 4 ---- UI/GameSettingsScreen.cpp | 2 ++ UI/NativeApp.cpp | 6 +++++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Common/UI/Screen.cpp b/Common/UI/Screen.cpp index 03337d081c..ac1c57fee6 100644 --- a/Common/UI/Screen.cpp +++ b/Common/UI/Screen.cpp @@ -6,7 +6,6 @@ #include "Common/UI/UI.h" #include "Common/UI/View.h" #include "Common/UI/ViewGroup.h" -#include "Common/UI/IconCache.h" #include "Common/Log.h" #include "Common/TimeUtil.h" @@ -64,8 +63,6 @@ void ScreenManager::update() { if (stack_.size()) { stack_.back().screen->update(); } - - g_iconCache.FrameUpdate(); } void ScreenManager::switchToNext() { @@ -139,7 +136,6 @@ void ScreenManager::axis(const AxisInput *axes, size_t count) { void ScreenManager::deviceLost() { for (auto &iter : stack_) iter.screen->deviceLost(); - g_iconCache.ClearTextures(); } void ScreenManager::deviceRestored() { diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 1037f4039b..881d6ee8bc 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -327,6 +327,8 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings) int max_res = std::min(max_res_temp, (int)ARRAY_SIZE(deviceResolutions)); UI::PopupMultiChoice *hwscale = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iAndroidHwScale, gr->T("Display Resolution (HW scaler)"), deviceResolutions, 0, max_res, I18NCat::GRAPHICS, screenManager())); hwscale->OnChoice.Add([](UI::EventParams &) { + System_PostUIMessage(UIMessage::GPU_RENDER_RESIZED); + System_PostUIMessage(UIMessage::GPU_DISPLAY_RESIZED); System_RecreateActivity(); return UI::EVENT_DONE; }); diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 1945da4c02..9b3dbda7ec 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -956,6 +956,7 @@ void NativeShutdownGraphics() { if (g_screenManager) { g_screenManager->deviceLost(); } + g_iconCache.ClearTextures(); if (gpu) gpu->DeviceLost(); @@ -1104,7 +1105,6 @@ void NativeFrame(GraphicsContext *graphicsContext) { Achievements::Idle(); g_DownloadManager.Update(); - g_screenManager->update(); g_Discord.Update(); g_BackgroundAudio.Play(); @@ -1124,6 +1124,10 @@ void NativeFrame(GraphicsContext *graphicsContext) { g_BackgroundAudio.Update(); } + g_iconCache.FrameUpdate(); + + g_screenManager->update(); + // Apply the UIContext bounds as a 2D transformation matrix. // TODO: This should be moved into the draw context... Matrix4x4 ortho = ComputeOrthoMatrix(g_display.dp_xres, g_display.dp_yres);