summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/Core/VideoCommon/PerformanceMetrics.cpp14
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();