(svn r22290) -Codechange: Somewhat deduplicate one line of code.

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
frosch 14 years ago
parent 43323e38b5
commit 7659575cfa

@ -47,28 +47,29 @@ void Blitter::DrawLine(void *video, int x, int y, int x2, int y2, int screen_wid
stepx = 1;
}
if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, colour);
if (dx > dy) {
frac = dy - (dx / 2);
x2 += stepx; // Make x2 the first column to not draw to
while (x != x2) {
if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, colour);
if (frac >= 0) {
y += stepy;
frac -= dx;
}
x += stepx;
frac += dy;
if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, colour);
}
} else {
frac = dx - (dy / 2);
y2 += stepy; // Make y2 the first row to not draw to
while (y != y2) {
if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, colour);
if (frac >= 0) {
x += stepx;
frac -= dy;
}
y += stepy;
frac += dx;
if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, colour);
}
}
}

Loading…
Cancel
Save