From 9355a14657959553a3d25b55aeb84675f58694a3 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 3 Sep 2022 16:45:53 +0200 Subject: [PATCH] New TimelineController begin/end logic. --- server/TracyTimelineController.cpp | 12 +++++++++++- server/TracyTimelineController.hpp | 3 ++- server/TracyView_Timeline.cpp | 3 ++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/server/TracyTimelineController.cpp b/server/TracyTimelineController.cpp index f6686798..ae4297cb 100644 --- a/server/TracyTimelineController.cpp +++ b/server/TracyTimelineController.cpp @@ -20,8 +20,18 @@ void TimelineController::FirstFrameExpired() m_firstFrame = false; } -void TimelineController::End( float offset ) +void TimelineController::Begin() { + m_items.clear(); +} + +void TimelineController::End( double pxns, int offset, const ImVec2& wpos, bool hover, float yMin, float yMax ) +{ + for( auto& item : m_items ) + { + item->Draw( m_firstFrame, pxns, offset, wpos, hover, yMin, yMax ); + } + const auto scrollPos = ImGui::GetScrollY(); if( scrollPos == 0 && m_scroll != 0 ) { diff --git a/server/TracyTimelineController.hpp b/server/TracyTimelineController.hpp index e7bfe228..3a618180 100644 --- a/server/TracyTimelineController.hpp +++ b/server/TracyTimelineController.hpp @@ -25,7 +25,8 @@ public: TimelineController( View& view, const Worker& worker ); void FirstFrameExpired(); - void End( float offset ); + void Begin(); + void End( double pxns, int offset, const ImVec2& wpos, bool hover, float yMin, float yMax ); template void AddItem( U* data ) diff --git a/server/TracyView_Timeline.cpp b/server/TracyView_Timeline.cpp index 2d512726..610dc03e 100644 --- a/server/TracyView_Timeline.cpp +++ b/server/TracyView_Timeline.cpp @@ -291,6 +291,7 @@ void View::DrawTimeline() } } + m_tc.Begin(); DrawTimelineFramesHeader(); auto& frames = m_worker.GetFrames(); for( auto fd : frames ) @@ -1039,7 +1040,7 @@ void View::DrawTimeline() offset = DrawPlots( offset, pxns, wpos, hover, yMin, yMax ); } - m_tc.End( offset ); + m_tc.End( pxns, offset, wpos, hover, yMin, yMax ); ImGui::EndChild(); for( auto& ann : m_annotations )