Skip to content

Commit

Permalink
Merge pull request hrydgard#4210 from Kingcom/Debugger
Browse files Browse the repository at this point in the history
Highlight branch arrows that reference the current opcode
  • Loading branch information
hrydgard committed Oct 17, 2013
2 parents f64b17a + 35a7cb4 commit 1e6aa83
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions Windows/Debugger/CtrlDisAsmView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,9 @@ void CtrlDisAsmView::assembleOpcode(u32 address, std::string defaultText)

void CtrlDisAsmView::drawBranchLine(HDC hdc, BranchLine& line)
{
HPEN pen;
u32 windowEnd = windowStart+(visibleRows+2)*instructionSize;

int topY;
int bottomY;
if (line.first < windowStart)
Expand Down Expand Up @@ -514,8 +515,18 @@ void CtrlDisAsmView::drawBranchLine(HDC hdc, BranchLine& line)
{
return;
}


// highlight line in a different color if it affects the currently selected opcode
if (line.first == curAddress || line.second == curAddress)
{
pen = CreatePen(0,0,0x257AFA);
} else {
pen = CreatePen(0,0,0xFF3020);
}

HPEN oldPen = (HPEN) SelectObject(hdc,pen);
int x = pixelPositions.arrowsStart+line.laneIndex*8;

if (topY < 0) // first is not visible, but second is
{
MoveToEx(hdc,x-2,bottomY,0);
Expand Down Expand Up @@ -562,6 +573,9 @@ void CtrlDisAsmView::drawBranchLine(HDC hdc, BranchLine& line)
LineTo(hdc,x+1,bottomY+5);
}
}

SelectObject(hdc,oldPen);
DeleteObject(pen);
}

void CtrlDisAsmView::onPaint(WPARAM wParam, LPARAM lParam)
Expand All @@ -577,7 +591,6 @@ void CtrlDisAsmView::onPaint(WPARAM wParam, LPARAM lParam)
SetBkMode(hdc, TRANSPARENT);

HPEN nullPen=CreatePen(0,0,0xffffff);
HPEN condPen=CreatePen(0,0,0xFF3020);
HBRUSH nullBrush=CreateSolidBrush(0xffffff);
HBRUSH currentBrush=CreateSolidBrush(0xFFEfE8);

Expand Down Expand Up @@ -665,7 +678,6 @@ void CtrlDisAsmView::onPaint(WPARAM wParam, LPARAM lParam)
SelectObject(hdc,font);
}

SelectObject(hdc,condPen);
for (size_t i = 0; i < visibleFunctionAddresses.size(); i++)
{
auto it = functions.find(visibleFunctionAddresses[i]);
Expand Down Expand Up @@ -693,7 +705,6 @@ void CtrlDisAsmView::onPaint(WPARAM wParam, LPARAM lParam)
DeleteDC(hdc);

DeleteObject(nullPen);
DeleteObject(condPen);

DeleteObject(nullBrush);
DeleteObject(currentBrush);
Expand Down

0 comments on commit 1e6aa83

Please sign in to comment.