From 40e98a2e4915464b9306ab7b0f6feb173de095c5 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Mon, 26 Oct 2020 12:38:22 -0400 Subject: Whitespace cleanup on fb_viewport Rewrite Change-Id: I24aac41c8abecf7b78a44d7f59e842b791be4563 --- firmware/drivers/lcd-16bit-vert.c | 46 +++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'firmware/drivers/lcd-16bit-vert.c') diff --git a/firmware/drivers/lcd-16bit-vert.c b/firmware/drivers/lcd-16bit-vert.c index b336e78c78..8631271482 100644 --- a/firmware/drivers/lcd-16bit-vert.c +++ b/firmware/drivers/lcd-16bit-vert.c @@ -84,19 +84,19 @@ void lcd_hline(int x1, int x2, int y) x1 = 0; if (x2 >= lcd_current_viewport->width) x2 = lcd_current_viewport->width-1; - + /* Adjust x1 and y to viewport */ 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; @@ -143,19 +143,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) { @@ -294,13 +294,13 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x, { fb_data *dst, *dst_end; int stride_dst; - + /******************** Image in viewport clipping **********************/ /* nothing to draw? */ 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) { -- cgit v1.2.3