summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Wagner <rusty.wagner@gmail.com>2022-10-24 16:10:05 -0600
committerPeter LaFosse <peter@vector35.com>2022-11-10 16:19:13 -0500
commitccf83b992b7f0de00d384d17b1a3406a0fca28ab (patch)
treea51653dfd00f38286021fabfac1a307346077c91
parent57aa7249fe0fdfa5cabc5231595314df91d12729 (diff)
Fix rendering of code lines when scrolling right, fix TokenizedTextView example
-rw-r--r--examples/triage/byte.cpp4
-rw-r--r--python/examples/linear_mlil.py6
-rw-r--r--ui/render.h2
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<BinaryNinja::InstructionTextToken>& tokens, HighlightTokenState& highlight,
bool highlightOnly = false);