Projectkk2glider/issue 4449 drawline (#4464)

* Gtest pattern changed

* Fixes #4449: lcdDrawLine_line() was wrong for slanted lines [128x64]

* Fixes #4449: lcdDrawLine_line() was wrong for slanted lines [480x272]

* lcdDrawLine() coordinates check moved to Lua API
This commit is contained in:
Damjan Adamic
2017-02-16 00:23:42 +01:00
committed by Bertrand Songis
parent 53f55f8e1d
commit ee43d3fb97
7 changed files with 53 additions and 42 deletions
+6 -6
View File
@@ -636,28 +636,28 @@ void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, Lc
if (dxabs >= dyabs) {
/* the line is more horizontal than vertical */
for (int i=0; i<=dxabs; i++) {
if ((1<<(px%8)) & pat) {
lcdDrawPoint(px, py, att);
}
y += dyabs;
if (y>=dxabs) {
y -= dxabs;
py += sdy;
}
if ((1<<(px%8)) & pat) {
lcdDrawPoint(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) {
lcdDrawPoint(px, py, att);
}
x += dxabs;
if (x >= dyabs) {
x -= dyabs;
px += sdx;
}
if ((1<<(py%8)) & pat) {
lcdDrawPoint(px, py, att);
}
py += sdy;
}
}