summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd-16bit.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd-16bit.c')
-rw-r--r--firmware/drivers/lcd-16bit.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c
index 03c50f8ebf..6a76ba48ab 100644
--- a/firmware/drivers/lcd-16bit.c
+++ b/firmware/drivers/lcd-16bit.c
@@ -74,11 +74,11 @@ void lcd_hline(int x1, int x2, int y)
74 74
75 /******************** In viewport clipping **********************/ 75 /******************** In viewport clipping **********************/
76 /* nothing to draw? */ 76 /* nothing to draw? */
77 if (((unsigned)y >= (unsigned)lcd_current_viewport->height) || 77 if (((unsigned)y >= (unsigned)lcd_current_viewport->height) ||
78 (x1 >= lcd_current_viewport->width) || 78 (x1 >= lcd_current_viewport->width) ||
79 (x2 < 0)) 79 (x2 < 0))
80 return; 80 return;
81 81
82 if (x1 < 0) 82 if (x1 < 0)
83 x1 = 0; 83 x1 = 0;
84 if (x2 >= lcd_current_viewport->width) 84 if (x2 >= lcd_current_viewport->width)
@@ -88,14 +88,14 @@ void lcd_hline(int x1, int x2, int y)
88 x1 += lcd_current_viewport->x; 88 x1 += lcd_current_viewport->x;
89 x2 += lcd_current_viewport->x; 89 x2 += lcd_current_viewport->x;
90 y += lcd_current_viewport->y; 90 y += lcd_current_viewport->y;
91 91
92#if defined(HAVE_VIEWPORT_CLIP) 92#if defined(HAVE_VIEWPORT_CLIP)
93 /********************* Viewport on screen clipping ********************/ 93 /********************* Viewport on screen clipping ********************/
94 /* nothing to draw? */ 94 /* nothing to draw? */
95 if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH) 95 if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH)
96 || (x2 < 0)) 96 || (x2 < 0))
97 return; 97 return;
98 98
99 /* clipping */ 99 /* clipping */
100 if (x1 < 0) 100 if (x1 < 0)
101 x1 = 0; 101 x1 = 0;
@@ -179,19 +179,19 @@ void lcd_vline(int x, int y1, int y2)
179 y1 = 0; 179 y1 = 0;
180 if (y2 >= lcd_current_viewport->height) 180 if (y2 >= lcd_current_viewport->height)
181 y2 = lcd_current_viewport->height-1; 181 y2 = lcd_current_viewport->height-1;
182 182
183 /* adjust for viewport */ 183 /* adjust for viewport */
184 x += lcd_current_viewport->x; 184 x += lcd_current_viewport->x;
185 y1 += lcd_current_viewport->y; 185 y1 += lcd_current_viewport->y;
186 y2 += lcd_current_viewport->y; 186 y2 += lcd_current_viewport->y;
187 187
188#if defined(HAVE_VIEWPORT_CLIP) 188#if defined(HAVE_VIEWPORT_CLIP)
189 /********************* Viewport on screen clipping ********************/ 189 /********************* Viewport on screen clipping ********************/
190 /* nothing to draw? */ 190 /* nothing to draw? */
191 if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT) 191 if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT)
192 || (y2 < 0)) 192 || (y2 < 0))
193 return; 193 return;
194 194
195 /* clipping */ 195 /* clipping */
196 if (y1 < 0) 196 if (y1 < 0)
197 y1 = 0; 197 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 {
@@ -272,7 +272,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
272 if (y + height > LCD_HEIGHT) 272 if (y + height > LCD_HEIGHT)
273 height = LCD_HEIGHT - y; 273 height = LCD_HEIGHT - y;
274#endif 274#endif
275 275
276 src += stride * src_y + src_x; /* move starting point */ 276 src += stride * src_y + src_x; /* move starting point */
277 dst = FBADDR(x, y); 277 dst = FBADDR(x, y);
278 stride_dst = lcd_current_viewport->buffer->stride; 278 stride_dst = lcd_current_viewport->buffer->stride;
@@ -300,7 +300,7 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x,
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 {