1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 04:23:51 +00:00

Fix calculation of jump arrows offset.

This commit is contained in:
Bartosz Taudul 2021-12-29 13:41:55 +01:00
parent 81de0a3a75
commit ae9b9318e8
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 7 additions and 13 deletions

View File

@ -2372,12 +2372,7 @@ uint64_t SourceView::RenderSymbolAsmView( const AddrStatData& as, Worker& worker
const auto ts = ImGui::CalcTextSize( " " );
const auto th2 = floor( ts.y / 2 );
const auto th4 = floor( ts.y / 4 );
const auto xoff = round(
( ( as.ipTotalAsm.local + as.ipTotalAsm.ext ) == 0 ? 0 : ( 7 * ts.x + ts.y ) ) +
(3+maxAddrLen) * ts.x +
( ( m_asmShowSourceLocation && !m_sourceFiles.empty() ) ? 36 * ts.x : 0 ) +
( m_asmBytes ? m_maxAsmBytes*3 * ts.x : 0 ) +
( ( m_hwSamples && worker.GetHwSampleCountAddress() != 0 ) ? ( 19 * ts.x + ts.y ) : 0 ) );
const auto xoff = m_jumpOffset;
const auto minAddr = m_asm[clipper.DisplayStart].addr;
const auto maxAddr = m_asm[clipper.DisplayEnd-1].addr;
const auto mjl = m_maxJumpLevel;
@ -3564,8 +3559,12 @@ void SourceView::RenderAsmLine( AsmLine& line, const AddrStat& ipcnt, const Addr
}
if( m_showJumps )
{
ImGui::SameLine( 0, 0 );
const auto xoff = ImGui::GetCursorScreenPos().x - wpos.x + round( ty * 0.66f );
m_jumpOffset = xoff;
const auto JumpArrow = JumpArrowBase * ty / 15;
ImGui::SameLine( 0, 2*ty + JumpArrow + m_maxJumpLevel * JumpSeparation );
ImGui::SameLine( 0, ty + JumpArrow + m_maxJumpLevel * JumpSeparation );
auto jit = m_jumpOut.find( line.addr );
if( jit != m_jumpOut.end() )
{
@ -3573,12 +3572,6 @@ void SourceView::RenderAsmLine( AsmLine& line, const AddrStat& ipcnt, const Addr
const auto th4 = floor( ts.y / 4 );
const auto& mjl = m_maxJumpLevel;
const auto col = GetHsvColor( line.jumpAddr, 6 );
const auto xoff = round(
( ( as.ipTotalAsm.local + as.ipTotalAsm.ext == 0 ) ? 0 : ( 7 * ts.x + ts.y ) ) +
(3+maxAddrLen) * ts.x +
( ( m_asmShowSourceLocation && !m_sourceFiles.empty() ) ? 36 * ts.x : 0 ) +
( m_asmBytes ? m_maxAsmBytes*3 * ts.x : 0 ) +
( showHwSamples ? ( 19 * ts.x + ts.y ) : 0 ) );
DrawLine( draw, dpos + ImVec2( xoff + JumpSeparation * mjl + th2, th2 ), dpos + ImVec2( xoff + JumpSeparation * mjl + th2 + JumpArrow / 2, th2 ), col );
DrawLine( draw, dpos + ImVec2( xoff + JumpSeparation * mjl + th2, th2 ), dpos + ImVec2( xoff + JumpSeparation * mjl + th2 + th4, th2 - th4 ), col );

View File

@ -256,6 +256,7 @@ private:
float m_srcWidth;
float m_asmWidth;
float m_jumpOffset;
GetWindowCallback m_gwcb;
Tokenizer m_tokenizer;