From e321e91c7d37436bd11a746a1bac46fd4537feba Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Thu, 23 Mar 2023 21:55:28 +0100 Subject: [PATCH] TimelineItemThread can now determine visibility internally. --- server/TracyTimelineItemThread.cpp | 4 ++-- server/TracyView.hpp | 2 +- server/TracyView_ZoneTimeline.cpp | 10 +--------- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/server/TracyTimelineItemThread.cpp b/server/TracyTimelineItemThread.cpp index 628680fb..304f636c 100644 --- a/server/TracyTimelineItemThread.cpp +++ b/server/TracyTimelineItemThread.cpp @@ -259,8 +259,8 @@ void TimelineItemThread::HeaderExtraContents( const TimelineContext& ctx, int of bool TimelineItemThread::DrawContents( const TimelineContext& ctx, int& offset ) { - const auto res = m_view.DrawThread( ctx, *m_thread, m_draw, m_ctxDraw, m_samplesDraw, offset, m_depth ); - if( !res ) + m_view.DrawThread( ctx, *m_thread, m_draw, m_ctxDraw, m_samplesDraw, offset, m_depth ); + if( m_depth == 0 && m_msgDraw.empty() ) { auto& crash = m_worker.GetCrashEvent(); return crash.thread == m_thread->id; diff --git a/server/TracyView.hpp b/server/TracyView.hpp index fc98a065..3e48c200 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -126,7 +126,7 @@ public: void HighlightThread( uint64_t thread ); void ZoomToRange( int64_t start, int64_t end, bool pause = true ); bool DrawPlot( const TimelineContext& ctx, PlotData& plot, int& offset ); - bool DrawThread( const TimelineContext& ctx, const ThreadData& thread, const std::vector& draw, const std::vector& ctxDraw, const std::vector& samplesDraw, int& offset, int depth ); + void DrawThread( const TimelineContext& ctx, const ThreadData& thread, const std::vector& draw, const std::vector& ctxDraw, const std::vector& samplesDraw, int& offset, int depth ); void DrawThreadMessages( const TimelineContext& ctx, const ThreadData& thread, int offset ); void DrawThreadOverlays( const ThreadData& thread, const ImVec2& ul, const ImVec2& dr ); bool DrawGpu( const TimelineContext& ctx, const GpuCtxData& gpu, int& offset ); diff --git a/server/TracyView_ZoneTimeline.cpp b/server/TracyView_ZoneTimeline.cpp index 686e90c1..049f6622 100644 --- a/server/TracyView_ZoneTimeline.cpp +++ b/server/TracyView_ZoneTimeline.cpp @@ -23,7 +23,7 @@ static tracy_force_inline uint32_t MixGhostColor( uint32_t c0, uint32_t c1 ) ( ( ( ( ( c0 & 0x000000FF ) ) + 3 * ( ( c1 & 0x000000FF ) ) ) >> 2 ) ); } -bool View::DrawThread( const TimelineContext& ctx, const ThreadData& thread, const std::vector& draw, const std::vector& ctxDraw, const std::vector& samplesDraw, int& offset, int depth ) +void View::DrawThread( const TimelineContext& ctx, const ThreadData& thread, const std::vector& draw, const std::vector& ctxDraw, const std::vector& samplesDraw, int& offset, int depth ) { const auto& wpos = ctx.wpos; const auto ty = ctx.ty; @@ -82,14 +82,6 @@ bool View::DrawThread( const TimelineContext& ctx, const ThreadData& thread, con offset += sstep * lockDepth; depth += lockDepth; } - - if( depth == 0 ) - { - auto msgit = std::lower_bound( thread.messages.begin(), thread.messages.end(), m_vd.zvStart, [] ( const auto& lhs, const auto& rhs ) { return lhs->time < rhs; } ); - auto msgend = std::lower_bound( msgit, thread.messages.end(), m_vd.zvEnd+1, [] ( const auto& lhs, const auto& rhs ) { return lhs->time < rhs; } ); - return msgit != msgend; - } - return true; } void View::DrawThreadMessages( const TimelineContext& ctx, const ThreadData& thread, int offset )