From 1fef4f92021c37596a021e500e841091f59bcc7f Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 20 Sep 2017 21:21:29 +0200 Subject: [PATCH] Add a representation of displayed zone area to frame view. --- server/TracyView.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index c70a98b8..b05e7bc7 100755 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -576,6 +576,22 @@ void View::DrawFrames() i++; idx += group; } + + auto zitbegin = std::lower_bound( m_frames.begin(), m_frames.end(), m_zvStart ); + auto zitend = std::upper_bound( m_frames.begin(), m_frames.end(), m_zvEnd ); + + auto zbegin = (int)std::distance( m_frames.begin(), zitbegin ); + auto zend = (int)std::distance( m_frames.begin(), zitend ); + + if( zend > m_frameStart && zbegin < m_frameStart + onScreen * group ) + { + auto x0 = std::max( 0, ( zbegin - m_frameStart ) * fwidth / group ); + auto x1 = std::min( onScreen * fwidth, ( zend - m_frameStart ) * fwidth / group ); + + if( x0 == x1 ) x1 = x0 + 1; + + draw->AddRectFilled( wpos + ImVec2( 1+x0, 0 ), wpos + ImVec2( 1+x1, Height ), 0x55DD22DD ); + } } }