From a9ee4c499ead56fc597af5bbd1e45c8afdae180e Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 5 Apr 2023 18:55:23 +0200 Subject: [PATCH] Build messages draw list only if visible. --- server/TracyTimelineItemThread.cpp | 7 ++++--- server/TracyTimelineItemThread.hpp | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/server/TracyTimelineItemThread.cpp b/server/TracyTimelineItemThread.cpp index b3a87e45..73a4f976 100644 --- a/server/TracyTimelineItemThread.cpp +++ b/server/TracyTimelineItemThread.cpp @@ -324,8 +324,8 @@ void TimelineItemThread::Preprocess( const TimelineContext& ctx, TaskDispatch& t } m_hasMessages = false; - td.Queue( [this, &ctx, visible] { - PreprocessMessages( ctx, m_thread->messages, m_thread->id, visible ); + td.Queue( [this, &ctx, visible, yPos] { + PreprocessMessages( ctx, m_thread->messages, m_thread->id, visible, yPos ); } ); } @@ -572,7 +572,7 @@ void TimelineItemThread::PreprocessSamples( const TimelineContext& ctx, const Ve } } -void TimelineItemThread::PreprocessMessages( const TimelineContext& ctx, const Vector>& vec, uint64_t tid, bool visible ) +void TimelineItemThread::PreprocessMessages( const TimelineContext& ctx, const Vector>& vec, uint64_t tid, bool visible, int yPos ) { const auto vStart = ctx.vStart; const auto vEnd = ctx.vEnd; @@ -587,6 +587,7 @@ void TimelineItemThread::PreprocessMessages( const TimelineContext& ctx, const V m_hasMessages = true; if( !visible ) return; + if( yPos > ctx.yMax || yPos + ctx.ty < ctx.yMin ) return; const auto hMsg = m_view.GetMessageHighlight(); const auto hThread = hMsg ? m_worker.DecompressThread( hMsg->thread ) : 0; diff --git a/server/TracyTimelineItemThread.hpp b/server/TracyTimelineItemThread.hpp index b22064aa..27bc5201 100644 --- a/server/TracyTimelineItemThread.hpp +++ b/server/TracyTimelineItemThread.hpp @@ -44,7 +44,7 @@ private: void PreprocessContextSwitches( const TimelineContext& ctx, const ContextSwitch& ctxSwitch, bool visible ); void PreprocessSamples( const TimelineContext& ctx, const Vector& vec, bool visible ); - void PreprocessMessages( const TimelineContext& ctx, const Vector>& vec, uint64_t tid, bool visible ); + void PreprocessMessages( const TimelineContext& ctx, const Vector>& vec, uint64_t tid, bool visible, int yPos ); const ThreadData* m_thread; bool m_ghost;