mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 22:44:34 +00:00
Optional namespace shortening for ghost zones.
This commit is contained in:
parent
2ac7048248
commit
81dcd2c767
@ -4081,13 +4081,19 @@ int View::DrawGhostLevel( const Vector<GhostZone>& vec, bool hover, double pxns,
|
|||||||
const auto& sym = frame->data[ghostKey.inlineFrame];
|
const auto& sym = frame->data[ghostKey.inlineFrame];
|
||||||
const auto isInline = ghostKey.inlineFrame != frame->size-1;
|
const auto isInline = ghostKey.inlineFrame != frame->size-1;
|
||||||
const auto col = isInline ? DarkenColor( color ) : color;
|
const auto col = isInline ? DarkenColor( color ) : color;
|
||||||
const auto symName = m_worker.GetString( sym.name );
|
auto symName = m_worker.GetString( sym.name );
|
||||||
uint32_t txtColor = symName[0] == '[' ? 0xFF999999 : 0xFFFFFFFF;
|
uint32_t txtColor = symName[0] == '[' ? 0xFF999999 : 0xFFFFFFFF;
|
||||||
const auto tsz = ImGui::CalcTextSize( symName );
|
auto tsz = ImGui::CalcTextSize( symName );
|
||||||
|
|
||||||
draw->AddRectFilled( wpos + ImVec2( px0, offset ), wpos + ImVec2( px1, offset + tsz.y ), col );
|
draw->AddRectFilled( wpos + ImVec2( px0, offset ), wpos + ImVec2( px1, offset + tsz.y ), col );
|
||||||
draw->AddRect( wpos + ImVec2( px0, offset ), wpos + ImVec2( px1, offset + tsz.y ), outline, 0.f, -1 );
|
draw->AddRect( wpos + ImVec2( px0, offset ), wpos + ImVec2( px1, offset + tsz.y ), outline, 0.f, -1 );
|
||||||
|
|
||||||
|
if( tsz.x > zsz )
|
||||||
|
{
|
||||||
|
symName = ShortenNamespace( symName );
|
||||||
|
tsz = ImGui::CalcTextSize( symName );
|
||||||
|
}
|
||||||
|
|
||||||
if( tsz.x < zsz )
|
if( tsz.x < zsz )
|
||||||
{
|
{
|
||||||
const auto x = ( ev.start.Val() - m_vd.zvStart ) * pxns + ( ( end - ev.start.Val() ) * pxns - tsz.x ) / 2;
|
const auto x = ( ev.start.Val() - m_vd.zvStart ) * pxns + ( ( end - ev.start.Val() ) * pxns - tsz.x ) / 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user