1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 12:23:53 +00:00

Prevent thick zone highlight from going outside the zone box.

This commit is contained in:
Bartosz Taudul 2022-09-09 00:18:40 +02:00
parent 5bd3f3de5f
commit 0e930a2c13
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 16 additions and 2 deletions

View File

@ -237,9 +237,16 @@ int View::DrawGpuZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx,
const auto zoneColor = GetZoneColorData( ev );
draw->AddRectFilled( wpos + ImVec2( px0, offset ), wpos + ImVec2( px1, offset + tsz.y ), zoneColor.color );
if( zoneColor.highlight )
{
if( zoneColor.thickness > 1.f )
{
draw->AddRect( wpos + ImVec2( px0 + 1, offset + 1 ), wpos + ImVec2( px1 - 1, offset + tsz.y - 1 ), zoneColor.accentColor, 0.f, -1, zoneColor.thickness );
}
else
{
draw->AddRect( wpos + ImVec2( px0, offset ), wpos + ImVec2( px1, offset + tsz.y ), zoneColor.accentColor, 0.f, -1, zoneColor.thickness );
}
}
else
{
const auto darkColor = DarkenColor( zoneColor.color );

View File

@ -733,9 +733,16 @@ int View::DrawZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx, co
const auto px1 = std::max( { std::min( pr1, double( w + 10 ) ), px0 + pxns * 0.5, px0 + MinVisSize } );
draw->AddRectFilled( wpos + ImVec2( px0, offset ), wpos + ImVec2( px1, offset + tsz.y ), zoneColor.color );
if( zoneColor.highlight )
{
if( zoneColor.thickness > 1.f )
{
draw->AddRect( wpos + ImVec2( px0 + 1, offset + 1 ), wpos + ImVec2( px1 - 1, offset + tsz.y - 1 ), zoneColor.accentColor, 0.f, -1, zoneColor.thickness );
}
else
{
draw->AddRect( wpos + ImVec2( px0, offset ), wpos + ImVec2( px1, offset + tsz.y ), zoneColor.accentColor, 0.f, -1, zoneColor.thickness );
}
}
else
{
const auto darkColor = DarkenColor( zoneColor.color );