summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/as3525/lcd-ssd1303.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/firmware/target/arm/as3525/lcd-ssd1303.c b/firmware/target/arm/as3525/lcd-ssd1303.c
index a36cf87d95..a00398a998 100644
--- a/firmware/target/arm/as3525/lcd-ssd1303.c
+++ b/firmware/target/arm/as3525/lcd-ssd1303.c
@@ -288,15 +288,26 @@ void lcd_update_rect(int x, int y, int width, int height)
288 288
289 /* The Y coordinates have to work on even 8 pixel rows */ 289 /* The Y coordinates have to work on even 8 pixel rows */
290 if (x < 0) 290 if (x < 0)
291 height += x, x = 0; 291 {
292 width += x;
293 x = 0;
294 }
295
292 if (x + width > LCD_WIDTH) 296 if (x + width > LCD_WIDTH)
293 width = LCD_WIDTH - x; 297 width = LCD_WIDTH - x;
298
294 if (width <= 0) 299 if (width <= 0)
295 return; /* nothing left to do, 0 is harmful to lcd_write_data() */ 300 return; /* nothing left to do, 0 is harmful to lcd_write_data() */
301
296 if (y < 0) 302 if (y < 0)
297 height += y, y = 0; 303 {
304 height += y;
305 y = 0;
306 }
307
298 if (y + height > LCD_HEIGHT) 308 if (y + height > LCD_HEIGHT)
299 height = LCD_HEIGHT - y; 309 height = LCD_HEIGHT - y;
310
300 if (height <= 0) 311 if (height <= 0)
301 return; /* nothing left to do */ 312 return; /* nothing left to do */
302 313