summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd-16bit-vert.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd-16bit-vert.c')
-rw-r--r--firmware/drivers/lcd-16bit-vert.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/firmware/drivers/lcd-16bit-vert.c b/firmware/drivers/lcd-16bit-vert.c
index b336e78c78..8631271482 100644
--- a/firmware/drivers/lcd-16bit-vert.c
+++ b/firmware/drivers/lcd-16bit-vert.c
@@ -84,19 +84,19 @@ void lcd_hline(int x1, int x2, int y)
84 x1 = 0; 84 x1 = 0;
85 if (x2 >= lcd_current_viewport->width) 85 if (x2 >= lcd_current_viewport->width)
86 x2 = lcd_current_viewport->width-1; 86 x2 = lcd_current_viewport->width-1;
87 87
88 /* Adjust x1 and y to viewport */ 88 /* Adjust x1 and y to viewport */
89 x1 += lcd_current_viewport->x; 89 x1 += lcd_current_viewport->x;
90 x2 += lcd_current_viewport->x; 90 x2 += lcd_current_viewport->x;
91 y += lcd_current_viewport->y; 91 y += lcd_current_viewport->y;
92 92
93#if defined(HAVE_VIEWPORT_CLIP) 93#if defined(HAVE_VIEWPORT_CLIP)
94 /********************* Viewport on screen clipping ********************/ 94 /********************* Viewport on screen clipping ********************/
95 /* nothing to draw? */ 95 /* nothing to draw? */
96 if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH) 96 if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH)
97 || (x2 < 0)) 97 || (x2 < 0))
98 return; 98 return;
99 99
100 /* clipping */ 100 /* clipping */
101 if (x1 < 0) 101 if (x1 < 0)
102 x1 = 0; 102 x1 = 0;
@@ -143,19 +143,19 @@ void lcd_vline(int x, int y1, int y2)
143 y1 = 0; 143 y1 = 0;
144 if (y2 >= lcd_current_viewport->height) 144 if (y2 >= lcd_current_viewport->height)
145 y2 = lcd_current_viewport->height-1; 145 y2 = lcd_current_viewport->height-1;
146 146
147 /* adjust for viewport */ 147 /* adjust for viewport */
148 x += lcd_current_viewport->x; 148 x += lcd_current_viewport->x;
149 y1 += lcd_current_viewport->y; 149 y1 += lcd_current_viewport->y;
150 y2 += lcd_current_viewport->y; 150 y2 += lcd_current_viewport->y;
151 151
152#if defined(HAVE_VIEWPORT_CLIP) 152#if defined(HAVE_VIEWPORT_CLIP)
153 /********************* Viewport on screen clipping ********************/ 153 /********************* Viewport on screen clipping ********************/
154 /* nothing to draw? */ 154 /* nothing to draw? */
155 if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT) 155 if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT)
156 || (y2 < 0)) 156 || (y2 < 0))
157 return; 157 return;
158 158
159 /* clipping */ 159 /* clipping */
160 if (y1 < 0) 160 if (y1 < 0)
161 y1 = 0; 161 y1 = 0;
@@ -224,7 +224,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
224 if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || 224 if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) ||
225 (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) 225 (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0))
226 return; 226 return;
227 227
228 if (x < 0) 228 if (x < 0)
229 { 229 {
230 width += x; 230 width += x;
@@ -237,23 +237,23 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
237 src_y -= y; 237 src_y -= y;
238 y = 0; 238 y = 0;
239 } 239 }
240 240
241 if (x + width > lcd_current_viewport->width) 241 if (x + width > lcd_current_viewport->width)
242 width = lcd_current_viewport->width - x; 242 width = lcd_current_viewport->width - x;
243 if (y + height > lcd_current_viewport->height) 243 if (y + height > lcd_current_viewport->height)
244 height = lcd_current_viewport->height - y; 244 height = lcd_current_viewport->height - y;
245 245
246 /* adjust for viewport */ 246 /* adjust for viewport */
247 x += lcd_current_viewport->x; 247 x += lcd_current_viewport->x;
248 y += lcd_current_viewport->y; 248 y += lcd_current_viewport->y;
249 249
250#if defined(HAVE_VIEWPORT_CLIP) 250#if defined(HAVE_VIEWPORT_CLIP)
251 /********************* Viewport on screen clipping ********************/ 251 /********************* Viewport on screen clipping ********************/
252 /* nothing to draw? */ 252 /* nothing to draw? */
253 if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) 253 if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
254 || (x + width <= 0) || (y + height <= 0)) 254 || (x + width <= 0) || (y + height <= 0))
255 return; 255 return;
256 256
257 /* clip image in viewport in screen */ 257 /* clip image in viewport in screen */
258 if (x < 0) 258 if (x < 0)
259 { 259 {
@@ -294,13 +294,13 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x,
294{ 294{
295 fb_data *dst, *dst_end; 295 fb_data *dst, *dst_end;
296 int stride_dst; 296 int stride_dst;
297 297
298 /******************** Image in viewport clipping **********************/ 298 /******************** Image in viewport clipping **********************/
299 /* nothing to draw? */ 299 /* nothing to draw? */
300 if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || 300 if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) ||
301 (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) 301 (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0))
302 return; 302 return;
303 303
304 if (x < 0) 304 if (x < 0)
305 { 305 {
306 width += x; 306 width += x;
@@ -313,23 +313,23 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x,
313 src_y -= y; 313 src_y -= y;
314 y = 0; 314 y = 0;
315 } 315 }
316 316
317 if (x + width > lcd_current_viewport->width) 317 if (x + width > lcd_current_viewport->width)
318 width = lcd_current_viewport->width - x; 318 width = lcd_current_viewport->width - x;
319 if (y + height > lcd_current_viewport->height) 319 if (y + height > lcd_current_viewport->height)
320 height = lcd_current_viewport->height - y; 320 height = lcd_current_viewport->height - y;
321 321
322 /* adjust for viewport */ 322 /* adjust for viewport */
323 x += lcd_current_viewport->x; 323 x += lcd_current_viewport->x;
324 y += lcd_current_viewport->y; 324 y += lcd_current_viewport->y;
325 325
326#if defined(HAVE_VIEWPORT_CLIP) 326#if defined(HAVE_VIEWPORT_CLIP)
327 /********************* Viewport on screen clipping ********************/ 327 /********************* Viewport on screen clipping ********************/
328 /* nothing to draw? */ 328 /* nothing to draw? */
329 if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) 329 if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
330 || (x + width <= 0) || (y + height <= 0)) 330 || (x + width <= 0) || (y + height <= 0))
331 return; 331 return;
332 332
333 /* clip image in viewport in screen */ 333 /* clip image in viewport in screen */
334 if (x < 0) 334 if (x < 0)
335 { 335 {