1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 04:23:51 +00:00

Build samples draw list only if visible.

This commit is contained in:
Bartosz Taudul 2023-04-05 19:03:40 +02:00
parent a9ee4c499e
commit f48415315a
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 13 additions and 4 deletions

View File

@ -318,8 +318,8 @@ void TimelineItemThread::Preprocess( const TimelineContext& ctx, TaskDispatch& t
m_hasSamples = false;
if( vd.drawSamples && !m_thread->samples.empty() )
{
td.Queue( [this, &ctx, visible] {
PreprocessSamples( ctx, m_thread->samples, visible );
td.Queue( [this, &ctx, visible, yPos] {
PreprocessSamples( ctx, m_thread->samples, visible, yPos );
} );
}
@ -532,11 +532,14 @@ void TimelineItemThread::PreprocessContextSwitches( const TimelineContext& ctx,
}
}
void TimelineItemThread::PreprocessSamples( const TimelineContext& ctx, const Vector<SampleData>& vec, bool visible )
void TimelineItemThread::PreprocessSamples( const TimelineContext& ctx, const Vector<SampleData>& vec, bool visible, int yPos )
{
const auto vStart = ctx.vStart;
const auto vEnd = ctx.vEnd;
const auto nspx = ctx.nspx;
const auto ty = ctx.ty;
const auto ostep = ty + 1;
const auto pos = yPos + ostep;
const auto MinVis = 5 * GetScale();
const auto MinVisNs = int64_t( round( MinVis * nspx ) );
@ -549,6 +552,12 @@ void TimelineItemThread::PreprocessSamples( const TimelineContext& ctx, const Ve
m_hasSamples = true;
if( !visible ) return;
const auto ty0375 = pos + round( ty * 0.375f );
const auto ty02 = round( ty * 0.2f );
const auto y0 = ty0375 - ty02 - 3;
const auto y1 = ty0375 + ty02 - 1;
if( y0 > ctx.yMax || y1 < ctx.yMin ) return;
while( it < itend )
{
auto next = it + 1;

View File

@ -43,7 +43,7 @@ private:
int PreprocessZoneLevel( const TimelineContext& ctx, const V& vec, int depth, bool visible );
void PreprocessContextSwitches( const TimelineContext& ctx, const ContextSwitch& ctxSwitch, bool visible );
void PreprocessSamples( const TimelineContext& ctx, const Vector<SampleData>& vec, bool visible );
void PreprocessSamples( const TimelineContext& ctx, const Vector<SampleData>& vec, bool visible, int yPos );
void PreprocessMessages( const TimelineContext& ctx, const Vector<short_ptr<MessageData>>& vec, uint64_t tid, bool visible, int yPos );
const ThreadData* m_thread;