1
0
mirror of https://github.com/wolfpld/tracy synced 2025-05-08 07:53:52 +00:00

Draw timer uncertainties on locks.

This commit is contained in:
Bartosz Taudul 2017-10-06 18:25:30 +02:00
parent ad28bdf85d
commit 9bc80941c7

View File

@ -27,6 +27,8 @@
namespace tracy
{
enum { MinVisSize = 3 };
static TextData* GetTextData( Event& zone )
{
if( !zone.text ) zone.text = new TextData {};
@ -1345,7 +1347,6 @@ void View::DrawZones()
int View::DrawZoneLevel( const Vector<Event*>& vec, bool hover, double pxns, const ImVec2& wpos, int _offset, int depth )
{
enum { MinVisSize = 3 };
int maxdepth = depth;
auto it = std::lower_bound( vec.begin(), vec.end(), m_zvStart - m_delay, [] ( const auto& l, const auto& r ) { return l->end < r; } );
if( it != vec.end() )
@ -1575,6 +1576,8 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos,
const auto offset = _offset + ostep * cnt;
auto draw = ImGui::GetWindowDrawList();
auto& srcloc = GetSourceLocation( lockmap.srcloc );
const auto dsz = m_delay * pxns;
const auto rsz = m_resolution * pxns;
while( vbegin < vend )
{
@ -1731,6 +1734,20 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos,
const auto coutline = state == State::HasLock ? 0xFF3BA33B : ( state == State::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 );
}
if( dsz >= MinVisSize )
{
draw->AddRectFilled( wpos + ImVec2( px0, offset ), wpos + ImVec2( std::min( px0+dsz, px1 ), offset + ty ), 0x882222DD, 2.f );
}
if( rsz >= MinVisSize )
{
draw->AddLine( wpos + ImVec2( px0 + rsz, offset + ty/2 ), wpos + ImVec2( px0 - rsz, offset + ty/2 ), 0xAAFFFFFF );
draw->AddLine( wpos + ImVec2( px0 + rsz, offset + ty/4 ), wpos + ImVec2( px0 + rsz, offset + 3*ty/4 ), 0xAAFFFFFF );
draw->AddLine( wpos + ImVec2( px0 - rsz, offset + ty/4 ), wpos + ImVec2( px0 - rsz, offset + 3*ty/4 ), 0xAAFFFFFF );
draw->AddLine( wpos + ImVec2( px1 + rsz, offset + ty/2 ), wpos + ImVec2( px1 - rsz, offset + ty/2 ), 0xAAFFFFFF );
draw->AddLine( wpos + ImVec2( px1 + rsz, offset + ty/4 ), wpos + ImVec2( px1 + rsz, offset + 3*ty/4 ), 0xAAFFFFFF );
draw->AddLine( wpos + ImVec2( px1 - rsz, offset + ty/4 ), wpos + ImVec2( px1 - rsz, offset + 3*ty/4 ), 0xAAFFFFFF );
}
}
vbegin = next;