diff options
Diffstat (limited to 'firmware/drivers/lcd-16bit-common.c')
-rw-r--r-- | firmware/drivers/lcd-16bit-common.c | 78 |
1 files changed, 5 insertions, 73 deletions
diff --git a/firmware/drivers/lcd-16bit-common.c b/firmware/drivers/lcd-16bit-common.c index 523354d5d2..ad41485dfe 100644 --- a/firmware/drivers/lcd-16bit-common.c +++ b/firmware/drivers/lcd-16bit-common.c | |||
@@ -133,31 +133,9 @@ void lcd_fillrect(int x, int y, int width, int height) | |||
133 | fb_data *dst, *dst_end; | 133 | fb_data *dst, *dst_end; |
134 | int len, step; | 134 | int len, step; |
135 | 135 | ||
136 | /******************** In viewport clipping **********************/ | 136 | if (!lcd_clip_viewport_rect(&x, &y, &width, &height, NULL, NULL)) |
137 | /* nothing to draw? */ | ||
138 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || | ||
139 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) | ||
140 | return; | 137 | return; |
141 | 138 | ||
142 | if (x < 0) | ||
143 | { | ||
144 | width += x; | ||
145 | x = 0; | ||
146 | } | ||
147 | if (y < 0) | ||
148 | { | ||
149 | height += y; | ||
150 | y = 0; | ||
151 | } | ||
152 | if (x + width > lcd_current_viewport->width) | ||
153 | width = lcd_current_viewport->width - x; | ||
154 | if (y + height > lcd_current_viewport->height) | ||
155 | height = lcd_current_viewport->height - y; | ||
156 | |||
157 | /* adjust for viewport */ | ||
158 | x += lcd_current_viewport->x; | ||
159 | y += lcd_current_viewport->y; | ||
160 | |||
161 | /* drawmode and optimisation */ | 139 | /* drawmode and optimisation */ |
162 | if (lcd_current_viewport->drawmode & DRMODE_INVERSEVID) | 140 | if (lcd_current_viewport->drawmode & DRMODE_INVERSEVID) |
163 | { | 141 | { |
@@ -235,33 +213,9 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
235 | int src_y, int stride, int x, int y, | 213 | int src_y, int stride, int x, int y, |
236 | int width, int height) | 214 | int width, int height) |
237 | { | 215 | { |
238 | /******************** Image in viewport clipping **********************/ | 216 | if (!lcd_clip_viewport_rect(&x, &y, &width, &height, &src_x, &src_y)) |
239 | /* nothing to draw? */ | ||
240 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || | ||
241 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) | ||
242 | return; | 217 | return; |
243 | 218 | ||
244 | if (x < 0) | ||
245 | { | ||
246 | width += x; | ||
247 | src_x -= x; | ||
248 | x = 0; | ||
249 | } | ||
250 | if (y < 0) | ||
251 | { | ||
252 | height += y; | ||
253 | src_y -= y; | ||
254 | y = 0; | ||
255 | } | ||
256 | if (x + width > lcd_current_viewport->width) | ||
257 | width = lcd_current_viewport->width - x; | ||
258 | if (y + height > lcd_current_viewport->height) | ||
259 | height = lcd_current_viewport->height - y; | ||
260 | |||
261 | /* convert to viewport coordinates */ | ||
262 | x += lcd_current_viewport->x; | ||
263 | y += lcd_current_viewport->y; | ||
264 | |||
265 | /* move starting point */ | 219 | /* move starting point */ |
266 | src += stride * (src_y >> 3) + src_x; | 220 | src += stride * (src_y >> 3) + src_x; |
267 | src_y &= 7; | 221 | src_y &= 7; |
@@ -465,35 +419,13 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, | |||
465 | fb_data *dst, *dst_row; | 419 | fb_data *dst, *dst_row; |
466 | unsigned dmask = 0x00000000; | 420 | unsigned dmask = 0x00000000; |
467 | int drmode = lcd_current_viewport->drawmode; | 421 | int drmode = lcd_current_viewport->drawmode; |
468 | /* nothing to draw? */ | 422 | |
469 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || | 423 | if (!lcd_clip_viewport_rect(&x, &y, &width, &height, &src_x, &src_y)) |
470 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) | ||
471 | return; | 424 | return; |
425 | |||
472 | /* initialize blending */ | 426 | /* initialize blending */ |
473 | BLEND_INIT; | 427 | BLEND_INIT; |
474 | 428 | ||
475 | /* clipping */ | ||
476 | if (x < 0) | ||
477 | { | ||
478 | width += x; | ||
479 | src_x -= x; | ||
480 | x = 0; | ||
481 | } | ||
482 | if (y < 0) | ||
483 | { | ||
484 | height += y; | ||
485 | src_y -= y; | ||
486 | y = 0; | ||
487 | } | ||
488 | if (x + width > lcd_current_viewport->width) | ||
489 | width = lcd_current_viewport->width - x; | ||
490 | if (y + height > lcd_current_viewport->height) | ||
491 | height = lcd_current_viewport->height - y; | ||
492 | |||
493 | /* adjust for viewport */ | ||
494 | x += lcd_current_viewport->x; | ||
495 | y += lcd_current_viewport->y; | ||
496 | |||
497 | /* the following drawmode combinations are possible: | 429 | /* the following drawmode combinations are possible: |
498 | * 1) COMPLEMENT: just negates the framebuffer contents | 430 | * 1) COMPLEMENT: just negates the framebuffer contents |
499 | * 2) BG and BG+backdrop: draws _only_ background pixels with either | 431 | * 2) BG and BG+backdrop: draws _only_ background pixels with either |