diff --git a/server/TracyTimelineController.cpp b/server/TracyTimelineController.cpp index 922c7d8a..c12d3c81 100644 --- a/server/TracyTimelineController.cpp +++ b/server/TracyTimelineController.cpp @@ -110,6 +110,8 @@ void TimelineController::End( double pxns, const ImVec2& wpos, bool hover, bool ctx.w = ImGui::GetContentRegionAvail().x - 1; ctx.ty = ImGui::GetTextLineHeight(); ctx.scale = GetScale(); + ctx.yMin = yMin; + ctx.yMax = yMax; ctx.pxns = pxns; ctx.nspx = 1.0 / pxns; ctx.wpos = wpos; @@ -127,7 +129,7 @@ void TimelineController::End( double pxns, const ImVec2& wpos, bool hover, bool for( auto& item : m_items ) { auto currentFrameItemHeight = item->GetNextFrameHeight(); - item->Draw( m_firstFrame, ctx, yOffset, hover, yMin, yMax ); + item->Draw( m_firstFrame, ctx, yOffset, hover ); if( m_firstFrame ) currentFrameItemHeight = item->GetNextFrameHeight(); yOffset += currentFrameItemHeight; } diff --git a/server/TracyTimelineItem.cpp b/server/TracyTimelineItem.cpp index a2b66032..7b75b85c 100644 --- a/server/TracyTimelineItem.cpp +++ b/server/TracyTimelineItem.cpp @@ -19,7 +19,7 @@ TimelineItem::TimelineItem( View& view, Worker& worker, const void* key, bool wa { } -void TimelineItem::Draw( bool firstFrame, const TimelineContext& ctx, int yOffset, bool hover, float yMin, float yMax ) +void TimelineItem::Draw( bool firstFrame, const TimelineContext& ctx, int yOffset, bool hover ) { const auto yBegin = yOffset; auto yEnd = yOffset; @@ -45,7 +45,7 @@ void TimelineItem::Draw( bool firstFrame, const TimelineContext& ctx, int yOffse yEnd += ostep; if( m_showFull ) { - if( !DrawContents( ctx, yEnd, hover, yMin, yMax ) && !m_view.GetViewData().drawEmptyLabels ) + if( !DrawContents( ctx, yEnd, hover ) && !m_view.GetViewData().drawEmptyLabels ) { yEnd = yBegin; AdjustThreadHeight( firstFrame, yBegin, yEnd ); @@ -60,7 +60,7 @@ void TimelineItem::Draw( bool firstFrame, const TimelineContext& ctx, int yOffse float labelWidth; const auto hdrOffset = yBegin; - const bool drawHeader = yPos + ty >= yMin && yPos <= yMax; + const bool drawHeader = yPos + ty >= ctx.yMin && yPos <= ctx.yMax; if( drawHeader ) { const auto color = HeaderColor(); diff --git a/server/TracyTimelineItem.hpp b/server/TracyTimelineItem.hpp index ae1e92d1..d2727a07 100644 --- a/server/TracyTimelineItem.hpp +++ b/server/TracyTimelineItem.hpp @@ -15,6 +15,7 @@ class Worker; struct TimelineContext { float w, ty, scale; + float yMin, yMax; double pxns, nspx; ImVec2 wpos; }; @@ -26,7 +27,7 @@ public: virtual ~TimelineItem() = default; // draws the timeline item and also updates the next frame height value - void Draw( bool firstFrame, const TimelineContext& ctx, int yOffset, bool hover, float yMin, float yMax ); + void Draw( bool firstFrame, const TimelineContext& ctx, int yOffset, bool hover ); bool WantPreprocess() const { return m_wantPreprocess; } virtual void Preprocess( const TimelineContext& ctx ) { assert( false ); } @@ -54,7 +55,7 @@ protected: virtual int64_t RangeBegin() const = 0; virtual int64_t RangeEnd() const = 0; - virtual bool DrawContents( const TimelineContext& ctx, int& offset, bool hover, float yMin, float yMax ) = 0; + virtual bool DrawContents( const TimelineContext& ctx, int& offset, bool hover ) = 0; virtual void DrawOverlay( const ImVec2& ul, const ImVec2& dr ) {} virtual bool IsEmpty() const { return false; } diff --git a/server/TracyTimelineItemCpuData.cpp b/server/TracyTimelineItemCpuData.cpp index 89143b65..9e0353d4 100644 --- a/server/TracyTimelineItemCpuData.cpp +++ b/server/TracyTimelineItemCpuData.cpp @@ -38,9 +38,9 @@ int64_t TimelineItemCpuData::RangeEnd() const return -1; } -bool TimelineItemCpuData::DrawContents( const TimelineContext& ctx, int& offset, bool hover, float yMin, float yMax ) +bool TimelineItemCpuData::DrawContents( const TimelineContext& ctx, int& offset, bool hover ) { - return m_view.DrawCpuData( ctx.pxns, offset, ctx.wpos, hover, yMin, yMax ); + return m_view.DrawCpuData( ctx.pxns, offset, ctx.wpos, hover, ctx.yMin, ctx.yMax ); } } diff --git a/server/TracyTimelineItemCpuData.hpp b/server/TracyTimelineItemCpuData.hpp index 4bf5ab96..2bb7e517 100644 --- a/server/TracyTimelineItemCpuData.hpp +++ b/server/TracyTimelineItemCpuData.hpp @@ -24,7 +24,7 @@ protected: int64_t RangeBegin() const override; int64_t RangeEnd() const override; - bool DrawContents( const TimelineContext& ctx, int& offset, bool hover, float yMin, float yMax ) override; + bool DrawContents( const TimelineContext& ctx, int& offset, bool hover ) override; bool IsEmpty() const override; }; diff --git a/server/TracyTimelineItemGpu.cpp b/server/TracyTimelineItemGpu.cpp index 001cc405..2fb97135 100644 --- a/server/TracyTimelineItemGpu.cpp +++ b/server/TracyTimelineItemGpu.cpp @@ -188,9 +188,9 @@ int64_t TimelineItemGpu::RangeEnd() const return t; } -bool TimelineItemGpu::DrawContents( const TimelineContext& ctx, int& offset, bool hover, float yMin, float yMax ) +bool TimelineItemGpu::DrawContents( const TimelineContext& ctx, int& offset, bool hover ) { - return m_view.DrawGpu( *m_gpu, ctx.pxns, offset, ctx.wpos, hover, yMin, yMax ); + return m_view.DrawGpu( *m_gpu, ctx.pxns, offset, ctx.wpos, hover, ctx.yMin, ctx.yMax ); } } diff --git a/server/TracyTimelineItemGpu.hpp b/server/TracyTimelineItemGpu.hpp index b0392fc5..b1fe8418 100644 --- a/server/TracyTimelineItemGpu.hpp +++ b/server/TracyTimelineItemGpu.hpp @@ -26,7 +26,7 @@ protected: void HeaderTooltip( const char* label ) const override; void HeaderExtraContents( int offset, const ImVec2& wpos, float labelWidth, double pxns, bool hover ) override; - bool DrawContents( const TimelineContext& ctx, int& offset, bool hover, float yMin, float yMax ) override; + bool DrawContents( const TimelineContext& ctx, int& offset, bool hover ) override; bool IsEmpty() const override; diff --git a/server/TracyTimelineItemPlot.cpp b/server/TracyTimelineItemPlot.cpp index 65ca8b71..b49d41ae 100644 --- a/server/TracyTimelineItemPlot.cpp +++ b/server/TracyTimelineItemPlot.cpp @@ -104,9 +104,9 @@ int64_t TimelineItemPlot::RangeEnd() const return m_plot->data.back().time.Val(); } -bool TimelineItemPlot::DrawContents( const TimelineContext& ctx, int& offset, bool hover, float yMin, float yMax ) +bool TimelineItemPlot::DrawContents( const TimelineContext& ctx, int& offset, bool hover ) { - return m_view.DrawPlot( *m_plot, ctx.pxns, offset, ctx.wpos, hover, yMin, yMax ); + return m_view.DrawPlot( *m_plot, ctx.pxns, offset, ctx.wpos, hover, ctx.yMin, ctx.yMax ); } } diff --git a/server/TracyTimelineItemPlot.hpp b/server/TracyTimelineItemPlot.hpp index 64af6ee4..8cf84d8b 100644 --- a/server/TracyTimelineItemPlot.hpp +++ b/server/TracyTimelineItemPlot.hpp @@ -24,7 +24,7 @@ protected: void HeaderTooltip( const char* label ) const override; void HeaderExtraContents( int offset, const ImVec2& wpos, float labelWidth, double pxns, bool hover ) override; - bool DrawContents( const TimelineContext& ctx, int& offset, bool hover, float yMin, float yMax ) override; + bool DrawContents( const TimelineContext& ctx, int& offset, bool hover ) override; bool IsEmpty() const override; diff --git a/server/TracyTimelineItemThread.cpp b/server/TracyTimelineItemThread.cpp index 51ab0612..dff11d4a 100644 --- a/server/TracyTimelineItemThread.cpp +++ b/server/TracyTimelineItemThread.cpp @@ -252,9 +252,9 @@ void TimelineItemThread::HeaderExtraContents( int offset, const ImVec2& wpos, fl #endif } -bool TimelineItemThread::DrawContents( const TimelineContext& ctx, int& offset, bool hover, float yMin, float yMax ) +bool TimelineItemThread::DrawContents( const TimelineContext& ctx, int& offset, bool hover ) { - const auto res = m_view.DrawThread( *m_thread, ctx.pxns, offset, ctx.wpos, hover, yMin, yMax, m_ghost ); + const auto res = m_view.DrawThread( *m_thread, ctx.pxns, offset, ctx.wpos, hover, ctx.yMin, ctx.yMax, m_ghost ); if( !res ) { auto& crash = m_worker.GetCrashEvent(); diff --git a/server/TracyTimelineItemThread.hpp b/server/TracyTimelineItemThread.hpp index 06f5452c..57ad3b73 100644 --- a/server/TracyTimelineItemThread.hpp +++ b/server/TracyTimelineItemThread.hpp @@ -24,7 +24,7 @@ protected: void HeaderTooltip( const char* label ) const override; void HeaderExtraContents( int offset, const ImVec2& wpos, float labelWidth, double pxns, bool hover ) override; - bool DrawContents( const TimelineContext& ctx, int& offset, bool hover, float yMin, float yMax ) override; + bool DrawContents( const TimelineContext& ctx, int& offset, bool hover ) override; void DrawOverlay( const ImVec2& ul, const ImVec2& dr ) override; bool IsEmpty() const override;