summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd-1bit-vert.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd-1bit-vert.c')
-rw-r--r--firmware/drivers/lcd-1bit-vert.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/firmware/drivers/lcd-1bit-vert.c b/firmware/drivers/lcd-1bit-vert.c
index 57abdb91a6..c86ced9b6c 100644
--- a/firmware/drivers/lcd-1bit-vert.c
+++ b/firmware/drivers/lcd-1bit-vert.c
@@ -219,7 +219,7 @@ static void ICODE_ATTR solidinvblock(FBFN(data) *address, unsigned mask,
219 unsigned bits) 219 unsigned bits)
220{ 220{
221 unsigned data = *(char *)address; 221 unsigned data = *(char *)address;
222 222
223 bits = ~bits ^ data; 223 bits = ~bits ^ data;
224 *address = data ^ (bits & mask); 224 *address = data ^ (bits & mask);
225} 225}
@@ -255,7 +255,7 @@ void LCDFN(clear_viewport)(void)
255 oldmode = CURRENT_VP->drawmode; 255 oldmode = CURRENT_VP->drawmode;
256 256
257 /* Invert the INVERSEVID bit and set basic mode to SOLID */ 257 /* Invert the INVERSEVID bit and set basic mode to SOLID */
258 CURRENT_VP->drawmode = (~CURRENT_VP->drawmode & DRMODE_INVERSEVID) | 258 CURRENT_VP->drawmode = (~CURRENT_VP->drawmode & DRMODE_INVERSEVID) |
259 DRMODE_SOLID; 259 DRMODE_SOLID;
260 260
261 LCDFN(fillrect)(0, 0, CURRENT_VP->width, CURRENT_VP->height); 261 LCDFN(fillrect)(0, 0, CURRENT_VP->width, CURRENT_VP->height);
@@ -271,7 +271,7 @@ void LCDFN(clear_viewport)(void)
271/* Set a single pixel */ 271/* Set a single pixel */
272void LCDFN(drawpixel)(int x, int y) 272void LCDFN(drawpixel)(int x, int y)
273{ 273{
274 if ( ((unsigned)x < (unsigned)CURRENT_VP->width) 274 if ( ((unsigned)x < (unsigned)CURRENT_VP->width)
275 && ((unsigned)y < (unsigned)CURRENT_VP->height) 275 && ((unsigned)y < (unsigned)CURRENT_VP->height)
276#if defined(HAVE_VIEWPORT_CLIP) 276#if defined(HAVE_VIEWPORT_CLIP)
277 && ((unsigned)x < (unsigned)LCDM(WIDTH)) 277 && ((unsigned)x < (unsigned)LCDM(WIDTH))
@@ -385,30 +385,30 @@ void LCDFN(hline)(int x1, int x2, int y)
385 x1 = x2; 385 x1 = x2;
386 x2 = x; 386 x2 = x;
387 } 387 }
388 388
389 /******************** In viewport clipping **********************/ 389 /******************** In viewport clipping **********************/
390 /* nothing to draw? */ 390 /* nothing to draw? */
391 if (((unsigned)y >= (unsigned)CURRENT_VP->height) || (x1 >= CURRENT_VP->width) 391 if (((unsigned)y >= (unsigned)CURRENT_VP->height) || (x1 >= CURRENT_VP->width)
392 || (x2 < 0)) 392 || (x2 < 0))
393 return; 393 return;
394 394
395 if (x1 < 0) 395 if (x1 < 0)
396 x1 = 0; 396 x1 = 0;
397 if (x2 >= CURRENT_VP->width) 397 if (x2 >= CURRENT_VP->width)
398 x2 = CURRENT_VP->width-1; 398 x2 = CURRENT_VP->width-1;
399 399
400 /* adjust to viewport */ 400 /* adjust to viewport */
401 x1 += CURRENT_VP->x; 401 x1 += CURRENT_VP->x;
402 x2 += CURRENT_VP->x; 402 x2 += CURRENT_VP->x;
403 y += CURRENT_VP->y; 403 y += CURRENT_VP->y;
404 404
405#if defined(HAVE_VIEWPORT_CLIP) 405#if defined(HAVE_VIEWPORT_CLIP)
406 /********************* Viewport on screen clipping ********************/ 406 /********************* Viewport on screen clipping ********************/
407 /* nothing to draw? */ 407 /* nothing to draw? */
408 if (((unsigned)y >= (unsigned) LCDM(HEIGHT)) || (x1 >= LCDM(WIDTH)) 408 if (((unsigned)y >= (unsigned) LCDM(HEIGHT)) || (x1 >= LCDM(WIDTH))
409 || (x2 < 0)) 409 || (x2 < 0))
410 return; 410 return;
411 411
412 /* clipping */ 412 /* clipping */
413 if (x1 < 0) 413 if (x1 < 0)
414 x1 = 0; 414 x1 = 0;
@@ -449,25 +449,25 @@ void LCDFN(vline)(int x, int y1, int y2)
449 /* nothing to draw? */ 449 /* nothing to draw? */
450 if (((unsigned)x >= (unsigned)CURRENT_VP->width) || (y1 >= CURRENT_VP->height) 450 if (((unsigned)x >= (unsigned)CURRENT_VP->width) || (y1 >= CURRENT_VP->height)
451 || (y2 < 0)) 451 || (y2 < 0))
452 return; 452 return;
453 453
454 if (y1 < 0) 454 if (y1 < 0)
455 y1 = 0; 455 y1 = 0;
456 if (y2 >= CURRENT_VP->height) 456 if (y2 >= CURRENT_VP->height)
457 y2 = CURRENT_VP->height-1; 457 y2 = CURRENT_VP->height-1;
458 458
459 /* adjust for viewport */ 459 /* adjust for viewport */
460 y1 += CURRENT_VP->y; 460 y1 += CURRENT_VP->y;
461 y2 += CURRENT_VP->y; 461 y2 += CURRENT_VP->y;
462 x += CURRENT_VP->x; 462 x += CURRENT_VP->x;
463 463
464#if defined(HAVE_VIEWPORT_CLIP) 464#if defined(HAVE_VIEWPORT_CLIP)
465 /********************* Viewport on screen clipping ********************/ 465 /********************* Viewport on screen clipping ********************/
466 /* nothing to draw? */ 466 /* nothing to draw? */
467 if (( (unsigned) x >= (unsigned)LCDM(WIDTH)) || (y1 >= LCDM(HEIGHT)) 467 if (( (unsigned) x >= (unsigned)LCDM(WIDTH)) || (y1 >= LCDM(HEIGHT))
468 || (y2 < 0)) 468 || (y2 < 0))
469 return; 469 return;
470 470
471 /* clipping */ 471 /* clipping */
472 if (y1 < 0) 472 if (y1 < 0)
473 y1 = 0; 473 y1 = 0;
@@ -538,18 +538,18 @@ void LCDFN(fillrect)(int x, int y, int width, int height)
538 width = CURRENT_VP->width - x; 538 width = CURRENT_VP->width - x;
539 if (y + height > CURRENT_VP->height) 539 if (y + height > CURRENT_VP->height)
540 height = CURRENT_VP->height - y; 540 height = CURRENT_VP->height - y;
541 541
542 /* adjust for viewport */ 542 /* adjust for viewport */
543 x += CURRENT_VP->x; 543 x += CURRENT_VP->x;
544 y += CURRENT_VP->y; 544 y += CURRENT_VP->y;
545 545
546#if defined(HAVE_VIEWPORT_CLIP) 546#if defined(HAVE_VIEWPORT_CLIP)
547 /********************* Viewport on screen clipping ********************/ 547 /********************* Viewport on screen clipping ********************/
548 /* nothing to draw? */ 548 /* nothing to draw? */
549 if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT)) 549 if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT))
550 || (x + width <= 0) || (y + height <= 0)) 550 || (x + width <= 0) || (y + height <= 0))
551 return; 551 return;
552 552
553 /* clip image in viewport in screen */ 553 /* clip image in viewport in screen */
554 if (x < 0) 554 if (x < 0)
555 { 555 {
@@ -646,7 +646,7 @@ void ICODE_ATTR LCDFN(bitmap_part)(const unsigned char *src, int src_x,
646 if ((width <= 0) || (height <= 0) || (x >= CURRENT_VP->width) 646 if ((width <= 0) || (height <= 0) || (x >= CURRENT_VP->width)
647 || (y >= CURRENT_VP->height) || (x + width <= 0) || (y + height <= 0)) 647 || (y >= CURRENT_VP->height) || (x + width <= 0) || (y + height <= 0))
648 return; 648 return;
649 649
650 /* clip image in viewport */ 650 /* clip image in viewport */
651 if (x < 0) 651 if (x < 0)
652 { 652 {
@@ -668,14 +668,14 @@ void ICODE_ATTR LCDFN(bitmap_part)(const unsigned char *src, int src_x,
668 /* adjust for viewport */ 668 /* adjust for viewport */
669 x += CURRENT_VP->x; 669 x += CURRENT_VP->x;
670 y += CURRENT_VP->y; 670 y += CURRENT_VP->y;
671 671
672#if defined(HAVE_VIEWPORT_CLIP) 672#if defined(HAVE_VIEWPORT_CLIP)
673 /********************* Viewport on screen clipping ********************/ 673 /********************* Viewport on screen clipping ********************/
674 /* nothing to draw? */ 674 /* nothing to draw? */
675 if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT)) 675 if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT))
676 || (x + width <= 0) || (y + height <= 0)) 676 || (x + width <= 0) || (y + height <= 0))
677 return; 677 return;
678 678
679 /* clip image in viewport in screen */ 679 /* clip image in viewport in screen */
680 if (x < 0) 680 if (x < 0)
681 { 681 {
@@ -706,7 +706,7 @@ void ICODE_ATTR LCDFN(bitmap_part)(const unsigned char *src, int src_x,
706 bfunc = LCDFN(blockfuncs)[CURRENT_VP->drawmode]; 706 bfunc = LCDFN(blockfuncs)[CURRENT_VP->drawmode];
707 mask = 0xFFu << (shift + src_y); 707 mask = 0xFFu << (shift + src_y);
708 mask_bottom = 0xFFu >> (~ny & 7); 708 mask_bottom = 0xFFu >> (~ny & 7);
709 709
710 if (shift == 0) 710 if (shift == 0)
711 { 711 {
712 bool copyopt = (CURRENT_VP->drawmode == DRMODE_SOLID); 712 bool copyopt = (CURRENT_VP->drawmode == DRMODE_SOLID);
@@ -719,9 +719,9 @@ void ICODE_ATTR LCDFN(bitmap_part)(const unsigned char *src, int src_x,
719 { 719 {
720 const unsigned char *src_row = src; 720 const unsigned char *src_row = src;
721 FBFN(data) *dst_row = dst; 721 FBFN(data) *dst_row = dst;
722 722
723 dst_end = dst_row + width; 723 dst_end = dst_row + width;
724 do 724 do
725 bfunc(dst_row++, mask, *src_row++); 725 bfunc(dst_row++, mask, *src_row++);
726 while (dst_row < dst_end); 726 while (dst_row < dst_end);
727 } 727 }
@@ -751,7 +751,7 @@ void ICODE_ATTR LCDFN(bitmap_part)(const unsigned char *src, int src_x,
751 FBFN(data) *dst_col = dst++; 751 FBFN(data) *dst_col = dst++;
752 unsigned mask_col = mask; 752 unsigned mask_col = mask;
753 unsigned data = 0; 753 unsigned data = 0;
754 754
755 for (y = ny; y >= 8; y -= 8) 755 for (y = ny; y >= 8; y -= 8)
756 { 756 {
757 data |= *src_col << shift; 757 data |= *src_col << shift;