1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Extract "center view at time" function.

This commit is contained in:
Bartosz Taudul 2018-06-22 20:21:02 +02:00
parent a347ddd753
commit 39eccd5b08
2 changed files with 8 additions and 2 deletions

View File

@ -3375,8 +3375,7 @@ void View::DrawMessages()
ImGui::PushID( v );
if( ImGui::Selectable( TimeToString( v->time - m_worker.GetFrameBegin( 0 ) ), m_msgHighlight == v, ImGuiSelectableFlags_SpanAllColumns ) )
{
const auto hr = std::max<uint64_t>( 1, ( m_zvEnd - m_zvStart ) / 2 );
ZoomToRange( v->time - hr, v->time + hr );
CenterAtTime( v->time );
}
ImGui::PopID();
ImGui::NextColumn();
@ -5577,6 +5576,12 @@ void View::ZoomToNextFrame()
ZoomToRange( fbegin, fend );
}
void View::CenterAtTime( int64_t t )
{
const auto hr = std::max<uint64_t>( 1, ( m_zvEnd - m_zvStart ) / 2 );
ZoomToRange( t - hr, t + hr );
}
void View::ShowZoneInfo( const ZoneEvent& ev )
{
if( m_zoneInfoWindow )

View File

@ -105,6 +105,7 @@ private:
void ZoomToRange( int64_t start, int64_t end );
void ZoomToPrevFrame();
void ZoomToNextFrame();
void CenterAtTime( int64_t t );
void ShowZoneInfo( const ZoneEvent& ev );
void ShowZoneInfo( const GpuEvent& ev, uint64_t thread );