truncate display_block area if too large

Dieser Commit ist enthalten in:
Paul Klinger 2019-02-13 01:21:19 +01:00
Ursprung 0dbd2a14d7
Commit 6a4b62579d

6
lcd.c
Datei anzeigen

@ -465,9 +465,9 @@ uint8_t lcd_check_buffer(uint8_t x, uint8_t y) {
return displayBuffer[(y / (DISPLAY_HEIGHT/8))][x] & (1 << (y % (DISPLAY_HEIGHT/8)));
}
void lcd_display_block(uint8_t x, uint8_t line, uint8_t width) {
if (line > (DISPLAY_HEIGHT/8-1)) return;
if (x + width > DISPLAY_WIDTH - 1) {
width = DISPLAY_WIDTH - x - 1;
if (line > (DISPLAY_HEIGHT/8-1) || x > DISPLAY_WIDTH - 1){return;}
if (x + width > DISPLAY_WIDTH) { // no -1 here, x alone is width 1
width = DISPLAY_WIDTH - x;
}
lcd_goto_xpix_y(x,line);
lcd_data(&displayBuffer[line][x], width);