diff options
author | William Wilgus <wilgus.william@gmail.com> | 2020-10-26 12:38:22 -0400 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2020-10-26 12:38:22 -0400 |
commit | 40e98a2e4915464b9306ab7b0f6feb173de095c5 (patch) | |
tree | 4e987640ae4ad201f029c4e26e51ebc61a4549b1 /firmware/drivers/lcd-2bit-vert.c | |
parent | 3237ae4a4ff9296a377ff9194a11038da161208f (diff) | |
download | rockbox-40e98a2e4915464b9306ab7b0f6feb173de095c5.tar.gz rockbox-40e98a2e4915464b9306ab7b0f6feb173de095c5.zip |
Whitespace cleanup on fb_viewport Rewrite
Change-Id: I24aac41c8abecf7b78a44d7f59e842b791be4563
Diffstat (limited to 'firmware/drivers/lcd-2bit-vert.c')
-rw-r--r-- | firmware/drivers/lcd-2bit-vert.c | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/firmware/drivers/lcd-2bit-vert.c b/firmware/drivers/lcd-2bit-vert.c index a099c45e98..6a476495d0 100644 --- a/firmware/drivers/lcd-2bit-vert.c +++ b/firmware/drivers/lcd-2bit-vert.c | |||
@@ -260,7 +260,7 @@ static void ICODE_ATTR solidblock(fb_data *address, unsigned mask, | |||
260 | { | 260 | { |
261 | unsigned data = *address; | 261 | unsigned data = *address; |
262 | unsigned bgp = bg_pattern; | 262 | unsigned bgp = bg_pattern; |
263 | 263 | ||
264 | bits = bgp ^ ((bgp ^ fg_pattern) & bits); | 264 | bits = bgp ^ ((bgp ^ fg_pattern) & bits); |
265 | *address = data ^ ((data ^ bits) & mask); | 265 | *address = data ^ ((data ^ bits) & mask); |
266 | } | 266 | } |
@@ -270,7 +270,7 @@ static void ICODE_ATTR solidimgblock(fb_data *address, unsigned mask, | |||
270 | { | 270 | { |
271 | unsigned data = *address; | 271 | unsigned data = *address; |
272 | unsigned bgp = *(address + lcd_backdrop_offset); | 272 | unsigned bgp = *(address + lcd_backdrop_offset); |
273 | 273 | ||
274 | bits = bgp ^ ((bgp ^ fg_pattern) & bits); | 274 | bits = bgp ^ ((bgp ^ fg_pattern) & bits); |
275 | *address = data ^ ((data ^ bits) & mask); | 275 | *address = data ^ ((data ^ bits) & mask); |
276 | } | 276 | } |
@@ -310,7 +310,7 @@ static void ICODE_ATTR solidinvblock(fb_data *address, unsigned mask, | |||
310 | { | 310 | { |
311 | unsigned data = *address; | 311 | unsigned data = *address; |
312 | unsigned fgp = fg_pattern; | 312 | unsigned fgp = fg_pattern; |
313 | 313 | ||
314 | bits = fgp ^ ((fgp ^ bg_pattern) & bits); | 314 | bits = fgp ^ ((fgp ^ bg_pattern) & bits); |
315 | *address = data ^ ((data ^ bits) & mask); | 315 | *address = data ^ ((data ^ bits) & mask); |
316 | } | 316 | } |
@@ -320,7 +320,7 @@ static void ICODE_ATTR solidimginvblock(fb_data *address, unsigned mask, | |||
320 | { | 320 | { |
321 | unsigned data = *address; | 321 | unsigned data = *address; |
322 | unsigned fgp = fg_pattern; | 322 | unsigned fgp = fg_pattern; |
323 | 323 | ||
324 | bits = fgp ^ ((fgp ^ *(address + lcd_backdrop_offset)) & bits); | 324 | bits = fgp ^ ((fgp ^ *(address + lcd_backdrop_offset)) & bits); |
325 | *address = data ^ ((data ^ bits) & mask); | 325 | *address = data ^ ((data ^ bits) & mask); |
326 | } | 326 | } |
@@ -347,7 +347,7 @@ void lcd_set_backdrop(fb_data* backdrop) | |||
347 | lcd_pixelfuncs = lcd_pixelfuncs_backdrop; | 347 | lcd_pixelfuncs = lcd_pixelfuncs_backdrop; |
348 | lcd_blockfuncs = lcd_blockfuncs_backdrop; | 348 | lcd_blockfuncs = lcd_blockfuncs_backdrop; |
349 | } | 349 | } |
350 | else | 350 | else |
351 | { | 351 | { |
352 | lcd_backdrop_offset = 0; | 352 | lcd_backdrop_offset = 0; |
353 | lcd_pixelfuncs = lcd_pixelfuncs_bgcolor; | 353 | lcd_pixelfuncs = lcd_pixelfuncs_bgcolor; |
@@ -419,7 +419,7 @@ void lcd_clear_viewport(void) | |||
419 | /* Set a single pixel */ | 419 | /* Set a single pixel */ |
420 | void lcd_drawpixel(int x, int y) | 420 | void lcd_drawpixel(int x, int y) |
421 | { | 421 | { |
422 | if ( ((unsigned)x < (unsigned)lcd_current_viewport->width) | 422 | if ( ((unsigned)x < (unsigned)lcd_current_viewport->width) |
423 | && ((unsigned)y < (unsigned)lcd_current_viewport->height) | 423 | && ((unsigned)y < (unsigned)lcd_current_viewport->height) |
424 | #if defined(HAVE_VIEWPORT_CLIP) | 424 | #if defined(HAVE_VIEWPORT_CLIP) |
425 | && ((unsigned)x < (unsigned)LCD_WIDTH) | 425 | && ((unsigned)x < (unsigned)LCD_WIDTH) |
@@ -494,7 +494,7 @@ void lcd_drawline(int x1, int y1, int x2, int y2) | |||
494 | 494 | ||
495 | for (i = 0; i < numpixels; i++) | 495 | for (i = 0; i < numpixels; i++) |
496 | { | 496 | { |
497 | if ( ((unsigned)x < (unsigned)lcd_current_viewport->width) | 497 | if ( ((unsigned)x < (unsigned)lcd_current_viewport->width) |
498 | && ((unsigned)y < (unsigned)lcd_current_viewport->height) | 498 | && ((unsigned)y < (unsigned)lcd_current_viewport->height) |
499 | #if defined(HAVE_VIEWPORT_CLIP) | 499 | #if defined(HAVE_VIEWPORT_CLIP) |
500 | && ((unsigned)x < (unsigned)LCD_WIDTH) | 500 | && ((unsigned)x < (unsigned)LCD_WIDTH) |
@@ -534,12 +534,12 @@ void lcd_hline(int x1, int x2, int y) | |||
534 | x1 = x2; | 534 | x1 = x2; |
535 | x2 = x; | 535 | x2 = x; |
536 | } | 536 | } |
537 | 537 | ||
538 | /******************** In viewport clipping **********************/ | 538 | /******************** In viewport clipping **********************/ |
539 | /* nothing to draw? */ | 539 | /* nothing to draw? */ |
540 | if (((unsigned)y >= (unsigned)lcd_current_viewport->height) || (x1 >= lcd_current_viewport->width) | 540 | if (((unsigned)y >= (unsigned)lcd_current_viewport->height) || (x1 >= lcd_current_viewport->width) |
541 | || (x2 < 0)) | 541 | || (x2 < 0)) |
542 | return; | 542 | return; |
543 | 543 | ||
544 | if (x1 < 0) | 544 | if (x1 < 0) |
545 | x1 = 0; | 545 | x1 = 0; |
@@ -550,14 +550,14 @@ void lcd_hline(int x1, int x2, int y) | |||
550 | x1 += lcd_current_viewport->x; | 550 | x1 += lcd_current_viewport->x; |
551 | x2 += lcd_current_viewport->x; | 551 | x2 += lcd_current_viewport->x; |
552 | y += lcd_current_viewport->y; | 552 | y += lcd_current_viewport->y; |
553 | 553 | ||
554 | #if defined(HAVE_VIEWPORT_CLIP) | 554 | #if defined(HAVE_VIEWPORT_CLIP) |
555 | /********************* Viewport on screen clipping ********************/ | 555 | /********************* Viewport on screen clipping ********************/ |
556 | /* nothing to draw? */ | 556 | /* nothing to draw? */ |
557 | if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH) | 557 | if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH) |
558 | || (x2 < 0)) | 558 | || (x2 < 0)) |
559 | return; | 559 | return; |
560 | 560 | ||
561 | /* clipping */ | 561 | /* clipping */ |
562 | if (x1 < 0) | 562 | if (x1 < 0) |
563 | x1 = 0; | 563 | x1 = 0; |
@@ -598,25 +598,25 @@ void lcd_vline(int x, int y1, int y2) | |||
598 | /* nothing to draw? */ | 598 | /* nothing to draw? */ |
599 | if (((unsigned)x >= (unsigned)lcd_current_viewport->width) || (y1 >= lcd_current_viewport->height) | 599 | if (((unsigned)x >= (unsigned)lcd_current_viewport->width) || (y1 >= lcd_current_viewport->height) |
600 | || (y2 < 0)) | 600 | || (y2 < 0)) |
601 | return; | 601 | return; |
602 | 602 | ||
603 | if (y1 < 0) | 603 | if (y1 < 0) |
604 | y1 = 0; | 604 | y1 = 0; |
605 | if (y2 >= lcd_current_viewport->height) | 605 | if (y2 >= lcd_current_viewport->height) |
606 | y2 = lcd_current_viewport->height-1; | 606 | y2 = lcd_current_viewport->height-1; |
607 | 607 | ||
608 | /* adjust for viewport */ | 608 | /* adjust for viewport */ |
609 | y1 += lcd_current_viewport->y; | 609 | y1 += lcd_current_viewport->y; |
610 | y2 += lcd_current_viewport->y; | 610 | y2 += lcd_current_viewport->y; |
611 | x += lcd_current_viewport->x; | 611 | x += lcd_current_viewport->x; |
612 | 612 | ||
613 | #if defined(HAVE_VIEWPORT_CLIP) | 613 | #if defined(HAVE_VIEWPORT_CLIP) |
614 | /********************* Viewport on screen clipping ********************/ | 614 | /********************* Viewport on screen clipping ********************/ |
615 | /* nothing to draw? */ | 615 | /* nothing to draw? */ |
616 | if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT) | 616 | if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT) |
617 | || (y2 < 0)) | 617 | || (y2 < 0)) |
618 | return; | 618 | return; |
619 | 619 | ||
620 | /* clipping */ | 620 | /* clipping */ |
621 | if (y1 < 0) | 621 | if (y1 < 0) |
622 | y1 = 0; | 622 | y1 = 0; |
@@ -687,18 +687,18 @@ void lcd_fillrect(int x, int y, int width, int height) | |||
687 | width = lcd_current_viewport->width - x; | 687 | width = lcd_current_viewport->width - x; |
688 | if (y + height > lcd_current_viewport->height) | 688 | if (y + height > lcd_current_viewport->height) |
689 | height = lcd_current_viewport->height - y; | 689 | height = lcd_current_viewport->height - y; |
690 | 690 | ||
691 | /* adjust for viewport */ | 691 | /* adjust for viewport */ |
692 | x += lcd_current_viewport->x; | 692 | x += lcd_current_viewport->x; |
693 | y += lcd_current_viewport->y; | 693 | y += lcd_current_viewport->y; |
694 | 694 | ||
695 | #if defined(HAVE_VIEWPORT_CLIP) | 695 | #if defined(HAVE_VIEWPORT_CLIP) |
696 | /********************* Viewport on screen clipping ********************/ | 696 | /********************* Viewport on screen clipping ********************/ |
697 | /* nothing to draw? */ | 697 | /* nothing to draw? */ |
698 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) | 698 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) |
699 | || (x + width <= 0) || (y + height <= 0)) | 699 | || (x + width <= 0) || (y + height <= 0)) |
700 | return; | 700 | return; |
701 | 701 | ||
702 | /* clip image in viewport in screen */ | 702 | /* clip image in viewport in screen */ |
703 | if (x < 0) | 703 | if (x < 0) |
704 | { | 704 | { |
@@ -817,14 +817,14 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
817 | /* adjust for viewport */ | 817 | /* adjust for viewport */ |
818 | x += lcd_current_viewport->x; | 818 | x += lcd_current_viewport->x; |
819 | y += lcd_current_viewport->y; | 819 | y += lcd_current_viewport->y; |
820 | 820 | ||
821 | #if defined(HAVE_VIEWPORT_CLIP) | 821 | #if defined(HAVE_VIEWPORT_CLIP) |
822 | /********************* Viewport on screen clipping ********************/ | 822 | /********************* Viewport on screen clipping ********************/ |
823 | /* nothing to draw? */ | 823 | /* nothing to draw? */ |
824 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) | 824 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) |
825 | || (x + width <= 0) || (y + height <= 0)) | 825 | || (x + width <= 0) || (y + height <= 0)) |
826 | return; | 826 | return; |
827 | 827 | ||
828 | /* clip image in viewport in screen */ | 828 | /* clip image in viewport in screen */ |
829 | if (x < 0) | 829 | if (x < 0) |
830 | { | 830 | { |
@@ -856,7 +856,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
856 | mask_bottom = 0xFFFFu >> (2 * (~ny & 7)); | 856 | mask_bottom = 0xFFFFu >> (2 * (~ny & 7)); |
857 | 857 | ||
858 | bfunc = lcd_blockfuncs[lcd_current_viewport->drawmode]; | 858 | bfunc = lcd_blockfuncs[lcd_current_viewport->drawmode]; |
859 | 859 | ||
860 | if (shift == 0) | 860 | if (shift == 0) |
861 | { | 861 | { |
862 | unsigned dmask1, dmask2, data; | 862 | unsigned dmask1, dmask2, data; |
@@ -868,7 +868,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
868 | { | 868 | { |
869 | const unsigned char *src_row = src; | 869 | const unsigned char *src_row = src; |
870 | fb_data *dst_row = dst + stride_dst; | 870 | fb_data *dst_row = dst + stride_dst; |
871 | 871 | ||
872 | dst_end = dst_row + width; | 872 | dst_end = dst_row + width; |
873 | 873 | ||
874 | if (dmask1 != 0) | 874 | if (dmask1 != 0) |
@@ -895,7 +895,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
895 | /* & 0xFFu is unnecessary here - dmask1 can't exceed that*/ | 895 | /* & 0xFFu is unnecessary here - dmask1 can't exceed that*/ |
896 | dmask2 &= (mask_bottom >> 8); | 896 | dmask2 &= (mask_bottom >> 8); |
897 | dst_end = dst + width; | 897 | dst_end = dst + width; |
898 | 898 | ||
899 | if (dmask1 != 0) | 899 | if (dmask1 != 0) |
900 | { | 900 | { |
901 | if (dmask2 != 0) | 901 | if (dmask2 != 0) |
@@ -931,8 +931,8 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
931 | fb_data *dst_col = dst++; | 931 | fb_data *dst_col = dst++; |
932 | unsigned mask_col = mask; | 932 | unsigned mask_col = mask; |
933 | unsigned data = 0; | 933 | unsigned data = 0; |
934 | 934 | ||
935 | for (y = ny; y >= 8; y -= 8) | 935 | for (y = ny; y >= 8; y -= 8) |
936 | { | 936 | { |
937 | data |= *src_col << shift; | 937 | data |= *src_col << shift; |
938 | 938 | ||
@@ -995,7 +995,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
995 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) | 995 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) |
996 | || (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) | 996 | || (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) |
997 | return; | 997 | return; |
998 | 998 | ||
999 | if (x < 0) | 999 | if (x < 0) |
1000 | { | 1000 | { |
1001 | width += x; | 1001 | width += x; |
@@ -1016,14 +1016,14 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
1016 | /* adjust for viewport */ | 1016 | /* adjust for viewport */ |
1017 | x += lcd_current_viewport->x; | 1017 | x += lcd_current_viewport->x; |
1018 | y += lcd_current_viewport->y; | 1018 | y += lcd_current_viewport->y; |
1019 | 1019 | ||
1020 | #if defined(HAVE_VIEWPORT_CLIP) | 1020 | #if defined(HAVE_VIEWPORT_CLIP) |
1021 | /********************* Viewport on screen clipping ********************/ | 1021 | /********************* Viewport on screen clipping ********************/ |
1022 | /* nothing to draw? */ | 1022 | /* nothing to draw? */ |
1023 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) | 1023 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) |
1024 | || (x + width <= 0) || (y + height <= 0)) | 1024 | || (x + width <= 0) || (y + height <= 0)) |
1025 | return; | 1025 | return; |
1026 | 1026 | ||
1027 | /* clip image in viewport in screen */ | 1027 | /* clip image in viewport in screen */ |
1028 | if (x < 0) | 1028 | if (x < 0) |
1029 | { | 1029 | { |
@@ -1052,7 +1052,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
1052 | 1052 | ||
1053 | mask = 0xFFu << (2 * (shift + src_y)); | 1053 | mask = 0xFFu << (2 * (shift + src_y)); |
1054 | mask_bottom = 0xFFu >> (2 * (~ny & 3)); | 1054 | mask_bottom = 0xFFu >> (2 * (~ny & 3)); |
1055 | 1055 | ||
1056 | if (shift == 0) | 1056 | if (shift == 0) |
1057 | { | 1057 | { |
1058 | for (; ny >= 4; ny -= 4) | 1058 | for (; ny >= 4; ny -= 4) |
@@ -1063,9 +1063,9 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
1063 | { | 1063 | { |
1064 | const fb_data *src_row = src; | 1064 | const fb_data *src_row = src; |
1065 | fb_data *dst_row = dst; | 1065 | fb_data *dst_row = dst; |
1066 | 1066 | ||
1067 | dst_end = dst_row + width; | 1067 | dst_end = dst_row + width; |
1068 | do | 1068 | do |
1069 | setblock(dst_row++, mask, *src_row++); | 1069 | setblock(dst_row++, mask, *src_row++); |
1070 | while (dst_row < dst_end); | 1070 | while (dst_row < dst_end); |
1071 | } | 1071 | } |
@@ -1095,7 +1095,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
1095 | fb_data *dst_col = dst++; | 1095 | fb_data *dst_col = dst++; |
1096 | unsigned mask_col = mask; | 1096 | unsigned mask_col = mask; |
1097 | unsigned data = 0; | 1097 | unsigned data = 0; |
1098 | 1098 | ||
1099 | for (y = ny; y >= 4; y -= 4) | 1099 | for (y = ny; y >= 4; y -= 4) |
1100 | { | 1100 | { |
1101 | data |= *src_col << shift; | 1101 | data |= *src_col << shift; |