From b8647f968a6ae9454e7d24df1702126f5d862ddf Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 12 Apr 2020 23:41:18 +0200 Subject: [PATCH] Don't animate threads on first frame. --- server/TracyView.cpp | 19 ++++++++++++++----- server/TracyView.hpp | 3 +++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 1a5e7e57..659a3c8c 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -701,6 +701,7 @@ bool View::DrawImpl() m_lockInfoAnim.Update( io.DeltaTime ); m_statBuzzAnim.Update( io.DeltaTime ); + if( m_firstFrame ) m_firstFrame = false; return keepOpen; } @@ -2069,7 +2070,7 @@ static float AdjustThreadPosition( View::VisData& vis, float wy, int& offset ) return offset + wy; } -static void AdjustThreadHeight( View::VisData& vis, int oldOffset, int& offset ) +void View::AdjustThreadHeight( View::VisData& vis, int oldOffset, int& offset ) { const auto h = offset - oldOffset; if( vis.height > h ) @@ -2079,10 +2080,18 @@ static void AdjustThreadHeight( View::VisData& vis, int oldOffset, int& offset ) } else if( vis.height < h ) { - const auto diff = h - vis.height; - const auto move = std::max( 2.0, diff * 10.0 * ImGui::GetIO().DeltaTime ); - vis.height = int( std::min( vis.height + move, h ) ); - offset = oldOffset + vis.height; + if( m_firstFrame ) + { + vis.height = h; + offset = oldOffset + h; + } + else + { + const auto diff = h - vis.height; + const auto move = std::max( 2.0, diff * 10.0 * ImGui::GetIO().DeltaTime ); + vis.height = int( std::min( vis.height + move, h ) ); + offset = oldOffset + vis.height; + } } } diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 50e8072b..44b66b5f 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -288,6 +288,8 @@ private: return it->second; } + void AdjustThreadHeight( View::VisData& vis, int oldOffset, int& offset ); + Worker m_worker; std::string m_filename; bool m_staticView; @@ -419,6 +421,7 @@ private: UserData m_userData; bool m_reconnectRequested = false; + bool m_firstFrame = true; struct FindZone { enum : uint64_t { Unselected = std::numeric_limits::max() - 1 };