Fixes #2034: ldc_line() was wrong for slanted lines

This commit is contained in:
Damjan Adamic
2015-01-23 18:12:33 +01:00
parent d6b67899ff
commit f131119ca1
3 changed files with 33 additions and 6 deletions
+6 -6
View File
@@ -490,28 +490,28 @@ void lcd_line(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, LcdFl
if (dxabs >= dyabs) {
/* the line is more horizontal than vertical */
for (int i=0; i<=dxabs; i++) {
if ((1<<(px%8)) & pat) {
lcd_plot(px, py, att);
}
y += dyabs;
if (y>=dxabs) {
y -= dxabs;
py += sdy;
}
if ((1<<(px%8)) & pat) {
lcd_plot(px, py, att);
}
px += sdx;
}
}
else {
/* the line is more vertical than horizontal */
for (int i=0; i<=dyabs; i++) {
if ((1<<(py%8)) & pat) {
lcd_plot(px, py, att);
}
x += dxabs;
if (x >= dyabs) {
x -= dyabs;
px += sdx;
}
if ((1<<(py%8)) & pat) {
lcd_plot(px, py, att);
}
py += sdy;
}
}