DrawContents reports if anything was drawn.

This commit is contained in:
Bartosz Taudul 2022-09-03 21:41:38 +02:00
parent eaa78de534
commit 0e94ed8fc6
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
5 changed files with 7 additions and 6 deletions

View File

@ -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; }

View File

@ -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 );
}
}

View File

@ -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:

View File

@ -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;

View File

@ -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 )