diff --git a/server/TracyTimelineController.cpp b/server/TracyTimelineController.cpp index 50ac01ea..5ac2f855 100644 --- a/server/TracyTimelineController.cpp +++ b/server/TracyTimelineController.cpp @@ -133,17 +133,20 @@ void TimelineController::End( double pxns, const ImVec2& wpos, bool hover, bool ctx.wpos = wpos; ctx.hover = hover; + int yOffset = 0; for( auto& item : m_items ) { if( item->WantPreprocess() && item->IsVisible() ) { - item->Preprocess( ctx, m_td ); + const auto yPos = wpos.y + yOffset; + const bool visible = m_firstFrame || ( yPos < yMax && yPos + item->GetNextFrameHeight() >= yMin ); + item->Preprocess( ctx, m_td, visible ); } + yOffset += m_firstFrame ? 0 : item->GetNextFrameHeight(); } m_td.Sync(); - int yOffset = 0; - + yOffset = 0; for( auto& item : m_items ) { auto currentFrameItemHeight = item->GetNextFrameHeight(); diff --git a/server/TracyTimelineItem.hpp b/server/TracyTimelineItem.hpp index 155bbcf1..3c8b7bbd 100644 --- a/server/TracyTimelineItem.hpp +++ b/server/TracyTimelineItem.hpp @@ -24,7 +24,7 @@ public: void Draw( bool firstFrame, const TimelineContext& ctx, int yOffset ); bool WantPreprocess() const { return m_wantPreprocess; } - virtual void Preprocess( const TimelineContext& ctx, TaskDispatch& td ) { assert( false ); } + virtual void Preprocess( const TimelineContext& ctx, TaskDispatch& td, bool visible ) { assert( false ); } void VisibilityCheckbox(); virtual void SetVisible( bool visible ) { m_visible = visible; } diff --git a/server/TracyTimelineItemThread.cpp b/server/TracyTimelineItemThread.cpp index 31cfd8cb..1dfbab09 100644 --- a/server/TracyTimelineItemThread.cpp +++ b/server/TracyTimelineItemThread.cpp @@ -281,7 +281,7 @@ void TimelineItemThread::DrawFinished() m_msgDraw.clear(); } -void TimelineItemThread::Preprocess( const TimelineContext& ctx, TaskDispatch& td ) +void TimelineItemThread::Preprocess( const TimelineContext& ctx, TaskDispatch& td, bool visible ) { assert( m_samplesDraw.empty() ); assert( m_ctxDraw.empty() ); diff --git a/server/TracyTimelineItemThread.hpp b/server/TracyTimelineItemThread.hpp index ace5b3e4..0f3391e0 100644 --- a/server/TracyTimelineItemThread.hpp +++ b/server/TracyTimelineItemThread.hpp @@ -31,7 +31,7 @@ protected: bool IsEmpty() const override; - void Preprocess( const TimelineContext& ctx, TaskDispatch& td ) override; + void Preprocess( const TimelineContext& ctx, TaskDispatch& td, bool visible ) override; private: #ifndef TRACY_NO_STATISTICS