1
0
mirror of https://github.com/wolfpld/tracy synced 2025-05-01 13:13:53 +00:00

Build a list of messages to display.

This commit is contained in:
Bartosz Taudul 2020-07-12 14:54:22 +02:00
parent 125658a3eb
commit 953df69b77

View File

@ -8594,6 +8594,39 @@ void View::DrawMessages()
ImGui::TreePop(); ImGui::TreePop();
} }
static Vector<uint32_t> msgList;
msgList.reserve( msgs.size() );
msgList.clear();
if( m_messageFilter.IsActive() )
{
for( size_t i=0; i<msgs.size(); i++ )
{
const auto& v = msgs[i];
const auto tid = m_worker.DecompressThread( v->thread );
if( VisibleMsgThread( tid ) )
{
const auto text = m_worker.GetString( msgs[i]->ref );
if( m_messageFilter.PassFilter( text ) )
{
msgList.push_back_no_space_check( uint32_t( i ) );
}
}
}
}
else
{
for( size_t i=0; i<msgs.size(); i++ )
{
const auto& v = msgs[i];
const auto tid = m_worker.DecompressThread( v->thread );
if( VisibleMsgThread( tid ) )
{
msgList.push_back_no_space_check( uint32_t( i ) );
}
}
}
m_visibleMessages = msgList.size();
bool hasCallstack = m_worker.GetCallstackFrameCount() != 0; bool hasCallstack = m_worker.GetCallstackFrameCount() != 0;
ImGui::Separator(); ImGui::Separator();
ImGui::BeginChild( "##messages" ); ImGui::BeginChild( "##messages" );
@ -8627,17 +8660,12 @@ void View::DrawMessages()
} }
ImGui::Separator(); ImGui::Separator();
int msgcnt = 0;
const auto filterActive = m_messageFilter.IsActive();
int idx = 0; int idx = 0;
for( const auto& v : msgs ) for( const auto& msgIdx : msgList )
{
const auto tid = m_worker.DecompressThread( v->thread );
if( VisibleMsgThread( tid ) )
{ {
const auto& v = msgs[msgIdx];
const auto text = m_worker.GetString( v->ref ); const auto text = m_worker.GetString( v->ref );
if( !filterActive || m_messageFilter.PassFilter( text ) ) const auto tid = m_worker.DecompressThread( v->thread );
{
ImGui::PushID( v ); ImGui::PushID( v );
if( ImGui::Selectable( TimeToStringExact( v->time ), m_msgHighlight == v, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap ) ) if( ImGui::Selectable( TimeToStringExact( v->time ), m_msgHighlight == v, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap ) )
{ {
@ -8701,11 +8729,7 @@ void View::DrawMessages()
} }
ImGui::NextColumn(); ImGui::NextColumn();
} }
msgcnt++;
} }
}
}
m_visibleMessages = msgcnt;
if( m_worker.IsConnected() && ImGui::GetScrollY() >= ImGui::GetScrollMaxY() ) if( m_worker.IsConnected() && ImGui::GetScrollY() >= ImGui::GetScrollMaxY() )
{ {