mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-12 19:31:47 +00:00
Properly clip function names in zones.
This commit is contained in:
parent
e3f85d6d74
commit
8a30e1c937
@ -794,10 +794,20 @@ void View::DrawZones()
|
|||||||
auto& ev = **it;
|
auto& ev = **it;
|
||||||
const auto& srcFile = m_srcFile[ev.srcloc];
|
const auto& srcFile = m_srcFile[ev.srcloc];
|
||||||
const char* func = GetString( srcFile.function );
|
const char* func = GetString( srcFile.function );
|
||||||
|
const auto zsz = ( ev.end - ev.start ) * pxns;
|
||||||
const auto tsz = ImGui::CalcTextSize( func );
|
const auto tsz = ImGui::CalcTextSize( func );
|
||||||
draw->AddRectFilled( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns, 20 ), wpos + ImVec2( ( ev.end - m_zvStart ) * pxns, 20 + tsz.y ), 0xDDDD6666, 2.f );
|
draw->AddRectFilled( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns, 20 ), wpos + ImVec2( ( ev.end - m_zvStart ) * pxns, 20 + tsz.y ), 0xDDDD6666, 2.f );
|
||||||
draw->AddRect( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns, 20 ), wpos + ImVec2( ( ev.end - m_zvStart ) * pxns, 20 + tsz.y ), 0xAAAAAAAA, 2.f );
|
draw->AddRect( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns, 20 ), wpos + ImVec2( ( ev.end - m_zvStart ) * pxns, 20 + tsz.y ), 0xAAAAAAAA, 2.f );
|
||||||
draw->AddText( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns + ( ( ev.end - ev.start ) * pxns - tsz.x ) / 2, 20 ), 0xFFFFFFFF, func );
|
if( tsz.x < zsz )
|
||||||
|
{
|
||||||
|
draw->AddText( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns + ( ( ev.end - ev.start ) * pxns - tsz.x ) / 2, 20 ), 0xFFFFFFFF, func );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui::PushClipRect( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns, 20 ), wpos + ImVec2( ( ev.end - m_zvStart ) * pxns, 20 + tsz.y ), true );
|
||||||
|
draw->AddText( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns, 20 ), 0xFFFFFFFF, func );
|
||||||
|
ImGui::PopClipRect();
|
||||||
|
}
|
||||||
|
|
||||||
if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns, 20 ), wpos + ImVec2( ( ev.end - m_zvStart ) * pxns, 20 + tsz.y ) ) )
|
if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns, 20 ), wpos + ImVec2( ( ev.end - m_zvStart ) * pxns, 20 + tsz.y ) ) )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user