1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-26 09:45:21 +03:00

Fixes #1987: first pixel not drawn by Lua lcd.drawLine(), bmpLoad() last column not loaded for some bitmap widths, gtests added (ported from master)

This commit is contained in:
Damjan Adamic 2015-01-09 20:11:30 +01:00
parent 891109a89d
commit b878dc6736
6 changed files with 59 additions and 22 deletions

View file

@ -537,28 +537,30 @@ 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++) {
for (int i=0; i<=dxabs; i++) {
y += dyabs;
if (y>=dxabs) {
y -= dxabs;
py += sdy;
}
px += sdx;
if ((1<<(px%8)) & pat)
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++) {
for (int i=0; i<=dyabs; i++) {
x += dxabs;
if (x >= dyabs) {
x -= dyabs;
px += sdx;
}
py += sdy;
if ((1<<(py%8)) & pat)
if ((1<<(py%8)) & pat) {
lcd_plot(px, py, att);
}
py += sdy;
}
}
}