mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-24 22:05:25 +00:00
Don't attempt to draw outside of the graph viewport
This commit is contained in:
parent
6b650dbc14
commit
0dc57d095d
@ -222,6 +222,8 @@ void DisassemblerGraphView::paintNormal(QPainter & p, QRect & viewportRect, int
|
|||||||
{
|
{
|
||||||
int y = block.y + (2 * this->charWidth) + (int(block.block.header_text.lines.size()) * this->charHeight);
|
int y = block.y + (2 * this->charWidth) + (int(block.block.header_text.lines.size()) * this->charHeight);
|
||||||
for(Instr & instr : block.block.instrs)
|
for(Instr & instr : block.block.instrs)
|
||||||
|
{
|
||||||
|
if(y > viewportRect.y() - int(instr.text.lines.size()) * this->charHeight && y < viewportRect.bottom())
|
||||||
{
|
{
|
||||||
auto selected = instr.addr == this->cur_instr;
|
auto selected = instr.addr == this->cur_instr;
|
||||||
//auto traceCount = dbgfunctions->GetTraceRecordHitCount(instr.addr);
|
//auto traceCount = dbgfunctions->GetTraceRecordHitCount(instr.addr);
|
||||||
@ -254,6 +256,7 @@ void DisassemblerGraphView::paintNormal(QPainter & p, QRect & viewportRect, int
|
|||||||
disassemblyTracedColor.green(),
|
disassemblyTracedColor.green(),
|
||||||
std::max(0, std::min(256, disassemblyTracedColor.blue() + colorDiff))));
|
std::max(0, std::min(256, disassemblyTracedColor.blue() + colorDiff))));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
y += int(instr.text.lines.size()) * this->charHeight;
|
y += int(instr.text.lines.size()) * this->charHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -262,14 +265,19 @@ void DisassemblerGraphView::paintNormal(QPainter & p, QRect & viewportRect, int
|
|||||||
auto x = block.x + (2 * this->charWidth);
|
auto x = block.x + (2 * this->charWidth);
|
||||||
auto y = block.y + (2 * this->charWidth);
|
auto y = block.y + (2 * this->charWidth);
|
||||||
for(auto & line : block.block.header_text.lines)
|
for(auto & line : block.block.header_text.lines)
|
||||||
|
{
|
||||||
|
if(y > viewportRect.y() - this->charHeight && y < viewportRect.bottom())
|
||||||
{
|
{
|
||||||
RichTextPainter::paintRichText(&p, x, y, block.width, this->charHeight, 0, line, mFontMetrics);
|
RichTextPainter::paintRichText(&p, x, y, block.width, this->charHeight, 0, line, mFontMetrics);
|
||||||
|
}
|
||||||
y += this->charHeight;
|
y += this->charHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Instr & instr : block.block.instrs)
|
for(Instr & instr : block.block.instrs)
|
||||||
{
|
{
|
||||||
for(auto & line : instr.text.lines)
|
for(auto & line : instr.text.lines)
|
||||||
|
{
|
||||||
|
if(y > viewportRect.y() - this->charHeight && y < viewportRect.bottom())
|
||||||
{
|
{
|
||||||
int rectSize = qRound(this->charWidth);
|
int rectSize = qRound(this->charWidth);
|
||||||
if(rectSize % 2)
|
if(rectSize % 2)
|
||||||
@ -302,6 +310,7 @@ void DisassemblerGraphView::paintNormal(QPainter & p, QRect & viewportRect, int
|
|||||||
p.fillRect(bpRect, mCipColor);
|
p.fillRect(bpRect, mCipColor);
|
||||||
|
|
||||||
RichTextPainter::paintRichText(&p, x + this->charWidth, y, block.width - this->charWidth, this->charHeight, 0, line, mFontMetrics);
|
RichTextPainter::paintRichText(&p, x + this->charWidth, y, block.width - this->charWidth, this->charHeight, 0, line, mFontMetrics);
|
||||||
|
}
|
||||||
y += this->charHeight;
|
y += this->charHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user