diff options
| author | Dentomologist <dentomologist@gmail.com> | 2026-03-02 11:01:37 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-02 11:01:37 -0800 |
| commit | 15f24c56e4ce8d7913c9db77b20d49210281a11d (patch) | |
| tree | 560de959e2e510526a859f51f8bc74cffcc61868 | |
| parent | 792601120c9f410015f143711383f60d4fa059c0 (diff) | |
| parent | 0bf34a73b31efc196ef80f9c5d81527788548d5e (diff) | |
Merge pull request #14327 from Dentomologist/performancemetrics_fix_graph_size_and_spacing
PerformanceMetrics: Fix graph size and spacing
| -rw-r--r-- | Source/Core/VideoCommon/PerformanceMetrics.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Source/Core/VideoCommon/PerformanceMetrics.cpp b/Source/Core/VideoCommon/PerformanceMetrics.cpp index d00e5dbbba..0e2e371d4e 100644 --- a/Source/Core/VideoCommon/PerformanceMetrics.cpp +++ b/Source/Core/VideoCommon/PerformanceMetrics.cpp @@ -143,6 +143,9 @@ void PerformanceMetrics::DrawImGuiStats(const float backbuffer_scale) // the layout to default. Hopefully users aren't changing window sizes or resolutions too often. const ImGuiCond set_next_position_condition = (display_size_changed || !movable_overlays) ? ImGuiCond_Always : ImGuiCond_FirstUseEver; + // Reset the graph size when changing resolutions, and otherwise let the user manually resize it. + const ImGuiCond set_next_size_condition = + display_size_changed ? ImGuiCond_Always : ImGuiCond_FirstUseEver; float window_y = window_padding; float window_x = display_size.x - window_padding; @@ -167,8 +170,11 @@ void PerformanceMetrics::DrawImGuiStats(const float backbuffer_scale) ImGui::SetWindowPos(ImVec2(clamped_window_x, clamped_window_y), ImGuiCond_Always); }; - const float graph_width = display_size.x / 4.0; - const float graph_height = display_size.y / 4.0; + const float min_auto_graph_width = 200.f * backbuffer_scale + 2.f * window_padding; + const float min_auto_graph_height = 144.f * backbuffer_scale + 2.f * window_padding; + + const float graph_width = std::max(min_auto_graph_width, display_size.x / 4.f); + const float graph_height = std::max(min_auto_graph_height, display_size.y / 4.f); const bool stack_vertically = !g_ActiveConfig.bShowGraphs; @@ -187,7 +193,7 @@ void PerformanceMetrics::DrawImGuiStats(const float backbuffer_scale) // Position in the top-right corner of the screen. ImGui::SetNextWindowPos(ImVec2(window_x, window_y), set_next_position_condition, ImVec2(1.0f, 0.0f)); - ImGui::SetNextWindowSize(ImVec2(graph_width, graph_height), ImGuiCond_FirstUseEver); + ImGui::SetNextWindowSize(ImVec2(graph_width, graph_height), set_next_size_condition); ImGui::SetNextWindowBgAlpha(bg_alpha); if (ImGui::Begin("PerformanceGraphs", nullptr, graph_flags)) { @@ -211,7 +217,7 @@ void PerformanceMetrics::DrawImGuiStats(const float backbuffer_scale) 2000.0}; clamp_window_position(); - window_y += ImGui::GetWindowHeight(); + window_y += ImGui::GetWindowHeight() + window_padding; const DT vblank_time = m_vps_counter.GetDtAvg() + 2 * m_vps_counter.GetDtStd(); const DT frame_time = m_fps_counter.GetDtAvg() + 2 * m_fps_counter.GetDtStd(); |
