summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/OnScreenUI.cpp
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2023-06-17 04:07:13 +0200
committerGitHub <noreply@github.com>2023-06-17 04:07:13 +0200
commit1aef85a985a81d9e9419a14d92cdf4e497e2a0b4 (patch)
treedd4c56f2dbbc1f0b84a58ef355fe29cdedca9c1e /Source/Core/VideoCommon/OnScreenUI.cpp
parent089d43399616dd7574515a899bdb92d8d1f0815b (diff)
parentfc53dca7bdc30473b6e26228b97c5e0de378b3d3 (diff)
Merge pull request #11918 from TellowKrinkle/DPIScale
Improved DPI change handling
Diffstat (limited to 'Source/Core/VideoCommon/OnScreenUI.cpp')
-rw-r--r--Source/Core/VideoCommon/OnScreenUI.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Source/Core/VideoCommon/OnScreenUI.cpp b/Source/Core/VideoCommon/OnScreenUI.cpp
index e2fa2593a7..d5949e356f 100644
--- a/Source/Core/VideoCommon/OnScreenUI.cpp
+++ b/Source/Core/VideoCommon/OnScreenUI.cpp
@@ -55,7 +55,6 @@ bool OnScreenUI::Initialize(u32 width, u32 height, float scale)
// Don't create an ini file. TODO: Do we want this in the future?
ImGui::GetIO().IniFilename = nullptr;
SetScale(scale);
- ImGui::GetStyle().WindowRounding = 7.0f;
PortableVertexDeclaration vdecl = {};
vdecl.position = {ComponentFormat::Float, 2, offsetof(ImDrawVert, pos), true, false};
@@ -343,6 +342,10 @@ void OnScreenUI::SetScale(float backbuffer_scale)
ImGui::GetIO().DisplayFramebufferScale.x = backbuffer_scale;
ImGui::GetIO().DisplayFramebufferScale.y = backbuffer_scale;
ImGui::GetIO().FontGlobalScale = backbuffer_scale;
+ // ScaleAllSizes scales in-place, so calling it twice will double-apply the scale
+ // Reset the style first so that the scale is applied to the base style, not an already-scaled one
+ ImGui::GetStyle() = {};
+ ImGui::GetStyle().WindowRounding = 7.0f;
ImGui::GetStyle().ScaleAllSizes(backbuffer_scale);
m_backbuffer_scale = backbuffer_scale;