mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Proper tooltip for condensed lock events.
This commit is contained in:
parent
32fc88de7b
commit
f89713b7c6
@ -2345,7 +2345,7 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos,
|
||||
const auto px0 = ( t0 - m_zvStart ) * pxns;
|
||||
auto tx0 = px0;
|
||||
double px1 = ( t1 - m_zvStart ) * pxns;
|
||||
bool condensed = false;
|
||||
uint64_t condensed = 0;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
@ -2370,12 +2370,20 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos,
|
||||
px1 = px2;
|
||||
next = n;
|
||||
nextState = ns;
|
||||
condensed = true;
|
||||
condensed++;
|
||||
drawState = CombineLockState( drawState, nextState );
|
||||
}
|
||||
|
||||
bool itemHovered = hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( std::max( px0, -10.0 ), offset ), wpos + ImVec2( std::min( px1, double( w + 10 ) ), offset + ty ) );
|
||||
if( itemHovered )
|
||||
{
|
||||
if( condensed != 0 )
|
||||
{
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::Text( "Multiple lock events (%" PRIu64 ")", condensed );
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
else
|
||||
{
|
||||
highlight.blocked = drawState == LockState::HasBlockingLock;
|
||||
if( !highlight.blocked )
|
||||
@ -2497,15 +2505,16 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos,
|
||||
}
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
}
|
||||
|
||||
const auto cfilled = drawState == LockState::HasLock ? 0xFF228A22 : ( drawState == LockState::HasBlockingLock ? 0xFF228A8A : 0xFF2222BD );
|
||||
draw->AddRectFilled( wpos + ImVec2( std::max( px0, -10.0 ), offset ), wpos + ImVec2( std::min( px1, double( w + 10 ) ), offset + ty ), cfilled, condensed ? 0.f : 2.f );
|
||||
draw->AddRectFilled( wpos + ImVec2( std::max( px0, -10.0 ), offset ), wpos + ImVec2( std::min( px1, double( w + 10 ) ), offset + ty ), cfilled, condensed != 0 ? 0.f : 2.f );
|
||||
if( m_lockHighlight.thread != thread && ( drawState == LockState::HasBlockingLock ) != m_lockHighlight.blocked && next != tl.end() && m_lockHighlight.id == v.first && m_lockHighlight.begin <= (*vbegin)->time && m_lockHighlight.end >= (*next)->time )
|
||||
{
|
||||
const auto t = uint8_t( ( sin( std::chrono::duration_cast<std::chrono::milliseconds>( std::chrono::system_clock::now().time_since_epoch() ).count() * 0.01 ) * 0.5 + 0.5 ) * 255 );
|
||||
draw->AddRect( wpos + ImVec2( std::max( px0, -10.0 ), offset ), wpos + ImVec2( std::min( px1, double( w + 10 ) ), offset + ty ), 0x00FFFFFF | ( t << 24 ), 2.f, -1, 2.f );
|
||||
}
|
||||
else if( !condensed )
|
||||
else if( condensed == 0 )
|
||||
{
|
||||
const auto coutline = drawState == LockState::HasLock ? 0xFF3BA33B : ( drawState == LockState::HasBlockingLock ? 0xFF3BA3A3 : 0xFF3B3BD6 );
|
||||
draw->AddRect( wpos + ImVec2( std::max( px0, -10.0 ), offset ), wpos + ImVec2( std::min( px1, double( w + 10 ) ), offset + ty ), coutline, 2.f );
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user