Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Taudul <wolf@nereid.pl>2022-10-18 23:18:50 +0300
committerBartosz Taudul <wolf@nereid.pl>2022-10-18 23:18:50 +0300
commit11ea081c570e89a2bb1f900a1b01a8adac55bf33 (patch)
tree7fc7158ec45ef5de12e92a23ab833349a907bc86
parentc218e46f837dc00d88f14d2b2caa966a3b187eda (diff)
Do not use thousands separator for source line numbers.
-rw-r--r--server/TracySourceView.cpp68
1 files changed, 37 insertions, 31 deletions
diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp
index 056ee1bf..5e17aaff 100644
--- a/server/TracySourceView.cpp
+++ b/server/TracySourceView.cpp
@@ -2027,25 +2027,29 @@ void SourceView::RenderSymbolSourceView( const AddrStatData& as, Worker& worker,
SetFont();
auto& lines = m_source.get();
- auto draw = ImGui::GetWindowDrawList();
- const auto wpos = ImGui::GetWindowPos() - ImVec2( ImGui::GetCurrentWindowRead()->Scroll.x, 0 );
- const auto dpos = wpos + ImVec2( 0.5f, 0.5f );
- const auto wh = ImGui::GetWindowHeight();
- const auto ty = ImGui::GetTextLineHeight();
- const auto ts = ImGui::CalcTextSize( " " ).x;
- const auto lineCount = lines.size();
- const auto tmp = RealToString( lineCount );
- const auto maxLine = strlen( tmp );
- auto lx = ts * maxLine + ty + round( ts*0.4f );
- if( as.ipTotalSrc.local + as.ipTotalSrc.ext != 0 ) lx += ts * 7 + ty;
- if( !m_asm.empty() )
+
{
- const auto tmp = RealToString( m_asm.size() );
- const auto maxAsm = strlen( tmp ) + 1;
- lx += ts * maxAsm + ty;
+ auto draw = ImGui::GetWindowDrawList();
+ const auto wpos = ImGui::GetWindowPos() - ImVec2( ImGui::GetCurrentWindowRead()->Scroll.x, 0 );
+ const auto dpos = wpos + ImVec2( 0.5f, 0.5f );
+ const auto wh = ImGui::GetWindowHeight();
+ const auto ty = ImGui::GetTextLineHeight();
+ const auto ts = ImGui::CalcTextSize( " " ).x;
+ const auto lineCount = lines.size();
+ char buf[32];
+ sprintf( buf, "%zu", lineCount );
+ const auto maxLine = strlen( buf );
+ auto lx = ts * maxLine + ty + round( ts*0.4f );
+ if( as.ipTotalSrc.local + as.ipTotalSrc.ext != 0 ) lx += ts * 7 + ty;
+ if( !m_asm.empty() )
+ {
+ sprintf( buf, "%zu", m_asm.size() );
+ const auto maxAsm = strlen( buf ) + 1;
+ lx += ts * maxAsm + ty;
+ }
+ if( m_hwSamples && worker.GetHwSampleCountAddress() != 0 ) lx += 15 * ts + ty;
+ DrawLine( draw, dpos + ImVec2( lx, 0 ), dpos + ImVec2( lx, wh ), 0x08FFFFFF );
}
- if( m_hwSamples && worker.GetHwSampleCountAddress() != 0 ) lx += 15 * ts + ty;
- DrawLine( draw, dpos + ImVec2( lx, 0 ), dpos + ImVec2( lx, wh ), 0x08FFFFFF );
const AddrStatData zero;
m_selectedAddressesHover.clear();
@@ -3338,25 +3342,27 @@ void SourceView::RenderLine( const Tokenizer::Line& line, int lineNum, const Add
ImGui::SameLine( 0, 0 );
}
- const auto lineCount = m_source.get().size();
- const auto tmp = RealToString( lineCount );
- const auto maxLine = strlen( tmp );
- const auto lineString = RealToString( lineNum );
- const auto linesz = strlen( lineString );
- char buf[16];
- memset( buf, ' ', maxLine - linesz );
- memcpy( buf + maxLine - linesz, lineString, linesz+1 );
- TextDisabledUnformatted( buf );
- ImGui::SameLine( 0, ty );
+ {
+ char tmp[32], buf[32];
+ const auto lineCount = m_source.get().size();
+ sprintf( tmp, "%zu", lineCount );
+ const auto maxLine = strlen( tmp );
+ sprintf( tmp, "%i", lineNum );
+ const auto linesz = strlen( tmp );
+ memset( buf, ' ', maxLine - linesz );
+ memcpy( buf + maxLine - linesz, tmp, linesz+1 );
+ TextDisabledUnformatted( buf );
+ ImGui::SameLine( 0, ty );
+ }
if( !m_asm.empty() )
{
- const auto tmp = RealToString( m_asm.size() );
- const auto maxAsm = strlen( tmp ) + 1;
+ char buf[32];
+ sprintf( buf, "%zu", m_asm.size() );
+ const auto maxAsm = strlen( buf ) + 1;
if( match > 0 )
{
- const auto asmString = RealToString( match );
- sprintf( buf, "@%s", asmString );
+ sprintf( buf, "@%" PRIu32, match );
const auto asmsz = strlen( buf );
TextDisabledUnformatted( buf );
ImGui::SameLine( 0, 0 );