Extract calculation of jump separation.

This commit is contained in:
Bartosz Taudul 2022-10-19 00:59:46 +02:00
parent 11ea081c57
commit 33e5e07629
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 10 additions and 2 deletions

View File

@ -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() )

View File

@ -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