diff --git a/src/core/imgui_overlays.cpp b/src/core/imgui_overlays.cpp index f4355a7e2..3eb7593fb 100644 --- a/src/core/imgui_overlays.cpp +++ b/src/core/imgui_overlays.cpp @@ -272,7 +272,6 @@ void ImGuiManager::RenderTextOverlays(const GPUBackend* gpu) const float spacing = ImCeil(5.0f * scale); float position_y = ImFloor(f_margin); DrawPerformanceOverlay(gpu, position_y, scale, margin, spacing); - DrawFrameTimeOverlay(position_y, scale, margin, spacing); DrawMediaCaptureOverlay(position_y, scale, margin, spacing); if (g_gpu_settings.display_show_enhancements && !paused) @@ -321,12 +320,15 @@ static void DrawPerformanceStat(ImDrawList* dl, float& position_y, ImFont* font, const size_t len = sv.length(); for (; pos < len; pos++) { - if (sv[pos] <= '\x04') + if (sv[pos] > 0 && sv[pos] <= '\x04') break; } return pos; }; + if (text.empty()) + return; + constexpr ImU32 color = IM_COL32(255, 255, 255, 255); constexpr float default_weight = 0.0f; std::string_view::size_type pos = 0; @@ -426,10 +428,10 @@ void ImGuiManager::DrawPerformanceOverlay(const GPUBackend* gpu, float& position } const float shadow_offset = std::ceil(1.0f * scale); + const float status_size = std::ceil(40.0f * scale); ImFont* const fixed_font = ImGuiManager::GetFixedFont(); const float fixed_font_size = ImGuiManager::GetFixedFontSize(); ImFont* ui_font = ImGuiManager::GetTextFont(); - const float ui_font_size = ImGuiManager::GetOSDFontSize(); const float rbound = ImGui::GetIO().DisplaySize.x - margin; ImDrawList* dl = ImGui::GetBackgroundDrawList(); SmallString text; @@ -598,17 +600,18 @@ void ImGuiManager::DrawPerformanceOverlay(const GPUBackend* gpu, float& position position_y += spacing; } + DrawFrameTimeOverlay(position_y, scale, margin, spacing); + if (g_gpu_settings.display_show_status_indicators) { SetStatusIndicatorIcons(text, false); - if (!text.empty()) - DRAW_LINE(ui_font, text, IM_COL32(255, 255, 255, 255)); + DrawPerformanceStat(dl, position_y, ui_font, status_size, 0.0f, 0, shadow_offset, rbound, text); } } else if (g_gpu_settings.display_show_status_indicators && !FullscreenUI::HasActiveWindow()) { SetStatusIndicatorIcons(text, true); - DRAW_LINE(ui_font, text, IM_COL32(255, 255, 255, 255)); + DrawPerformanceStat(dl, position_y, ui_font, status_size, 0.0f, 0, shadow_offset, rbound, text); } #undef DRAW_LINE diff --git a/src/util/imgui_manager.cpp b/src/util/imgui_manager.cpp index c2a7fd92a..3b8e258c2 100644 --- a/src/util/imgui_manager.cpp +++ b/src/util/imgui_manager.cpp @@ -1264,6 +1264,11 @@ float ImGuiManager::GetOSDFontSize() return std::ceil(17.0f * s_state.global_scale); } +float ImGuiManager::OSDScale(float size) +{ + return std::ceil(size * s_state.global_scale); +} + bool ImGuiManager::WantsTextInput() { return s_state.imgui_wants_keyboard.load(std::memory_order_acquire); diff --git a/src/util/imgui_manager.h b/src/util/imgui_manager.h index 567b31274..d227ee487 100644 --- a/src/util/imgui_manager.h +++ b/src/util/imgui_manager.h @@ -140,6 +140,9 @@ float GetDebugFontSize(float window_scale); /// Returns the font size for rendering the OSD. float GetOSDFontSize(); +/// Multiplies an arbitrary size by the OSD scale. +float OSDScale(float size); + /// Returns true if imgui wants to intercept text input. bool WantsTextInput();