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-2bit-vert.c | 76 ++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 38 deletions(-) (limited to 'firmware/drivers/lcd-2bit-vert.c') diff --git a/firmware/drivers/lcd-2bit-vert.c b/firmware/drivers/lcd-2bit-vert.c index a099c45e98..6a476495d0 100644 --- a/firmware/drivers/lcd-2bit-vert.c +++ b/firmware/drivers/lcd-2bit-vert.c @@ -260,7 +260,7 @@ static void ICODE_ATTR solidblock(fb_data *address, unsigned mask, { unsigned data = *address; unsigned bgp = bg_pattern; - + bits = bgp ^ ((bgp ^ fg_pattern) & bits); *address = data ^ ((data ^ bits) & mask); } @@ -270,7 +270,7 @@ static void ICODE_ATTR solidimgblock(fb_data *address, unsigned mask, { unsigned data = *address; unsigned bgp = *(address + lcd_backdrop_offset); - + bits = bgp ^ ((bgp ^ fg_pattern) & bits); *address = data ^ ((data ^ bits) & mask); } @@ -310,7 +310,7 @@ static void ICODE_ATTR solidinvblock(fb_data *address, unsigned mask, { unsigned data = *address; unsigned fgp = fg_pattern; - + bits = fgp ^ ((fgp ^ bg_pattern) & bits); *address = data ^ ((data ^ bits) & mask); } @@ -320,7 +320,7 @@ static void ICODE_ATTR solidimginvblock(fb_data *address, unsigned mask, { unsigned data = *address; unsigned fgp = fg_pattern; - + bits = fgp ^ ((fgp ^ *(address + lcd_backdrop_offset)) & bits); *address = data ^ ((data ^ bits) & mask); } @@ -347,7 +347,7 @@ void lcd_set_backdrop(fb_data* backdrop) lcd_pixelfuncs = lcd_pixelfuncs_backdrop; lcd_blockfuncs = lcd_blockfuncs_backdrop; } - else + else { lcd_backdrop_offset = 0; lcd_pixelfuncs = lcd_pixelfuncs_bgcolor; @@ -419,7 +419,7 @@ void lcd_clear_viewport(void) /* Set a single pixel */ void lcd_drawpixel(int x, int y) { - if ( ((unsigned)x < (unsigned)lcd_current_viewport->width) + if ( ((unsigned)x < (unsigned)lcd_current_viewport->width) && ((unsigned)y < (unsigned)lcd_current_viewport->height) #if defined(HAVE_VIEWPORT_CLIP) && ((unsigned)x < (unsigned)LCD_WIDTH) @@ -494,7 +494,7 @@ void lcd_drawline(int x1, int y1, int x2, int y2) for (i = 0; i < numpixels; i++) { - if ( ((unsigned)x < (unsigned)lcd_current_viewport->width) + if ( ((unsigned)x < (unsigned)lcd_current_viewport->width) && ((unsigned)y < (unsigned)lcd_current_viewport->height) #if defined(HAVE_VIEWPORT_CLIP) && ((unsigned)x < (unsigned)LCD_WIDTH) @@ -534,12 +534,12 @@ void lcd_hline(int x1, int x2, int y) x1 = x2; x2 = x; } - + /******************** In viewport clipping **********************/ /* nothing to draw? */ if (((unsigned)y >= (unsigned)lcd_current_viewport->height) || (x1 >= lcd_current_viewport->width) || (x2 < 0)) - return; + return; if (x1 < 0) x1 = 0; @@ -550,14 +550,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; @@ -598,25 +598,25 @@ void lcd_vline(int x, int y1, int y2) /* nothing to draw? */ if (((unsigned)x >= (unsigned)lcd_current_viewport->width) || (y1 >= lcd_current_viewport->height) || (y2 < 0)) - return; - + return; + if (y1 < 0) y1 = 0; if (y2 >= lcd_current_viewport->height) y2 = lcd_current_viewport->height-1; - + /* adjust for viewport */ y1 += lcd_current_viewport->y; y2 += lcd_current_viewport->y; x += lcd_current_viewport->x; - + #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; @@ -687,18 +687,18 @@ void lcd_fillrect(int x, int y, int width, int height) width = lcd_current_viewport->width - x; if (y + height > lcd_current_viewport->height) 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) { @@ -817,14 +817,14 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, /* 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) { @@ -856,7 +856,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, mask_bottom = 0xFFFFu >> (2 * (~ny & 7)); bfunc = lcd_blockfuncs[lcd_current_viewport->drawmode]; - + if (shift == 0) { unsigned dmask1, dmask2, data; @@ -868,7 +868,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, { const unsigned char *src_row = src; fb_data *dst_row = dst + stride_dst; - + dst_end = dst_row + width; if (dmask1 != 0) @@ -895,7 +895,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, /* & 0xFFu is unnecessary here - dmask1 can't exceed that*/ dmask2 &= (mask_bottom >> 8); dst_end = dst + width; - + if (dmask1 != 0) { if (dmask2 != 0) @@ -931,8 +931,8 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, fb_data *dst_col = dst++; unsigned mask_col = mask; unsigned data = 0; - - for (y = ny; y >= 8; y -= 8) + + for (y = ny; y >= 8; y -= 8) { data |= *src_col << shift; @@ -995,7 +995,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; @@ -1016,14 +1016,14 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_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) { @@ -1052,7 +1052,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, mask = 0xFFu << (2 * (shift + src_y)); mask_bottom = 0xFFu >> (2 * (~ny & 3)); - + if (shift == 0) { for (; ny >= 4; ny -= 4) @@ -1063,9 +1063,9 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, { const fb_data *src_row = src; fb_data *dst_row = dst; - + dst_end = dst_row + width; - do + do setblock(dst_row++, mask, *src_row++); while (dst_row < dst_end); } @@ -1095,7 +1095,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, fb_data *dst_col = dst++; unsigned mask_col = mask; unsigned data = 0; - + for (y = ny; y >= 4; y -= 4) { data |= *src_col << shift; -- cgit v1.2.3