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-vi.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'firmware/drivers/lcd-2bit-vi.c') diff --git a/firmware/drivers/lcd-2bit-vi.c b/firmware/drivers/lcd-2bit-vi.c index 035e8b6d0d..c09bbce2e0 100644 --- a/firmware/drivers/lcd-2bit-vi.c +++ b/firmware/drivers/lcd-2bit-vi.c @@ -437,7 +437,7 @@ void LCDFN(clear_viewport)(void) lastmode = CURRENT_VP->drawmode; /* Invert the INVERSEVID bit and set basic mode to SOLID */ - CURRENT_VP->drawmode = (~lastmode & DRMODE_INVERSEVID) | + CURRENT_VP->drawmode = (~lastmode & DRMODE_INVERSEVID) | DRMODE_SOLID; LCDFN(fillrect)(0, 0, CURRENT_VP->width, CURRENT_VP->height); @@ -452,7 +452,7 @@ void LCDFN(clear_viewport)(void) /* Set a single pixel */ void LCDFN(drawpixel)(int x, int y) { - if ( ((unsigned)x < (unsigned)CURRENT_VP->width) + if ( ((unsigned)x < (unsigned)CURRENT_VP->width) && ((unsigned)y < (unsigned)CURRENT_VP->height) #if defined(HAVE_VIEWPORT_CLIP) && ((unsigned)x < (unsigned)LCDM(WIDTH)) @@ -527,7 +527,7 @@ void LCDFN(drawline)(int x1, int y1, int x2, int y2) for (i = 0; i < numpixels; i++) { - if ( ((unsigned)x < (unsigned)CURRENT_VP->width) + if ( ((unsigned)x < (unsigned)CURRENT_VP->width) && ((unsigned)y < (unsigned)CURRENT_VP->height) #if defined(HAVE_VIEWPORT_CLIP) && ((unsigned)x < (unsigned)LCDM(WIDTH)) @@ -567,13 +567,13 @@ void LCDFN(hline)(int x1, int x2, int y) x1 = x2; x2 = x; } - + /******************** In viewport clipping **********************/ /* nothing to draw? */ if (((unsigned)y >= (unsigned)CURRENT_VP->height) || (x1 >= CURRENT_VP->width) || (x2 < 0)) return; - + if (x1 < 0) x1 = 0; if (x2 >= CURRENT_VP->width) @@ -589,8 +589,8 @@ void LCDFN(hline)(int x1, int x2, int y) /* nothing to draw? */ if (((unsigned)y >= (unsigned) LCDM(HEIGHT)) || (x1 >= LCDM(WIDTH)) || (x2 < 0)) - return; - + return; + /* clipping */ if (x1 < 0) x1 = 0; @@ -642,14 +642,14 @@ void LCDFN(vline)(int x, int y1, int y2) y1 += CURRENT_VP->y; y2 += CURRENT_VP->y; x += CURRENT_VP->x; - + #if defined(HAVE_VIEWPORT_CLIP) /********************* Viewport on screen clipping ********************/ /* nothing to draw? */ - if (( (unsigned) x >= (unsigned)LCDM(WIDTH)) || (y1 >= LCDM(HEIGHT)) + if (( (unsigned) x >= (unsigned)LCDM(WIDTH)) || (y1 >= LCDM(HEIGHT)) || (y2 < 0)) return; - + /* clipping */ if (y1 < 0) y1 = 0; @@ -707,7 +707,7 @@ void LCDFN(fillrect)(int x, int y, int width, int height) if ((width <= 0) || (height <= 0) || (x >= CURRENT_VP->width) || (y >= CURRENT_VP->height) || (x + width <= 0) || (y + height <= 0)) return; - + if (x < 0) { width += x; @@ -726,14 +726,14 @@ void LCDFN(fillrect)(int x, int y, int width, int height) /* adjust for viewport */ x += CURRENT_VP->x; y += CURRENT_VP->y; - + #if defined(HAVE_VIEWPORT_CLIP) /********************* Viewport on screen clipping ********************/ /* nothing to draw? */ - if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT)) + if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT)) || (x + width <= 0) || (y + height <= 0)) return; - + /* clip image in viewport in screen */ if (x < 0) { @@ -855,14 +855,14 @@ void ICODE_ATTR LCDFN(mono_bitmap_part)(const unsigned char *src, int src_x, /* adjust for viewport */ x += CURRENT_VP->x; y += CURRENT_VP->y; - + #if defined(HAVE_VIEWPORT_CLIP) /********************* Viewport on screen clipping ********************/ /* nothing to draw? */ - if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT)) + if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT)) || (x + width <= 0) || (y + height <= 0)) return; - + /* clip image in viewport in screen */ if (x < 0) { @@ -1029,10 +1029,10 @@ void ICODE_ATTR LCDFN(bitmap_part)(const FBFN(data) *src, int src_x, #if defined(HAVE_VIEWPORT_CLIP) /********************* Viewport on screen clipping ********************/ /* nothing to draw? */ - if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT)) + if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT)) || (x + width <= 0) || (y + height <= 0)) return; - + /* clip image in viewport in screen */ if (x < 0) { -- cgit v1.2.3