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-24bit.c | 48 ++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'firmware/drivers/lcd-24bit.c') diff --git a/firmware/drivers/lcd-24bit.c b/firmware/drivers/lcd-24bit.c index 65fa01f37f..5ee290efe3 100644 --- a/firmware/drivers/lcd-24bit.c +++ b/firmware/drivers/lcd-24bit.c @@ -869,11 +869,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) @@ -883,14 +883,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; @@ -935,19 +935,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; @@ -978,7 +978,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; @@ -991,23 +991,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) { @@ -1026,7 +1026,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); @@ -1052,7 +1052,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; @@ -1065,23 +1065,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