summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/target/arm/as3525/lcd-ssd1303.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/firmware/target/arm/as3525/lcd-ssd1303.c b/firmware/target/arm/as3525/lcd-ssd1303.c
index 9fcc85d243..a36cf87d95 100644
--- a/firmware/target/arm/as3525/lcd-ssd1303.c
+++ b/firmware/target/arm/as3525/lcd-ssd1303.c
@@ -287,15 +287,21 @@ void lcd_update_rect(int x, int y, int width, int height)
287 return; 287 return;
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 ymax = (y + height-1) >> 3; 290 if (x < 0)
291 y >>= 3; 291 height += x, x = 0;
292 292 if (x + width > LCD_WIDTH)
293 if(x + width > LCD_WIDTH)
294 width = LCD_WIDTH - x; 293 width = LCD_WIDTH - x;
295 if (width <= 0) 294 if (width <= 0)
296 return; /* nothing left to do, 0 is harmful to lcd_write_data() */ 295 return; /* nothing left to do, 0 is harmful to lcd_write_data() */
297 if(ymax >= LCD_FBHEIGHT) 296 if (y < 0)
298 ymax = LCD_FBHEIGHT-1; 297 height += y, y = 0;
298 if (y + height > LCD_HEIGHT)
299 height = LCD_HEIGHT - y;
300 if (height <= 0)
301 return; /* nothing left to do */
302
303 ymax = (y + height-1) >> 3;
304 y >>= 3;
299 305
300 /* Copy specified rectange bitmap to hardware */ 306 /* Copy specified rectange bitmap to hardware */
301 for (; y <= ymax; y++) 307 for (; y <= ymax; y++)