mirror of
https://github.com/wolfpld/tracy
synced 2025-05-02 13:43:52 +00:00
Store values, not pointers to PlotItems.
This commit is contained in:
parent
8958780b18
commit
6e5ccf8391
@ -2492,25 +2492,25 @@ int View::DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover )
|
|||||||
|
|
||||||
while( it < range )
|
while( it < range )
|
||||||
{
|
{
|
||||||
m_tmpVec.emplace_back( &*it );
|
m_tmpVec.emplace_back( it->val );
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
std::sort( m_tmpVec.begin(), m_tmpVec.end(), [] ( const auto& l, const auto& r ) { return l->val < r->val; } );
|
std::sort( m_tmpVec.begin(), m_tmpVec.end(), [] ( const auto& l, const auto& r ) { return l < r; } );
|
||||||
|
|
||||||
draw->AddLine( wpos + ImVec2( x1, offset + PlotHeight - ( (*m_tmpVec.begin())->val - min ) * revrange * PlotHeight ), wpos + ImVec2( x1, offset + PlotHeight - ( m_tmpVec.back()->val - min ) * revrange * PlotHeight ), 0xFF44DDDD );
|
draw->AddLine( wpos + ImVec2( x1, offset + PlotHeight - ( m_tmpVec.front() - min ) * revrange * PlotHeight ), wpos + ImVec2( x1, offset + PlotHeight - ( m_tmpVec.back() - min ) * revrange * PlotHeight ), 0xFF44DDDD );
|
||||||
|
|
||||||
auto vit = m_tmpVec.begin();
|
auto vit = m_tmpVec.begin();
|
||||||
while( vit < m_tmpVec.end() )
|
while( vit < m_tmpVec.end() )
|
||||||
{
|
{
|
||||||
auto vrange = std::upper_bound( vit, m_tmpVec.end(), (*vit)->val + 3.0 / ( revrange * PlotHeight ), [] ( const auto& l, const auto& r ) { return l < r->val; } );
|
auto vrange = std::upper_bound( vit, m_tmpVec.end(), *vit + 3.0 / ( revrange * PlotHeight ), [] ( const auto& l, const auto& r ) { return l < r; } );
|
||||||
assert( vrange > vit );
|
assert( vrange > vit );
|
||||||
if( std::distance( vit, vrange ) == 1 )
|
if( std::distance( vit, vrange ) == 1 )
|
||||||
{
|
{
|
||||||
DrawPlotPoint( wpos, x1, PlotHeight - ( (*vit)->val - min ) * revrange * PlotHeight, offset, 0xFF44DDDD, hover, false, (*vit)->val, 0, false );
|
DrawPlotPoint( wpos, x1, PlotHeight - ( *vit - min ) * revrange * PlotHeight, offset, 0xFF44DDDD, hover, false, *vit, 0, false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawPlotPoint( wpos, x1, PlotHeight - ( (*vit)->val - min ) * revrange * PlotHeight, offset, 0xFF44DDDD, hover, false, (*vit)->val, 0, true );
|
DrawPlotPoint( wpos, x1, PlotHeight - ( *vit - min ) * revrange * PlotHeight, offset, 0xFF44DDDD, hover, false, *vit, 0, true );
|
||||||
}
|
}
|
||||||
vit = vrange;
|
vit = vrange;
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,7 @@ private:
|
|||||||
|
|
||||||
bool m_terminate;
|
bool m_terminate;
|
||||||
|
|
||||||
std::vector<PlotItem*> m_tmpVec;
|
std::vector<double> m_tmpVec;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user