From 1ad64f19a7586f64bc3579868d5cef86b5a7404a Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 1 Aug 2026 01:32:57 +0200 Subject: [PATCH] Use ctx.scale in timeline items instead of GetScale(). --- profiler/src/profiler/TracyTimelineItemCpuData.cpp | 4 ++-- profiler/src/profiler/TracyTimelineItemPlot.cpp | 2 +- profiler/src/profiler/TracyTimelineItemThread.cpp | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/profiler/src/profiler/TracyTimelineItemCpuData.cpp b/profiler/src/profiler/TracyTimelineItemCpuData.cpp index 7b59a47c..1bcc332f 100644 --- a/profiler/src/profiler/TracyTimelineItemCpuData.cpp +++ b/profiler/src/profiler/TracyTimelineItemCpuData.cpp @@ -90,7 +90,7 @@ void TimelineItemCpuData::Preprocess( const TimelineContext& ctx, TaskDispatch& } if( hasCpuData ) { - const auto cpuUsageHeight = floor( 30.f * GetScale() ); + const auto cpuUsageHeight = floor( 30.f * ctx.scale ); if( pos <= yMax && pos + cpuUsageHeight + 3 >= yMin ) { td.Queue( [this, &ctx] { @@ -132,7 +132,7 @@ void TimelineItemCpuData::PreprocessCpuCtxSwitches( const TimelineContext& ctx, auto eit = std::lower_bound( it, cs.end(), vEnd, [] ( const auto& l, const auto& r ) { return l.Start() < r; } ); if( it == eit ) return; - const auto MinVisNs = int64_t( round( GetScale() * MinVisSize * nspx ) ); + const auto MinVisNs = int64_t( round( ctx.scale * MinVisSize * nspx ) ); while( it < eit ) { diff --git a/profiler/src/profiler/TracyTimelineItemPlot.cpp b/profiler/src/profiler/TracyTimelineItemPlot.cpp index 272e9a47..c6b0b138 100644 --- a/profiler/src/profiler/TracyTimelineItemPlot.cpp +++ b/profiler/src/profiler/TracyTimelineItemPlot.cpp @@ -127,7 +127,7 @@ void TimelineItemPlot::Preprocess( const TimelineContext& ctx, TaskDispatch& td, if( !visible ) return; if( yPos > ctx.yMax ) return; if( m_plot->data.empty() ) return; - const auto PlotHeight = int( round( PlotHeightPx * GetScale() ) ); + const auto PlotHeight = int( round( PlotHeightPx * ctx.scale ) ); if( yPos + PlotHeight < ctx.yMin ) return; td.Queue( [this, &ctx] { diff --git a/profiler/src/profiler/TracyTimelineItemThread.cpp b/profiler/src/profiler/TracyTimelineItemThread.cpp index 47f81a29..3eeedc9f 100644 --- a/profiler/src/profiler/TracyTimelineItemThread.cpp +++ b/profiler/src/profiler/TracyTimelineItemThread.cpp @@ -406,7 +406,7 @@ int TimelineItemThread::PreprocessGhostLevel( const TimelineContext& ctx, const const auto vStart = ctx.vStart; const auto vEnd = ctx.vEnd; - const auto MinVisNs = int64_t( round( GetScale() * MinVisSize * nspx ) ); + const auto MinVisNs = int64_t( round( ctx.scale * MinVisSize * nspx ) ); auto it = std::lower_bound( vec.begin(), vec.end(), std::max( 0, vStart - 2 * MinVisNs ), [] ( const auto& l, const auto& r ) { return l.end.Val() < r; } ); if( it == vec.end() ) return depth; @@ -479,7 +479,7 @@ int TimelineItemThread::PreprocessZoneLevel( const TimelineContext& ctx, const V const auto vEnd = ctx.vEnd; const auto nspx = ctx.nspx; - const auto MinVisNs = int64_t( round( GetScale() * MinVisSize * nspx ) ); + const auto MinVisNs = int64_t( round( ctx.scale * MinVisSize * nspx ) ); auto it = std::lower_bound( vec.begin(), vec.end(), vStart, [this] ( const auto& l, const auto& r ) { Adapter a; return m_worker.GetZoneEnd( a(l) ) < r; } ); if( it == vec.end() ) return depth; @@ -569,7 +569,7 @@ void TimelineItemThread::PreprocessContextSwitches( const TimelineContext& ctx, m_hasCtxSwitch = true; if( !visible ) return; - const auto MinCtxNs = int64_t( round( GetScale() * MinCtxSize * nspx ) ); + const auto MinCtxNs = int64_t( round( ctx.scale * MinCtxSize * nspx ) ); const auto& sampleData = m_thread->samples; bool first = true; @@ -635,7 +635,7 @@ void TimelineItemThread::PreprocessSamples( const TimelineContext& ctx, const Ve const auto ostep = ty + 1; const auto pos = yPos + ostep; - const auto MinVis = 5 * GetScale(); + const auto MinVis = 5 * ctx.scale; const auto MinVisNs = int64_t( round( MinVis * nspx ) ); auto it = std::lower_bound( vec.begin(), vec.end(), vStart - MinVisNs, [] ( const auto& l, const auto& r ) { return l.time.Val() < r; } ); @@ -713,7 +713,7 @@ void TimelineItemThread::PreprocessMessages( const TimelineContext& ctx, const V const auto vEnd = ctx.vEnd; const auto nspx = ctx.nspx; - const auto MinVisNs = int64_t( round( GetScale() * MinVisSize * nspx ) ); + const auto MinVisNs = int64_t( round( ctx.scale * MinVisSize * nspx ) ); auto it = std::lower_bound( vec.begin(), vec.end(), vStart, [] ( const auto& lhs, const auto& rhs ) { return lhs->time < rhs; } ); if( it == vec.end() ) return; @@ -978,7 +978,7 @@ void TimelineItemThread::PreprocessLocks( const TimelineContext& ctx, const unor const auto& vd = m_view.GetViewData(); const auto lockInfoWindow = m_view.GetLockInfoWindow(); - const auto MinVisNs = int64_t( round( GetScale() * MinVisSize * nspx ) ); + const auto MinVisNs = int64_t( round( ctx.scale * MinVisSize * nspx ) ); for( auto& v : locks ) {