diff options
Diffstat (limited to 'firmware/drivers/lcd-16bit.c')
-rw-r--r-- | firmware/drivers/lcd-16bit.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c index 03c50f8ebf..6a76ba48ab 100644 --- a/firmware/drivers/lcd-16bit.c +++ b/firmware/drivers/lcd-16bit.c @@ -74,11 +74,11 @@ void lcd_hline(int x1, int x2, int y) /******************** In viewport clipping **********************/ /* nothing to draw? */ - if (((unsigned)y >= (unsigned)lcd_current_viewport->height) || + if (((unsigned)y >= (unsigned)lcd_current_viewport->height) || (x1 >= lcd_current_viewport->width) || (x2 < 0)) return; - + if (x1 < 0) x1 = 0; if (x2 >= lcd_current_viewport->width) @@ -88,14 +88,14 @@ void lcd_hline(int x1, int x2, int y) x1 += lcd_current_viewport->x; x2 += lcd_current_viewport->x; y += lcd_current_viewport->y; - + #if defined(HAVE_VIEWPORT_CLIP) /********************* Viewport on screen clipping ********************/ /* nothing to draw? */ if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH) || (x2 < 0)) - return; - + return; + /* clipping */ if (x1 < 0) x1 = 0; @@ -179,19 +179,19 @@ void lcd_vline(int x, int y1, int y2) y1 = 0; if (y2 >= lcd_current_viewport->height) y2 = lcd_current_viewport->height-1; - + /* adjust for viewport */ x += lcd_current_viewport->x; y1 += lcd_current_viewport->y; y2 += lcd_current_viewport->y; - + #if defined(HAVE_VIEWPORT_CLIP) /********************* Viewport on screen clipping ********************/ /* nothing to draw? */ - if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT) + if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT) || (y2 < 0)) return; - + /* clipping */ if (y1 < 0) y1 = 0; @@ -224,7 +224,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) return; - + if (x < 0) { width += x; @@ -237,23 +237,23 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, src_y -= y; y = 0; } - + if (x + width > lcd_current_viewport->width) width = lcd_current_viewport->width - x; if (y + height > lcd_current_viewport->height) - height = lcd_current_viewport->height - y; - + height = lcd_current_viewport->height - y; + /* adjust for viewport */ x += lcd_current_viewport->x; y += lcd_current_viewport->y; - + #if defined(HAVE_VIEWPORT_CLIP) /********************* Viewport on screen clipping ********************/ /* nothing to draw? */ - if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) + if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) || (x + width <= 0) || (y + height <= 0)) return; - + /* clip image in viewport in screen */ if (x < 0) { @@ -272,7 +272,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, if (y + height > LCD_HEIGHT) height = LCD_HEIGHT - y; #endif - + src += stride * src_y + src_x; /* move starting point */ dst = FBADDR(x, y); stride_dst = lcd_current_viewport->buffer->stride; @@ -300,7 +300,7 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x, if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) return; - + if (x < 0) { width += x; @@ -313,23 +313,23 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x, src_y -= y; y = 0; } - + if (x + width > lcd_current_viewport->width) width = lcd_current_viewport->width - x; if (y + height > lcd_current_viewport->height) - height = lcd_current_viewport->height - y; - + height = lcd_current_viewport->height - y; + /* adjust for viewport */ x += lcd_current_viewport->x; y += lcd_current_viewport->y; - + #if defined(HAVE_VIEWPORT_CLIP) /********************* Viewport on screen clipping ********************/ /* nothing to draw? */ - if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) + if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) || (x + width <= 0) || (y + height <= 0)) return; - + /* clip image in viewport in screen */ if (x < 0) { |