diff options
author | Bartosz Taudul <wolf@nereid.pl> | 2022-10-19 01:59:46 +0300 |
---|---|---|
committer | Bartosz Taudul <wolf@nereid.pl> | 2022-10-19 02:01:59 +0300 |
commit | 33e5e076292ec6993ac52d58024c6bda87fc7684 (patch) | |
tree | 3c97c63aa96b72c050884d4754161c0819d926d9 | |
parent | 11ea081c570e89a2bb1f900a1b01a8adac55bf33 (diff) |
Extract calculation of jump separation.
-rw-r--r-- | server/TracySourceView.cpp | 10 | ||||
-rw-r--r-- | server/TracySourceView.hpp | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index 5e17aaff..bd774901 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -228,6 +228,12 @@ static void PrintSourceFragment( const SourceContents& src, uint32_t srcline, in constexpr float JumpSeparationBase = 6; constexpr float JumpArrowBase = 9; +float SourceView::CalcJumpSeparation( float scale ) +{ + return round( JumpSeparationBase * scale ); +} + + SourceView::SourceView() : m_font( nullptr ) , m_smallFont( nullptr ) @@ -2512,7 +2518,7 @@ uint64_t SourceView::RenderSymbolAsmView( const AddrStatData& as, Worker& worker const auto maxAddr = m_asm[clipper.DisplayEnd-1].addr; const auto mjl = m_maxJumpLevel; const auto JumpArrow = JumpArrowBase * ts.y / 15; - const auto JumpSeparation = round( JumpSeparationBase * ts.y / 15 ); + const auto JumpSeparation = CalcJumpSeparation( ts.y / 15 ); int i = -1; for( auto& v : m_jumpTable ) @@ -3905,7 +3911,7 @@ void SourceView::RenderAsmLine( AsmLine& line, const AddrStat& ipcnt, const Addr m_jumpOffset = xoff; const auto JumpArrow = JumpArrowBase * ty / 15; - const auto JumpSeparation = round( JumpSeparationBase * ts.y / 15 ); + const auto JumpSeparation = CalcJumpSeparation( ts.y / 15 ); ImGui::SameLine( 0, ty + JumpArrow + m_maxJumpLevel * JumpSeparation ); auto jit = m_jumpOut.find( line.addr ); if( jit != m_jumpOut.end() ) diff --git a/server/TracySourceView.hpp b/server/TracySourceView.hpp index f8f8e1cf..302bb425 100644 --- a/server/TracySourceView.hpp +++ b/server/TracySourceView.hpp @@ -205,6 +205,8 @@ private: bool IsInContext( const Worker& worker, uint64_t addr ) const; const std::vector<uint64_t>* GetAddressesForLocation( uint32_t fileStringIdx, uint32_t line, const Worker& worker ); + tracy_force_inline float CalcJumpSeparation( float scale ); + #ifndef TRACY_NO_FILESELECTOR void Save( const Worker& worker, size_t start = 0, size_t stop = std::numeric_limits<size_t>::max() ); #endif |