Stay in fast loop until there's something to draw.

This commit is contained in:
Bartosz Taudul 2017-10-28 14:08:10 +02:00
parent 257f9818ed
commit d1789f1e3a

View File

@ -2308,24 +2308,21 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos,
while( vbegin < vend )
{
if( state == LockState::Nothing )
if( state == LockState::Nothing || ( m_onlyContendedLocks && state == LockState::HasLock ) )
{
LockState nextState;
do
{
vbegin = GetNextLockEvent( vbegin, vend, state, nextState, thread );
vbegin = GetNextLockEvent( vbegin, vend, state, state, thread );
}
while( nextState == LockState::Nothing && vbegin < vend );
if( nextState == LockState::Nothing ) break;
state = nextState;
while( vbegin < vend && ( state == LockState::Nothing || ( m_onlyContendedLocks && state == LockState::HasLock ) ) );
if( vbegin >= vend ) break;
state = state;
}
LockState nextState;
auto next = GetNextLockEvent( vbegin, vend, state, nextState, thread );
assert( state != LockState::Nothing );
if( !m_onlyContendedLocks || state != LockState::HasLock )
{
assert( state != LockState::Nothing && ( !m_onlyContendedLocks || state != LockState::HasLock ) );
drawn = true;
const auto t0 = (*vbegin)->time;
const auto t1 = next == tl.end() ? GetLastTime() : (*next)->time;
@ -2482,7 +2479,6 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos,
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;
state = nextState;