summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd-charcell.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd-charcell.c')
-rw-r--r--firmware/drivers/lcd-charcell.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/firmware/drivers/lcd-charcell.c b/firmware/drivers/lcd-charcell.c
index d02c5eeaad..9fabeb4a22 100644
--- a/firmware/drivers/lcd-charcell.c
+++ b/firmware/drivers/lcd-charcell.c
@@ -84,6 +84,28 @@ void lcd_set_viewport(struct viewport* vp)
84 current_vp = &default_vp; 84 current_vp = &default_vp;
85 else 85 else
86 current_vp = vp; 86 current_vp = vp;
87
88#if defined(SIMULATOR)
89 /* Force the viewport to be within bounds. If this happens it should
90 * be considered an error - the viewport will not draw as it might be
91 * expected.
92 */
93 if((unsigned) current_vp->x > (unsigned) LCD_WIDTH
94 || (unsigned) current_vp->y > (unsigned) LCD_HEIGHT
95 || current_vp->x + current_vp->width > LCD_WIDTH
96 || current_vp->y + current_vp->height > LCD_HEIGHT)
97 {
98#if !defined(HAVE_VIEWPORT_CLIP)
99 DEBUGF("ERROR: "
100#else
101 DEBUGF("NOTE: "
102#endif
103 "set_viewport out of bounds: x: %d y: %d width: %d height:%d\n",
104 current_vp->x, current_vp->y,
105 current_vp->width, current_vp->height);
106 }
107
108#endif
87} 109}
88 110
89void lcd_update_viewport(void) 111void lcd_update_viewport(void)
@@ -250,6 +272,11 @@ static void lcd_putxchar(int x, int y, int xchar)
250 x += current_vp->x; 272 x += current_vp->x;
251 y += current_vp->y; 273 y += current_vp->y;
252 274
275#if defined(HAVE_VIEWPORT_CLIP)
276 if((unsigned)x > (unsigned)LCD_WIDTH || (unsigned)y > (unsigned)LCD_HEIGHT)
277 return;
278#endif
279
253 lcd_char = lcd_charbuffer[y][x]; 280 lcd_char = lcd_charbuffer[y][x];
254 281
255 if (lcd_char < lcd_pattern_count) /* old char was soft */ 282 if (lcd_char < lcd_pattern_count) /* old char was soft */