From 0e94ed8fc6add85f19e9aefee738d9d144d1b06c Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 3 Sep 2022 21:41:38 +0200 Subject: [PATCH] DrawContents reports if anything was drawn. --- server/TracyTimelineItem.hpp | 2 +- server/TracyTimelineItemPlot.cpp | 4 ++-- server/TracyTimelineItemPlot.hpp | 2 +- server/TracyView.hpp | 2 +- server/TracyView_Plots.cpp | 3 ++- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/server/TracyTimelineItem.hpp b/server/TracyTimelineItem.hpp index 2861f61d..5fb6270e 100644 --- a/server/TracyTimelineItem.hpp +++ b/server/TracyTimelineItem.hpp @@ -18,7 +18,7 @@ public: virtual ~TimelineItem() = default; void Draw( bool firstFrame, double pxns, int& offset, const ImVec2& wpos, bool hover, float yMin, float yMax ); - virtual void DrawContents( double pxns, int& offset, const ImVec2& wpos, bool hover, float yMin, float yMax ) = 0; + virtual bool DrawContents( double pxns, int& offset, const ImVec2& wpos, bool hover, float yMin, float yMax ) = 0; virtual bool IsEmpty() const { return false; } diff --git a/server/TracyTimelineItemPlot.cpp b/server/TracyTimelineItemPlot.cpp index 28e66f44..7dfce4eb 100644 --- a/server/TracyTimelineItemPlot.cpp +++ b/server/TracyTimelineItemPlot.cpp @@ -101,9 +101,9 @@ int64_t TimelineItemPlot::RangeEnd() const return m_plot->data.back().time.Val(); } -void TimelineItemPlot::DrawContents( double pxns, int& offset, const ImVec2& wpos, bool hover, float yMin, float yMax ) +bool TimelineItemPlot::DrawContents( double pxns, int& offset, const ImVec2& wpos, bool hover, float yMin, float yMax ) { - m_view.DrawPlot( *m_plot, pxns, offset, wpos, hover, yMin, yMax ); + return m_view.DrawPlot( *m_plot, pxns, offset, wpos, hover, yMin, yMax ); } } diff --git a/server/TracyTimelineItemPlot.hpp b/server/TracyTimelineItemPlot.hpp index 75367eea..03374f92 100644 --- a/server/TracyTimelineItemPlot.hpp +++ b/server/TracyTimelineItemPlot.hpp @@ -12,7 +12,7 @@ class TimelineItemPlot final : public TimelineItem public: TimelineItemPlot( View& view, Worker& worker, PlotData* plot ); - void DrawContents( double pxns, int& offset, const ImVec2& wpos, bool hover, float yMin, float yMax ) override; + bool DrawContents( double pxns, int& offset, const ImVec2& wpos, bool hover, float yMin, float yMax ) override; bool IsEmpty() const override; protected: diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 3b69110b..f86e15ac 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -115,7 +115,7 @@ public: void HighlightThread( uint64_t thread ); void ZoomToRange( int64_t start, int64_t end, bool pause = true ); - void DrawPlot( PlotData& plot, double pxns, int& offset, const ImVec2& wpos, bool hover, float yMin, float yMax ); + bool DrawPlot( PlotData& plot, double pxns, int& offset, const ImVec2& wpos, bool hover, float yMin, float yMax ); bool m_showRanges = false; Range m_statRange; diff --git a/server/TracyView_Plots.cpp b/server/TracyView_Plots.cpp index ef215d03..2dd8739c 100644 --- a/server/TracyView_Plots.cpp +++ b/server/TracyView_Plots.cpp @@ -10,7 +10,7 @@ namespace tracy { -void View::DrawPlot( PlotData& plot, double pxns, int& offset, const ImVec2& wpos, bool hover, float yMin, float yMax ) +bool View::DrawPlot( PlotData& plot, double pxns, int& offset, const ImVec2& wpos, bool hover, float yMin, float yMax ) { const auto PlotHeight = 100 * GetScale(); @@ -257,6 +257,7 @@ void View::DrawPlot( PlotData& plot, double pxns, int& offset, const ImVec2& wpo { offset += PlotHeight; } + return true; } void View::DrawPlotPoint( const ImVec2& wpos, float x, float y, int offset, uint32_t color, bool hover, bool hasPrev, double val, double prev, bool merged, PlotValueFormatting format, float PlotHeight )