From 09cb3c7843d1bfe24f8259a73441c6398d2c0339 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Wed, 21 Sep 2022 16:13:38 +0100 Subject: lcd: Remove HAVE_VIEWPORT_CLIP This was only enabled for the mrobe500 and sansaconnect targets. Most targets are therefore running without this "safety" measure, and presumably we'd have noticed long ago if there was a problem. So in all likelihood this is just a bunch of dead code that we don't need to carry around. Change-Id: I7d27701a38b1c2a985ee73fa6f277ad215d8d385 --- firmware/drivers/lcd-16bit-common.c | 103 ------------------- firmware/drivers/lcd-16bit-vert.c | 80 --------------- firmware/drivers/lcd-16bit.c | 80 --------------- firmware/drivers/lcd-1bit-vert.c | 86 ---------------- firmware/drivers/lcd-24bit.c | 180 ---------------------------------- firmware/drivers/lcd-2bit-horz.c | 112 --------------------- firmware/drivers/lcd-2bit-vert.c | 111 --------------------- firmware/drivers/lcd-2bit-vi.c | 113 --------------------- firmware/drivers/lcd-bitmap-common.c | 4 - firmware/drivers/lcd-color-common.c | 8 -- firmware/export/config/mrobe500.h | 3 - firmware/export/config/sansaconnect.h | 3 - 12 files changed, 883 deletions(-) diff --git a/firmware/drivers/lcd-16bit-common.c b/firmware/drivers/lcd-16bit-common.c index 1b84847929..523354d5d2 100644 --- a/firmware/drivers/lcd-16bit-common.c +++ b/firmware/drivers/lcd-16bit-common.c @@ -40,30 +40,6 @@ void lcd_clear_viewport(void) width = lcd_current_viewport->width; height = lcd_current_viewport->height; -#if defined(HAVE_VIEWPORT_CLIP) - /********************* Viewport on screen clipping ********************/ - /* nothing to draw? */ - if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - x = 0; - } - if (y < 0) - { - height += y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; -#endif - len = STRIDE_MAIN(width, height); step = STRIDE_MAIN(ROW_INC, COL_INC); @@ -182,30 +158,6 @@ void lcd_fillrect(int x, int y, int width, int height) 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) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - x = 0; - } - if (y < 0) - { - height += y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; -#endif - /* drawmode and optimisation */ if (lcd_current_viewport->drawmode & DRMODE_INVERSEVID) { @@ -310,32 +262,6 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, 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) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - src_x -= x; - x = 0; - } - if (y < 0) - { - height += y; - src_y -= y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; -#endif - /* move starting point */ src += stride * (src_y >> 3) + src_x; src_y &= 7; @@ -568,35 +494,6 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, 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) - || (x + width <= 0) || (y + height <= 0)) - { - BLEND_FINISH; - return; - } - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - src_x -= x; - x = 0; - } - if (y < 0) - { - height += y; - src_y -= y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; -#endif - /* the following drawmode combinations are possible: * 1) COMPLEMENT: just negates the framebuffer contents * 2) BG and BG+backdrop: draws _only_ background pixels with either diff --git a/firmware/drivers/lcd-16bit-vert.c b/firmware/drivers/lcd-16bit-vert.c index 4422fdea50..166af02791 100644 --- a/firmware/drivers/lcd-16bit-vert.c +++ b/firmware/drivers/lcd-16bit-vert.c @@ -93,20 +93,6 @@ void lcd_hline(int x1, int x2, int y) 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; - - /* clipping */ - if (x1 < 0) - x1 = 0; - if (x2 >= LCD_WIDTH) - x2 = LCD_WIDTH-1; -#endif - dst = FBADDR(x1 , y ); stride_dst = lcd_current_viewport->buffer->stride; dst_end = dst + (x2 - x1) * stride_dst; @@ -152,20 +138,6 @@ void lcd_vline(int x, int y1, int y2) 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) - || (y2 < 0)) - return; - - /* clipping */ - if (y1 < 0) - y1 = 0; - if (y2 >= LCD_HEIGHT) - y2 = LCD_HEIGHT-1; -#endif - height = y2 - y1 + 1; /* drawmode and optimisation */ @@ -250,32 +222,6 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, 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) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - src_x -= x; - x = 0; - } - if (y < 0) - { - height += y; - src_y -= y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; -#endif - src += stride * src_x + src_y; /* move starting point */ dst = FBADDR(x, y); stride_dst = lcd_current_viewport->buffer->stride; @@ -326,32 +272,6 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x, 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) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - src_x -= x; - x = 0; - } - if (y < 0) - { - height += y; - src_y -= y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; -#endif - src += stride * src_x + src_y; /* move starting point */ dst = FBADDR(x, y); stride_dst = lcd_current_viewport->buffer->stride; diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c index d6bf5a500d..6dff6f3b50 100644 --- a/firmware/drivers/lcd-16bit.c +++ b/firmware/drivers/lcd-16bit.c @@ -92,20 +92,6 @@ void lcd_hline(int x1, int x2, int y) 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; - - /* clipping */ - if (x1 < 0) - x1 = 0; - if (x2 >= LCD_WIDTH) - x2 = LCD_WIDTH-1; -#endif - width = x2 - x1 + 1; /* drawmode and optimisation */ @@ -188,20 +174,6 @@ void lcd_vline(int x, int y1, int y2) 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) - || (y2 < 0)) - return; - - /* clipping */ - if (y1 < 0) - y1 = 0; - if (y2 >= LCD_HEIGHT) - y2 = LCD_HEIGHT-1; -#endif - dst = FBADDR(x , y1); stride_dst = lcd_current_viewport->buffer->stride; dst_end = dst + (y2 - y1) * stride_dst; @@ -250,32 +222,6 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, 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) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - src_x -= x; - x = 0; - } - if (y < 0) - { - height += y; - src_y -= y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - 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; @@ -326,32 +272,6 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x, 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) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - src_x -= x; - x = 0; - } - if (y < 0) - { - height += y; - src_y -= y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; -#endif - src += stride * src_y + src_x; /* move starting point */ dst = FBADDR(x, y); diff --git a/firmware/drivers/lcd-1bit-vert.c b/firmware/drivers/lcd-1bit-vert.c index dcf5e49504..ff95eacdbc 100644 --- a/firmware/drivers/lcd-1bit-vert.c +++ b/firmware/drivers/lcd-1bit-vert.c @@ -274,10 +274,6 @@ void LCDFN(drawpixel)(int x, int y) { if ( ((unsigned)x < (unsigned)CURRENT_VP->width) && ((unsigned)y < (unsigned)CURRENT_VP->height) -#if defined(HAVE_VIEWPORT_CLIP) - && ((unsigned)x < (unsigned)LCDM(WIDTH)) - && ((unsigned)y < (unsigned)LCDM(HEIGHT)) -#endif ) LCDFN(pixelfuncs)[CURRENT_VP->drawmode](CURRENT_VP->x + x, CURRENT_VP->y + y); } @@ -349,10 +345,6 @@ void LCDFN(drawline)(int x1, int y1, int x2, int y2) { if ( ((unsigned)x < (unsigned)CURRENT_VP->width) && ((unsigned)y < (unsigned)CURRENT_VP->height) -#if defined(HAVE_VIEWPORT_CLIP) - && ((unsigned)x < (unsigned)LCDM(WIDTH)) - && ((unsigned)y < (unsigned)LCDM(HEIGHT)) -#endif ) pfunc(CURRENT_VP->x + x, CURRENT_VP->y + y); @@ -403,20 +395,6 @@ void LCDFN(hline)(int x1, int x2, int y) x2 += CURRENT_VP->x; y += CURRENT_VP->y; -#if defined(HAVE_VIEWPORT_CLIP) - /********************* Viewport on screen clipping ********************/ - /* nothing to draw? */ - if (((unsigned)y >= (unsigned) LCDM(HEIGHT)) || (x1 >= LCDM(WIDTH)) - || (x2 < 0)) - return; - - /* clipping */ - if (x1 < 0) - x1 = 0; - if (x2 >= LCDM(WIDTH)) - x2 = LCDM(WIDTH)-1; -#endif - width = x2 - x1 + 1; bfunc = LCDFN(blockfuncs)[CURRENT_VP->drawmode]; @@ -462,20 +440,6 @@ void LCDFN(vline)(int x, int y1, int y2) 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)) - || (y2 < 0)) - return; - - /* clipping */ - if (y1 < 0) - y1 = 0; - if (y2 >= LCDM(HEIGHT)) - y2 = LCDM(HEIGHT)-1; -#endif - bfunc = LCDFN(blockfuncs)[CURRENT_VP->drawmode]; dst = LCDFB(x,y1>>3); ny = y2 - (y1 & ~7); @@ -544,30 +508,6 @@ void LCDFN(fillrect)(int x, int y, int width, int height) 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)) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - x = 0; - } - if (y < 0) - { - height += y; - y = 0; - } - if (x + width > LCDM(WIDTH)) - width = LCDM(WIDTH) - x; - if (y + height > LCDM(HEIGHT)) - height = LCDM(HEIGHT) - y; -#endif - if (CURRENT_VP->drawmode & DRMODE_INVERSEVID) { if (CURRENT_VP->drawmode & DRMODE_BG) @@ -670,32 +610,6 @@ void ICODE_ATTR LCDFN(bitmap_part)(const unsigned char *src, int src_x, 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)) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - src_x -= x; - x = 0; - } - if (y < 0) - { - height += y; - src_y -= y; - y = 0; - } - if (x + width > LCDM(WIDTH)) - width = LCDM(WIDTH) - x; - if (y + height > LCDM(HEIGHT)) - height = LCDM(HEIGHT) - y; -#endif - src += stride * (src_y >> 3) + src_x; /* move starting point */ src_y &= 7; y -= src_y; diff --git a/firmware/drivers/lcd-24bit.c b/firmware/drivers/lcd-24bit.c index c3aa27f7ce..279ed5924a 100644 --- a/firmware/drivers/lcd-24bit.c +++ b/firmware/drivers/lcd-24bit.c @@ -70,30 +70,6 @@ void lcd_clear_viewport(void) width = lcd_current_viewport->width; height = lcd_current_viewport->height; -#if defined(HAVE_VIEWPORT_CLIP) - /********************* Viewport on screen clipping ********************/ - /* nothing to draw? */ - if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - x = 0; - } - if (y < 0) - { - height += y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; -#endif - len = STRIDE_MAIN(width, height); step = STRIDE_MAIN(ROW_INC, COL_INC); @@ -222,30 +198,6 @@ void lcd_fillrect(int x, int y, int width, int height) 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) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - x = 0; - } - if (y < 0) - { - height += y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; -#endif - /* drawmode and optimisation */ if (lcd_current_viewport->drawmode & DRMODE_INVERSEVID) { @@ -362,32 +314,6 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, 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) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - src_x -= x; - x = 0; - } - if (y < 0) - { - height += y; - src_y -= y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; -#endif - src += stride * (src_y >> 3) + src_x; /* move starting point */ src_y &= 7; src_end = src + width; @@ -592,32 +518,6 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, 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) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - src_x -= x; - x = 0; - } - if (y < 0) - { - height += y; - src_y -= y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; -#endif - /* the following drawmode combinations are possible: * 1) COMPLEMENT: just negates the framebuffer contents * 2) BG and BG+backdrop: draws _only_ background pixels with either @@ -887,20 +787,6 @@ void lcd_hline(int x1, int x2, int y) 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; - - /* clipping */ - if (x1 < 0) - x1 = 0; - if (x2 >= LCD_WIDTH) - x2 = LCD_WIDTH-1; -#endif - width = x2 - x1 + 1; dst = FBADDR(x1 , y); @@ -944,20 +830,6 @@ void lcd_vline(int x, int y1, int y2) 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) - || (y2 < 0)) - return; - - /* clipping */ - if (y1 < 0) - y1 = 0; - if (y2 >= LCD_HEIGHT) - y2 = LCD_HEIGHT-1; -#endif - dst = FBADDR(x , y1); dst_end = dst + (y2 - y1) * LCD_WIDTH; @@ -1004,32 +876,6 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, 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) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - src_x -= x; - x = 0; - } - if (y < 0) - { - height += y; - src_y -= y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; -#endif - src += stride * src_y + src_x; /* move starting point */ dst = FBADDR(x, y); @@ -1078,32 +924,6 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x, 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) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - src_x -= x; - x = 0; - } - if (y < 0) - { - height += y; - src_y -= y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; -#endif - src += stride * src_y + src_x; /* move starting point */ dst = FBADDR(x, y); diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c index 85918a735c..66313d624b 100644 --- a/firmware/drivers/lcd-2bit-horz.c +++ b/firmware/drivers/lcd-2bit-horz.c @@ -420,10 +420,6 @@ void lcd_drawpixel(int x, int y) { 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) - && ((unsigned)y < (unsigned)LCD_HEIGHT) -#endif ) lcd_pixelfuncs[lcd_current_viewport->drawmode](lcd_current_viewport->x + x, lcd_current_viewport->y + y); } @@ -495,10 +491,6 @@ void lcd_drawline(int x1, int y1, int x2, int y2) { 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) - && ((unsigned)y < (unsigned)LCD_HEIGHT) -#endif ) pfunc(lcd_current_viewport->x + x, lcd_current_viewport->y + y); @@ -549,20 +541,6 @@ void lcd_hline(int x1, int x2, int y) 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; - - /* clipping */ - if (x1 < 0) - x1 = 0; - if (x2 >= LCD_WIDTH) - x2 = LCD_WIDTH-1; -#endif - bfunc = lcd_blockfuncs[lcd_current_viewport->drawmode]; dst = FBADDR(x1>>2,y); nx = x2 - (x1 & ~3); @@ -611,20 +589,6 @@ void lcd_vline(int x, int y1, int y2) 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) - || (y2 < 0)) - return; - - /* clipping */ - if (y1 < 0) - y1 = 0; - if (y2 >= LCD_HEIGHT) - y2 = LCD_HEIGHT-1; -#endif - bfunc = lcd_blockfuncs[lcd_current_viewport->drawmode]; dst = FBADDR(x>>2,y1); stride_dst = LCD_FBSTRIDE(lcd_current_viewport->buffer->stride, 0); @@ -688,30 +652,6 @@ void lcd_fillrect(int x, int y, int width, int height) 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) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - x = 0; - } - if (y < 0) - { - height += y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; -#endif - bfunc = lcd_blockfuncs[lcd_current_viewport->drawmode]; dst = FBADDR(x>>2,y); stride_dst = LCD_FBSTRIDE(lcd_current_viewport->buffer->stride, 0); @@ -792,32 +732,6 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, x += lcd_current_viewport->x; /* adjust for viewport */ y += lcd_current_viewport->y; /* adjust for viewport */ -#if defined(HAVE_VIEWPORT_CLIP) - /********************* Viewport on screen clipping ********************/ - /* nothing to draw? */ - if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - src_x -= x; - x = 0; - } - if (y < 0) - { - height += y; - src_y -= y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; -#endif - src += stride * (src_y >> 3) + src_x; /* move starting point */ src_y &= 7; src_end = src + width; @@ -1007,32 +921,6 @@ void ICODE_ATTR lcd_bitmap_part(const unsigned char *src, int src_x, 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) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - src_x -= x; - x = 0; - } - if (y < 0) - { - height += y; - src_y -= y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; -#endif - stride = LCD_FBSTRIDE(stride, 0); /* convert to no. of bytes */ src += stride * src_y + (src_x >> 2); /* move starting point */ diff --git a/firmware/drivers/lcd-2bit-vert.c b/firmware/drivers/lcd-2bit-vert.c index a059e3b512..4ce9960419 100644 --- a/firmware/drivers/lcd-2bit-vert.c +++ b/firmware/drivers/lcd-2bit-vert.c @@ -422,10 +422,6 @@ void lcd_drawpixel(int x, int y) { 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) - && ((unsigned)y < (unsigned)LCD_HEIGHT) -#endif ) lcd_pixelfuncs[lcd_current_viewport->drawmode](lcd_current_viewport->x + x, lcd_current_viewport->y + y); } @@ -497,10 +493,6 @@ void lcd_drawline(int x1, int y1, int x2, int y2) { 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) - && ((unsigned)y < (unsigned)LCD_HEIGHT) -#endif ) pfunc(lcd_current_viewport->x + x, lcd_current_viewport->y + y); @@ -552,20 +544,6 @@ void lcd_hline(int x1, int x2, int y) 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; - - /* clipping */ - if (x1 < 0) - x1 = 0; - if (x2 >= LCD_WIDTH) - x2 = LCD_WIDTH-1; -#endif - width = x2 - x1 + 1; bfunc = lcd_blockfuncs[lcd_current_viewport->drawmode]; @@ -611,20 +589,6 @@ void lcd_vline(int x, int y1, int y2) 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) - || (y2 < 0)) - return; - - /* clipping */ - if (y1 < 0) - y1 = 0; - if (y2 >= LCD_HEIGHT) - y2 = LCD_HEIGHT-1; -#endif - bfunc = lcd_blockfuncs[lcd_current_viewport->drawmode]; dst = FBADDR(x,y1>>2); stride_dst = lcd_current_viewport->buffer->stride; @@ -693,30 +657,6 @@ void lcd_fillrect(int x, int y, int width, int height) 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) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - x = 0; - } - if (y < 0) - { - height += y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; -#endif - if (lcd_current_viewport->drawmode & DRMODE_INVERSEVID) { if ((lcd_current_viewport->drawmode & DRMODE_BG) && !lcd_backdrop) @@ -819,32 +759,6 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, 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) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - src_x -= x; - x = 0; - } - if (y < 0) - { - height += y; - src_y -= y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; -#endif - src += stride * (src_y >> 3) + src_x; /* move starting point */ src_y &= 7; y -= src_y; @@ -1018,31 +932,6 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, 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) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - src_x -= x; - x = 0; - } - if (y < 0) - { - height += y; - src_y -= y; - y = 0; - } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; -#endif src += stride * (src_y >> 2) + src_x; /* move starting point */ src_y &= 3; y -= src_y; diff --git a/firmware/drivers/lcd-2bit-vi.c b/firmware/drivers/lcd-2bit-vi.c index 423f4536d4..b969c93216 100644 --- a/firmware/drivers/lcd-2bit-vi.c +++ b/firmware/drivers/lcd-2bit-vi.c @@ -455,10 +455,6 @@ void LCDFN(drawpixel)(int x, int y) { if ( ((unsigned)x < (unsigned)CURRENT_VP->width) && ((unsigned)y < (unsigned)CURRENT_VP->height) -#if defined(HAVE_VIEWPORT_CLIP) - && ((unsigned)x < (unsigned)LCDM(WIDTH)) - && ((unsigned)y < (unsigned)LCDM(HEIGHT)) -#endif ) LCDFN(pixelfuncs)[CURRENT_VP->drawmode](CURRENT_VP->x+x, CURRENT_VP->y+y); } @@ -530,10 +526,6 @@ void LCDFN(drawline)(int x1, int y1, int x2, int y2) { if ( ((unsigned)x < (unsigned)CURRENT_VP->width) && ((unsigned)y < (unsigned)CURRENT_VP->height) -#if defined(HAVE_VIEWPORT_CLIP) - && ((unsigned)x < (unsigned)LCDM(WIDTH)) - && ((unsigned)y < (unsigned)LCDM(HEIGHT)) -#endif ) pfunc(CURRENT_VP->x + x, CURRENT_VP->y + y); @@ -585,20 +577,6 @@ void LCDFN(hline)(int x1, int x2, int y) x2 += CURRENT_VP->x; y += CURRENT_VP->y; -#if defined(HAVE_VIEWPORT_CLIP) - /********************* Viewport on screen clipping ********************/ - /* nothing to draw? */ - if (((unsigned)y >= (unsigned) LCDM(HEIGHT)) || (x1 >= LCDM(WIDTH)) - || (x2 < 0)) - return; - - /* clipping */ - if (x1 < 0) - x1 = 0; - if (x2 >= LCDM(WIDTH)) - x2 = LCDM(WIDTH)-1; -#endif - width = x2 - x1 + 1; bfunc = LCDFN(blockfuncs)[CURRENT_VP->drawmode]; @@ -644,20 +622,6 @@ void LCDFN(vline)(int x, int y1, int y2) 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)) - || (y2 < 0)) - return; - - /* clipping */ - if (y1 < 0) - y1 = 0; - if (y2 >= LCDM(HEIGHT)) - y2 = LCDM(HEIGHT)-1; -#endif - bfunc = LCDFN(blockfuncs)[CURRENT_VP->drawmode]; dst = LCDFB(x,y1>>3); stride_dst = CURRENT_VP->buffer->stride; @@ -728,31 +692,6 @@ void LCDFN(fillrect)(int x, int y, int width, int height) 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)) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - x = 0; - } - if (y < 0) - { - height += y; - y = 0; - } - if (x + width > LCDM(WIDTH)) - width = LCDM(WIDTH) - x; - if (y + height > LCDM(HEIGHT)) - height = LCDM(HEIGHT) - y; -#endif - - if (CURRENT_VP->drawmode & DRMODE_INVERSEVID) { if ((CURRENT_VP->drawmode & DRMODE_BG) && !backdrop) @@ -857,32 +796,6 @@ void ICODE_ATTR LCDFN(mono_bitmap_part)(const unsigned char *src, int src_x, 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)) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - src_x -= x; - x = 0; - } - if (y < 0) - { - height += y; - src_y -= y; - y = 0; - } - if (x + width > LCDM(WIDTH)) - width = LCDM(WIDTH) - x; - if (y + height > LCDM(HEIGHT)) - height = LCDM(HEIGHT) - y; -#endif - src += stride * (src_y >> 3) + src_x; /* move starting point */ src_y &= 7; y -= src_y; @@ -1027,32 +940,6 @@ void ICODE_ATTR LCDFN(bitmap_part)(const FBFN(data) *src, int src_x, 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)) - || (x + width <= 0) || (y + height <= 0)) - return; - - /* clip image in viewport in screen */ - if (x < 0) - { - width += x; - src_x -= x; - x = 0; - } - if (y < 0) - { - height += y; - src_y -= y; - y = 0; - } - if (x + width > LCDM(WIDTH)) - width = LCDM(WIDTH) - x; - if (y + height > LCDM(HEIGHT)) - height = LCDM(HEIGHT) - y; -#endif - src += stride * (src_y >> 3) + src_x; /* move starting point */ src_y &= 7; y -= src_y; diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c index c85d16cb70..24b302b6d4 100644 --- a/firmware/drivers/lcd-bitmap-common.c +++ b/firmware/drivers/lcd-bitmap-common.c @@ -139,11 +139,7 @@ struct viewport* LCDFN(set_viewport_ex)(struct viewport* vp, int flags) || vp->x + vp->width > LCDM(WIDTH) || vp->y + vp->height > LCDM(HEIGHT)) { -#if !defined(HAVE_VIEWPORT_CLIP) DEBUGF("ERROR: " -#else - DEBUGF("NOTE: " -#endif "set_viewport out of bounds: x: %d y: %d width: %d height:%d\n", vp->x, vp->y, vp->width, vp->height); } diff --git a/firmware/drivers/lcd-color-common.c b/firmware/drivers/lcd-color-common.c index a867583d36..36144b574c 100644 --- a/firmware/drivers/lcd-color-common.c +++ b/firmware/drivers/lcd-color-common.c @@ -198,10 +198,6 @@ void lcd_drawpixel(int x, int y) { 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) - && ((unsigned)y < (unsigned)LCD_HEIGHT) -#endif ) lcd_fastpixelfuncs[lcd_current_viewport->drawmode](FBADDR(lcd_current_viewport->x+x, lcd_current_viewport->y+y)); } @@ -281,10 +277,6 @@ void lcd_drawline(int x1, int y1, int x2, int y2) if ((x >= 0 && y >= 0) && (x < w_vp) && (y < h_vp) -#if defined(HAVE_VIEWPORT_CLIP) - && (x < LCD_WIDTH) - && (y < LCD_HEIGHT) -#endif ) pfunc(fbaddr( x + x_vp, y + y_vp)); diff --git a/firmware/export/config/mrobe500.h b/firmware/export/config/mrobe500.h index ffc8a6bfb8..ebda42d160 100644 --- a/firmware/export/config/mrobe500.h +++ b/firmware/export/config/mrobe500.h @@ -65,9 +65,6 @@ /* define this if the target has volume keys which can be used in the lists */ #define HAVE_VOLUME_IN_LIST -/* define this if you want viewport clipping enabled for safe LCD functions */ -#define HAVE_VIEWPORT_CLIP - /* LCD dimensions */ #define CONFIG_LCD LCD_MROBE500 diff --git a/firmware/export/config/sansaconnect.h b/firmware/export/config/sansaconnect.h index fa929f3c10..a06ea9b207 100644 --- a/firmware/export/config/sansaconnect.h +++ b/firmware/export/config/sansaconnect.h @@ -66,9 +66,6 @@ /* define this if the target has volume keys which can be used in the lists */ #define HAVE_VOLUME_IN_LIST -/* define this if you want viewport clipping enabled for safe LCD functions */ -#define HAVE_VIEWPORT_CLIP - /* LCD dimensions */ #define CONFIG_LCD LCD_CONNECT -- cgit v1.2.3