Extract calculation of jump separation.

This commit is contained in:
Bartosz Taudul
2022-10-19 00:59:46 +02:00
parent 11ea081c57
commit 33e5e07629
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() )