mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Use clipper to render source view.
This commit is contained in:
parent
1c23d7e67a
commit
a7cedddcef
@ -74,15 +74,29 @@ void SourceView::Render()
|
|||||||
ImGui::BeginChild( "##sourceView", ImVec2( 0, 0 ), true );
|
ImGui::BeginChild( "##sourceView", ImVec2( 0, 0 ), true );
|
||||||
if( m_font ) ImGui::PushFont( m_font );
|
if( m_font ) ImGui::PushFont( m_font );
|
||||||
const auto nw = ImGui::CalcTextSize( "123,345" ).x;
|
const auto nw = ImGui::CalcTextSize( "123,345" ).x;
|
||||||
int lineNum = 1;
|
if( m_targetLine != 0 )
|
||||||
for( auto& line : m_lines )
|
|
||||||
{
|
{
|
||||||
if( m_targetLine == lineNum )
|
int lineNum = 1;
|
||||||
|
for( auto& line : m_lines )
|
||||||
{
|
{
|
||||||
m_targetLine = 0;
|
if( m_targetLine == lineNum )
|
||||||
ImGui::SetScrollHereY();
|
{
|
||||||
|
m_targetLine = 0;
|
||||||
|
ImGui::SetScrollHereY();
|
||||||
|
}
|
||||||
|
RenderLine( line, lineNum++ );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGuiListClipper clipper( m_lines.size() );
|
||||||
|
while( clipper.Step() )
|
||||||
|
{
|
||||||
|
for( auto i=clipper.DisplayStart; i<clipper.DisplayEnd; i++ )
|
||||||
|
{
|
||||||
|
RenderLine( m_lines[i], i+1 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RenderLine( line, lineNum++ );
|
|
||||||
}
|
}
|
||||||
if( m_font ) ImGui::PopFont();
|
if( m_font ) ImGui::PopFont();
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
|
Loading…
Reference in New Issue
Block a user