From 0a00925a9bd1d3f032818a941031eed4e3371dd0 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 24 Jul 2022 00:13:11 +0200 Subject: [PATCH] More compact locks drawing. --- server/TracyView_Locks.cpp | 4 ++++ server/TracyView_Timeline.cpp | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/server/TracyView_Locks.cpp b/server/TracyView_Locks.cpp index 2f841a3a..eda3b93e 100644 --- a/server/TracyView_Locks.cpp +++ b/server/TracyView_Locks.cpp @@ -259,7 +259,9 @@ void View::DrawLockHeader( uint32_t id, const LockMap& lockmap, const SourceLoca { sprintf( buf, "%" PRIu32 ": %s", id, m_worker.GetString( srcloc.function ) ); } + ImGui::PushFont( m_smallFont ); DrawTextContrast( draw, wpos + ImVec2( 0, offset ), 0xFF8888FF, buf ); + ImGui::PopFont(); if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( 0, offset ), wpos + ImVec2( w, offset + ty + 1 ) ) ) { m_lockHoverHighlight = id; @@ -342,7 +344,9 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos, const auto delay = m_worker.GetDelay(); const auto resolution = m_worker.GetResolution(); const auto w = ImGui::GetContentRegionAvail().x - 1; + ImGui::PushFont( m_smallFont ); const auto ty = ImGui::GetTextLineHeight(); + ImGui::PopFont(); const auto ostep = ty + 1; auto draw = ImGui::GetWindowDrawList(); const auto dsz = delay * pxns; diff --git a/server/TracyView_Timeline.cpp b/server/TracyView_Timeline.cpp index a343dbe7..5aba0736 100644 --- a/server/TracyView_Timeline.cpp +++ b/server/TracyView_Timeline.cpp @@ -293,6 +293,11 @@ void View::DrawTimeline() const auto nspx = 1.0 / pxns; + ImGui::PushFont( m_smallFont ); + const auto sty = ImGui::GetTextLineHeight(); + const auto sstep = sty + 1; + ImGui::PopFont(); + const auto ty = ImGui::GetTextLineHeight(); const auto ostep = ty + 1; int offset = 0; @@ -318,11 +323,6 @@ void View::DrawTimeline() const auto oldOffset = offset; ImGui::PushClipRect( wpos, wpos + ImVec2( w, oldOffset + vis.height ), true ); - ImGui::PushFont( m_smallFont ); - const auto sty = ImGui::GetTextLineHeight(); - const auto sstep = sty + 1; - ImGui::PopFont(); - const auto singleThread = v->threadData.size() == 1; int depth = 0; offset += ostep; @@ -663,7 +663,7 @@ void View::DrawTimeline() if( m_vd.drawLocks ) { const auto lockDepth = DrawLocks( v->id, hover, pxns, wpos, offset, nextLockHighlight, yMin, yMax ); - offset += ostep * lockDepth; + offset += sstep * lockDepth; depth += lockDepth; } }