From 947f8297975016c178d898c1134edb5b9f7fa8e5 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 5 Aug 2018 02:23:26 +0200 Subject: [PATCH] Fix drawing discontinuous frames. --- server/TracyView.cpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index ab3389bc..7f7c84bd 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -1075,7 +1075,19 @@ bool View::DrawZoneFrames( const FrameData& frames ) if( fsz < 5 ) { - if( prev == -1 ) prev = fbegin; + if( !frames.continuous ) + { + const auto pxs = ( fbegin - m_zvStart ) * pxns; + const auto pxe = ( fend - m_zvStart ) * pxns; + if( pxe - pxs > 1 ) + { + DrawZigZag( draw, wpos + ImVec2( 0, round( ty / 2 ) ), pxs, pxe, ty / 4, 0xFF888888 ); + } + } + else if( prev == -1 ) + { + prev = fbegin; + } continue; } if( prev != -1 ) @@ -1084,9 +1096,16 @@ bool View::DrawZoneFrames( const FrameData& frames ) prev = -1; } - if( fbegin >= m_zvStart && m_frames == &frames ) + if( m_frames == &frames ) { - draw->AddLine( wpos + ImVec2( ( fbegin - m_zvStart ) * pxns, 0 ), wpos + ImVec2( ( fbegin - m_zvStart ) * pxns, wh ), 0x22FFFFFF ); + if( fbegin >= m_zvStart ) + { + draw->AddLine( wpos + ImVec2( ( fbegin - m_zvStart ) * pxns, 0 ), wpos + ImVec2( ( fbegin - m_zvStart ) * pxns, wh ), 0x22FFFFFF ); + } + if( !frames.continuous && fend <= m_zvEnd ) + { + draw->AddLine( wpos + ImVec2( ( fend - m_zvStart ) * pxns, 0 ), wpos + ImVec2( ( fend - m_zvStart ) * pxns, wh ), 0x22FFFFFF ); + } } auto buf = GetFrameText( frames, i, ftime, m_worker.GetFrameOffset() );