Add per-thread ghost zones switch.

This commit is contained in:
Bartosz Taudul 2020-03-17 00:15:27 +01:00
parent 6daa429b69
commit 77d30adee9
2 changed files with 132 additions and 100 deletions

View File

@ -2713,7 +2713,37 @@ void View::DrawZones()
}
DrawTextContrast( draw, wpos + ImVec2( ty, oldOffset ), labelColor, txt );
if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( 0, oldOffset ), wpos + ImVec2( ty + txtsz.x, oldOffset + ty ) ) )
#ifndef TRACY_NO_STATISTICS
const bool hasGhostZones = showFull && m_worker.AreGhostZonesReady() && !v->ghostZones.empty();
float ghostSz;
if( hasGhostZones )
{
auto& vis = Vis( v );
const auto color = vis.ghost ? 0xFFAA9999 : 0x88AA7777;
#ifdef TRACY_EXTENDED_FONT
draw->AddText( wpos + ImVec2( 1.5f * ty + txtsz.x, oldOffset ), color, ICON_FA_GHOST );
ghostSz = ImGui::CalcTextSize( ICON_FA_GHOST ).x;
#else
draw->AddText( draw, wpos + ImVec2( 1.5f * ty + txtsz.x, oldOffset ), color, "ghost" );
ghostSz = ImGui::CalcTextSize( "ghost" ).x;
#endif
}
#endif
if( hover )
{
#ifndef TRACY_NO_STATISTICS
if( hasGhostZones && ImGui::IsMouseHoveringRect( wpos + ImVec2( 1.5f * ty + txtsz.x, oldOffset ), wpos + ImVec2( 1.5f * ty + txtsz.x + ghostSz, oldOffset + ty ) ) )
{
if( ImGui::IsMouseClicked( 0 ) )
{
auto& vis = Vis( v );
vis.ghost = !vis.ghost;
}
}
else
#endif
if( ImGui::IsMouseHoveringRect( wpos + ImVec2( 0, oldOffset ), wpos + ImVec2( ty + txtsz.x, oldOffset + ty ) ) )
{
m_drawThreadMigrations = v->id;
m_drawThreadHighlight = v->id;
@ -2832,6 +2862,7 @@ void View::DrawZones()
}
}
}
}
AdjustThreadHeight( Vis( v ), oldOffset, offset );
ImGui::PopClipRect();

View File

@ -59,6 +59,7 @@ public:
{
bool visible = true;
bool showFull = true;
bool ghost = false;
int offset = 0;
int height = 0;
};