mirror of
https://github.com/wolfpld/tracy.git
synced 2026-08-23 11:38:21 +00:00
Fix popup of collapsed items near timeline start.
There are various changes involved into making this work: 1. Zone size (zsz) is no longer clamped to the timeline viewport area. This clamping has to be removed to prevent otherwise uncollapsed zones from apparently becoming small near the viewport borders. Such a small zone would then be collapsed, resulting in unwanted popping. Interesingly, only the CPU zones were clamped before. GPU zones were not. 2. Iteration over visible zones has to start before the visible timeline viewport area. Without this some zones that would be otherwise included in the collapsed area (started by a previous zone) may be fully visible. This causes child zones to be drawn and produces unwanted popping. (At this point threshold for continuing collapsed area is greater than threshold for starting it.) 3. Since the iteration now starts before timeline visible area, it may so happen that everything found will be in a small slice of timeline that is outside the screen. To fix this, the end time of last found item is checked against the viewport start time. It is always valid to access *(zitend-1), as it is in each case done after null set check (it == zitend). Similar but simpler fix was also applied to per-thread call stack samples.
This commit is contained in:
@@ -13,7 +13,8 @@ namespace tracy
|
||||
|
||||
void View::DrawSamples( const Vector<SampleData>& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int offset )
|
||||
{
|
||||
auto it = std::lower_bound( vec.begin(), vec.end(), m_vd.zvStart, [] ( const auto& l, const auto& r ) { return l.time.Val() < r; } );
|
||||
const auto MinVis = 6 * GetScale();
|
||||
auto it = std::lower_bound( vec.begin(), vec.end(), m_vd.zvStart - 2 * MinVis * nspx, [] ( const auto& l, const auto& r ) { return l.time.Val() < r; } );
|
||||
if( it == vec.end() ) return;
|
||||
const auto itend = std::lower_bound( it, vec.end(), m_vd.zvEnd, [] ( const auto& l, const auto& r ) { return l.time.Val() < r; } );
|
||||
if( it == itend ) return;
|
||||
@@ -25,7 +26,6 @@ void View::DrawSamples( const Vector<SampleData>& vec, bool hover, double pxns,
|
||||
const auto y1 = ty0375 + ty02 - 1;
|
||||
auto draw = ImGui::GetWindowDrawList();
|
||||
|
||||
const auto MinVis = 6 * GetScale();
|
||||
bool tooltipDisplayed = false;
|
||||
|
||||
while( it < itend )
|
||||
|
||||
Reference in New Issue
Block a user