From ccf83b992b7f0de00d384d17b1a3406a0fca28ab Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Mon, 24 Oct 2022 16:10:05 -0600 Subject: Fix rendering of code lines when scrolling right, fix TokenizedTextView example --- examples/triage/byte.cpp | 4 ++-- python/examples/linear_mlil.py | 6 +++--- ui/render.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/triage/byte.cpp b/examples/triage/byte.cpp index b6318d1e..75bf7474 100644 --- a/examples/triage/byte.cpp +++ b/examples/triage/byte.cpp @@ -651,8 +651,8 @@ void ByteView::paintEvent(QPaintEvent* event) break; if (m_lines[y + m_topLine].separator) { - m_render.drawLinearDisassemblyLineBackground( - p, NonContiguousSeparatorLineType, QRect(0, 2 + y * charHeight, event->rect().width(), charHeight), 0); + QRect lineRect = QRect(0, 2 + y * charHeight, event->rect().width(), charHeight); + m_render.drawLinearDisassemblyLineBackground(p, NonContiguousSeparatorLineType, lineRect, lineRect, 0); continue; } diff --git a/python/examples/linear_mlil.py b/python/examples/linear_mlil.py index e4df1765..6f2426f2 100644 --- a/python/examples/linear_mlil.py +++ b/python/examples/linear_mlil.py @@ -46,7 +46,7 @@ class LinearMLILView(TokenizedTextView): # Sort basic blocks by IL instruction index blocks = il.basic_blocks - blocks.sort(key=lambda block: block.start) + list(blocks).sort(key=lambda block: block.start) # Function header result = [] @@ -82,12 +82,12 @@ class LinearMLILView(TokenizedTextView): ) ) for i in block: - lines, length = renderer.get_disassembly_text(i.instr_index) + lines = renderer.get_disassembly_text(i.instr_index) lastAddr = i.address lineIndex = 0 for line in lines: result.append( - LinearDisassemblyLine(LinearDisassemblyLineType.CodeDisassemblyLineType, self.function, block, line) + LinearDisassemblyLine(LinearDisassemblyLineType.CodeDisassemblyLineType, self.function, block, line[0]) ) lineIndex += 1 lastBlock = block diff --git a/ui/render.h b/ui/render.h index 92dc654f..e8a03774 100644 --- a/ui/render.h +++ b/ui/render.h @@ -91,7 +91,7 @@ class BINARYNINJAUIAPI RenderContext void drawInstructionHighlight(QPainter& p, const QRect& rect); void drawLinearDisassemblyLineBackground( - QPainter& p, BNLinearDisassemblyLineType type, const QRect& rect, int gutterWidth); + QPainter& p, BNLinearDisassemblyLineType type, const QRect& rect, const QRect& dirtyRect, int gutterWidth); void drawDisassemblyLine(QPainter& p, int left, int top, const std::vector& tokens, HighlightTokenState& highlight, bool highlightOnly = false); -- cgit v1.3.1