lcdDrawLine() speed improvement

ugfx_release_2.6
Tectu 2012-07-24 03:24:50 +02:00
parent 5f268adaaa
commit fd65a3c5b5
1 changed files with 48 additions and 40 deletions

View File

@ -267,6 +267,13 @@ void lcdVerticalScroll(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint1
}
void lcdDrawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color) {
// speed improvement if vertical or horizontal
if(x0 == x1) {
lcdFillArea(x0, y0, x0+1, y1, color);
} else if (y0 == y1) {
lcdFillArea(x0, y0, x1, y0+1, color);
} else {
int16_t dy, dx;
int16_t addx = 1, addy = 1;
int16_t P, diff;
@ -313,6 +320,7 @@ void lcdDrawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t co
}
}
}
}
}
uint16_t lcdDrawChar(uint16_t cx, uint16_t cy, char c, font_t font, uint16_t color, uint16_t bkcolor, bool_t tpText) {