1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-30 20:53:52 +00:00

Don't animate threads on first frame.

This commit is contained in:
Bartosz Taudul 2020-04-12 23:41:18 +02:00
parent a074d18dfa
commit b8647f968a
2 changed files with 17 additions and 5 deletions

View File

@ -701,6 +701,7 @@ bool View::DrawImpl()
m_lockInfoAnim.Update( io.DeltaTime ); m_lockInfoAnim.Update( io.DeltaTime );
m_statBuzzAnim.Update( io.DeltaTime ); m_statBuzzAnim.Update( io.DeltaTime );
if( m_firstFrame ) m_firstFrame = false;
return keepOpen; return keepOpen;
} }
@ -2069,7 +2070,7 @@ static float AdjustThreadPosition( View::VisData& vis, float wy, int& offset )
return offset + wy; 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; const auto h = offset - oldOffset;
if( vis.height > h ) if( vis.height > h )
@ -2078,12 +2079,20 @@ static void AdjustThreadHeight( View::VisData& vis, int oldOffset, int& offset )
offset = oldOffset + vis.height; offset = oldOffset + vis.height;
} }
else if( vis.height < h ) else if( vis.height < h )
{
if( m_firstFrame )
{
vis.height = h;
offset = oldOffset + h;
}
else
{ {
const auto diff = h - vis.height; const auto diff = h - vis.height;
const auto move = std::max( 2.0, diff * 10.0 * ImGui::GetIO().DeltaTime ); const auto move = std::max( 2.0, diff * 10.0 * ImGui::GetIO().DeltaTime );
vis.height = int( std::min<double>( vis.height + move, h ) ); vis.height = int( std::min<double>( vis.height + move, h ) );
offset = oldOffset + vis.height; offset = oldOffset + vis.height;
} }
}
} }
void View::DrawZones() void View::DrawZones()

View File

@ -288,6 +288,8 @@ private:
return it->second; return it->second;
} }
void AdjustThreadHeight( View::VisData& vis, int oldOffset, int& offset );
Worker m_worker; Worker m_worker;
std::string m_filename; std::string m_filename;
bool m_staticView; bool m_staticView;
@ -419,6 +421,7 @@ private:
UserData m_userData; UserData m_userData;
bool m_reconnectRequested = false; bool m_reconnectRequested = false;
bool m_firstFrame = true;
struct FindZone { struct FindZone {
enum : uint64_t { Unselected = std::numeric_limits<uint64_t>::max() - 1 }; enum : uint64_t { Unselected = std::numeric_limits<uint64_t>::max() - 1 };