diff options
Diffstat (limited to 'apps/plugins/grayscale.c')
-rw-r--r-- | apps/plugins/grayscale.c | 242 |
1 files changed, 159 insertions, 83 deletions
diff --git a/apps/plugins/grayscale.c b/apps/plugins/grayscale.c index c429485f93..55dd12aa3f 100644 --- a/apps/plugins/grayscale.c +++ b/apps/plugins/grayscale.c | |||
@@ -314,10 +314,9 @@ void grayblock(int x, int by, unsigned char* src, int stride) | |||
314 | 314 | ||
315 | "mov %2,r5 \n" | 315 | "mov %2,r5 \n" |
316 | "sub r1,r5 \n" /* r5 = depth - r1 */ | 316 | "sub r1,r5 \n" /* r5 = depth - r1 */ |
317 | "mov.l .lshrsi3,r1 \n" | ||
318 | "jsr @r1 \n" /* shift r4 right by r5 */ | ||
317 | "mov r0,r1 \n" /* last result stored in r1 */ | 319 | "mov r0,r1 \n" /* last result stored in r1 */ |
318 | "mov.l .lshrsi3,r0 \n" | ||
319 | "jsr @r0 \n" /* shift r4 right by r5 */ | ||
320 | "nop \n" | ||
321 | 320 | ||
322 | "or r1,r0 \n" /* rotated_pattern = r0 | r1 */ | 321 | "or r1,r0 \n" /* rotated_pattern = r0 | r1 */ |
323 | "mov.l r0,@-r15 \n" /* push pattern */ | 322 | "mov.l r0,@-r15 \n" /* push pattern */ |
@@ -640,8 +639,8 @@ void gray_scroll_left(int count, bool black_border); | |||
640 | void gray_scroll_right(int count, bool black_border); | 639 | void gray_scroll_right(int count, bool black_border); |
641 | void gray_scroll_up8(bool black_border); | 640 | void gray_scroll_up8(bool black_border); |
642 | void gray_scroll_down8(bool black_border); | 641 | void gray_scroll_down8(bool black_border); |
643 | void gray_scroll_up1(bool black_border); | 642 | void gray_scroll_up(int count, bool black_border); |
644 | void gray_scroll_down1(bool black_border); | 643 | void gray_scroll_down(int count, bool black_border); |
645 | 644 | ||
646 | /* pixel functions */ | 645 | /* pixel functions */ |
647 | void gray_drawpixel(int x, int y, int brightness); | 646 | void gray_drawpixel(int x, int y, int brightness); |
@@ -685,7 +684,7 @@ void gray_black_display(void) | |||
685 | rb->memset(graybuf->data, 0xFF, MULU16(graybuf->depth, graybuf->plane_size)); | 684 | rb->memset(graybuf->data, 0xFF, MULU16(graybuf->depth, graybuf->plane_size)); |
686 | } | 685 | } |
687 | 686 | ||
688 | /* Do a lcd_update() to show changes done by rb->lcd_xxx() functions (in areas | 687 | /* Do an lcd_update() to show changes done by rb->lcd_xxx() functions (in areas |
689 | * of the screen not covered by the grayscale overlay). If the grayscale | 688 | * of the screen not covered by the grayscale overlay). If the grayscale |
690 | * overlay is running, the update will be done in the next call of the | 689 | * overlay is running, the update will be done in the next call of the |
691 | * interrupt routine, otherwise it will be performed right away. See also | 690 | * interrupt routine, otherwise it will be performed right away. See also |
@@ -703,6 +702,9 @@ void gray_deferred_update(void) | |||
703 | * | 702 | * |
704 | * black_border determines if the pixels scrolled in at the right are black | 703 | * black_border determines if the pixels scrolled in at the right are black |
705 | * or white | 704 | * or white |
705 | * | ||
706 | * Scrolling left/right by an even pixel count is almost twice as fast as | ||
707 | * scrolling by an odd pixel count. | ||
706 | */ | 708 | */ |
707 | void gray_scroll_left(int count, bool black_border) | 709 | void gray_scroll_left(int count, bool black_border) |
708 | { | 710 | { |
@@ -765,6 +767,9 @@ void gray_scroll_left(int count, bool black_border) | |||
765 | * | 767 | * |
766 | * black_border determines if the pixels scrolled in at the left are black | 768 | * black_border determines if the pixels scrolled in at the left are black |
767 | * or white | 769 | * or white |
770 | * | ||
771 | * Scrolling left/right by an even pixel count is almost twice as fast as | ||
772 | * scrolling by an odd pixel count. | ||
768 | */ | 773 | */ |
769 | void gray_scroll_right(int count, bool black_border) | 774 | void gray_scroll_right(int count, bool black_border) |
770 | { | 775 | { |
@@ -791,7 +796,7 @@ void gray_scroll_right(int count, bool black_border) | |||
791 | ".sr_loop1: \n" | 796 | ".sr_loop1: \n" |
792 | "mov.b @(%2,%0),r1 \n" | 797 | "mov.b @(%2,%0),r1 \n" |
793 | "mov.b r1,@-%0 \n" | 798 | "mov.b r1,@-%0 \n" |
794 | "cmp/hs %1,%0 \n" | 799 | "cmp/hi %1,%0 \n" |
795 | "bt .sr_loop1 \n" | 800 | "bt .sr_loop1 \n" |
796 | : /* outputs */ | 801 | : /* outputs */ |
797 | : /* inputs */ | 802 | : /* inputs */ |
@@ -806,7 +811,7 @@ void gray_scroll_right(int count, bool black_border) | |||
806 | ".sr_loop2: \n" | 811 | ".sr_loop2: \n" |
807 | "mov.w @(%2,%0),r1 \n" | 812 | "mov.w @(%2,%0),r1 \n" |
808 | "mov.w r1,@-%0 \n" | 813 | "mov.w r1,@-%0 \n" |
809 | "cmp/hs %1,%0 \n" | 814 | "cmp/hi %1,%0 \n" |
810 | "bt .sr_loop2 \n" | 815 | "bt .sr_loop2 \n" |
811 | : /* outputs */ | 816 | : /* outputs */ |
812 | : /* inputs */ | 817 | : /* inputs */ |
@@ -827,6 +832,8 @@ void gray_scroll_right(int count, bool black_border) | |||
827 | * | 832 | * |
828 | * black_border determines if the pixels scrolled in at the bottom are black | 833 | * black_border determines if the pixels scrolled in at the bottom are black |
829 | * or white | 834 | * or white |
835 | * | ||
836 | * Scrolling up/down by 8 pixels is very fast. | ||
830 | */ | 837 | */ |
831 | void gray_scroll_up8(bool black_border) | 838 | void gray_scroll_up8(bool black_border) |
832 | { | 839 | { |
@@ -865,6 +872,8 @@ void gray_scroll_up8(bool black_border) | |||
865 | * | 872 | * |
866 | * black_border determines if the pixels scrolled in at the top are black | 873 | * black_border determines if the pixels scrolled in at the top are black |
867 | * or white | 874 | * or white |
875 | * | ||
876 | * Scrolling up/down by 8 pixels is very fast. | ||
868 | */ | 877 | */ |
869 | void gray_scroll_down8(bool black_border) | 878 | void gray_scroll_down8(bool black_border) |
870 | { | 879 | { |
@@ -899,7 +908,7 @@ void gray_scroll_down8(bool black_border) | |||
899 | } | 908 | } |
900 | } | 909 | } |
901 | 910 | ||
902 | /* Scroll the whole grayscale buffer up by 1 pixel | 911 | /* Scroll the whole grayscale buffer up by <count> pixels (<= 7) |
903 | * | 912 | * |
904 | * black_border determines if the pixels scrolled in at the bottom are black | 913 | * black_border determines if the pixels scrolled in at the bottom are black |
905 | * or white | 914 | * or white |
@@ -908,51 +917,84 @@ void gray_scroll_down8(bool black_border) | |||
908 | * left/right or scrolling up/down byte-wise because it involves bit | 917 | * left/right or scrolling up/down byte-wise because it involves bit |
909 | * shifting. That's why it is asm optimized. | 918 | * shifting. That's why it is asm optimized. |
910 | */ | 919 | */ |
911 | void gray_scroll_up1(bool black_border) | 920 | void gray_scroll_up(int count, bool black_border) |
912 | { | 921 | { |
913 | int filler; | 922 | unsigned long filler; |
914 | 923 | ||
915 | if (graybuf == NULL) | 924 | if (graybuf == NULL || (unsigned) count > 7) |
916 | return; | 925 | return; |
917 | 926 | ||
918 | if (black_border) | 927 | if (black_border) |
919 | filler = 1; | 928 | filler = 0xFF; |
920 | else | 929 | else |
921 | filler = 0; | 930 | filler = 0; |
922 | 931 | ||
923 | /* scroll column by column to minimize flicker */ | 932 | /* scroll column by column to minimize flicker */ |
924 | asm( | 933 | asm( |
925 | "mov #0,r6 \n" /* x = 0; */ | 934 | "mov #0,r6 \n" /* x = 0 */ |
935 | "mova .su_shifttbl,r0 \n" /* calculate jump destination for */ | ||
936 | "mov.b @(r0,%6),%6 \n" /* shift amount from table */ | ||
937 | "bra .su_cloop \n" /* skip table */ | ||
938 | "add r0,%6 \n" | ||
939 | |||
940 | ".align 2 \n" | ||
941 | ".su_shifttbl: \n" /* shift jump offset table */ | ||
942 | ".byte .su_shift0 - .su_shifttbl \n" | ||
943 | ".byte .su_shift1 - .su_shifttbl \n" | ||
944 | ".byte .su_shift2 - .su_shifttbl \n" | ||
945 | ".byte .su_shift3 - .su_shifttbl \n" | ||
946 | ".byte .su_shift4 - .su_shifttbl \n" | ||
947 | ".byte .su_shift5 - .su_shifttbl \n" | ||
948 | ".byte .su_shift6 - .su_shifttbl \n" | ||
949 | ".byte .su_shift7 - .su_shifttbl \n" | ||
926 | 950 | ||
927 | ".su_cloop: \n" /* repeat for every column */ | 951 | ".su_cloop: \n" /* repeat for every column */ |
928 | "mov %1,r7 \n" /* get start address */ | 952 | "mov %1,r2 \n" /* get start address */ |
929 | "mov #0,r1 \n" /* current_plane = 0 */ | 953 | "mov #0,r3 \n" /* current_plane = 0 */ |
930 | 954 | ||
931 | ".su_oloop: \n" /* repeat for every bitplane */ | 955 | ".su_oloop: \n" /* repeat for every bitplane */ |
932 | "mov r7,r2 \n" /* get start address */ | 956 | "mov r2,r4 \n" /* get start address */ |
933 | "mov #0,r3 \n" /* current_row = 0 */ | 957 | "mov #0,r5 \n" /* current_row = 0 */ |
934 | "mov %5,r5 \n" /* get filler bit (bit 0) */ | 958 | "mov %5,r1 \n" /* get filler bits */ |
935 | 959 | ||
936 | ".su_iloop: \n" /* repeat for all rows */ | 960 | ".su_iloop: \n" /* repeat for all rows */ |
937 | "sub %2,r2 \n" /* address -= width; */ | 961 | "sub %2,r4 \n" /* address -= width */ |
938 | "mov.b @r2,r4 \n" /* get new byte */ | 962 | "mov.b @r4,r0 \n" /* get data byte */ |
939 | "shll8 r5 \n" /* shift old lsb to bit 8 */ | 963 | "shll8 r1 \n" /* old data to 2nd byte */ |
940 | "extu.b r4,r4 \n" /* extend byte unsigned */ | 964 | "extu.b r0,r0 \n" /* extend unsigned */ |
941 | "or r5,r4 \n" /* merge old lsb */ | 965 | "or r1,r0 \n" /* combine old data */ |
942 | "shlr r4 \n" /* shift right */ | 966 | "jmp @%6 \n" /* jump into shift "path" */ |
943 | "movt r5 \n" /* save new lsb */ | 967 | "extu.b r0,r1 \n" /* store data for next round */ |
944 | "mov.b r4,@r2 \n" /* store byte */ | 968 | |
945 | "add #1,r3 \n" /* current_row++; */ | 969 | ".su_shift6: \n" /* shift right by 0..7 bits */ |
946 | "cmp/hi r3,%3 \n" /* cuurent_row < bheight ? */ | 970 | "shlr2 r0 \n" |
971 | ".su_shift4: \n" | ||
972 | "shlr2 r0 \n" | ||
973 | ".su_shift2: \n" | ||
974 | "bra .su_shift0 \n" | ||
975 | "shlr2 r0 \n" | ||
976 | ".su_shift7: \n" | ||
977 | "shlr2 r0 \n" | ||
978 | ".su_shift5: \n" | ||
979 | "shlr2 r0 \n" | ||
980 | ".su_shift3: \n" | ||
981 | "shlr2 r0 \n" | ||
982 | ".su_shift1: \n" | ||
983 | "shlr r0 \n" | ||
984 | ".su_shift0: \n" | ||
985 | |||
986 | "mov.b r0,@r4 \n" /* store data */ | ||
987 | "add #1,r5 \n" /* current_row++ */ | ||
988 | "cmp/hi r5,%3 \n" /* current_row < bheight ? */ | ||
947 | "bt .su_iloop \n" | 989 | "bt .su_iloop \n" |
948 | 990 | ||
949 | "add %4,r7 \n" /* start_address += plane_size; */ | 991 | "add %4,r2 \n" /* start_address += plane_size */ |
950 | "add #1,r1 \n" /* current_plane++; */ | 992 | "add #1,r3 \n" /* current_plane++ */ |
951 | "cmp/hi r1,%0 \n" /* current_plane < depth ? */ | 993 | "cmp/hi r3,%0 \n" /* current_plane < depth ? */ |
952 | "bt .su_oloop \n" | 994 | "bt .su_oloop \n" |
953 | 995 | ||
954 | "add #1,%1 \n" /* start_address++; */ | 996 | "add #1,%1 \n" /* start_address++ */ |
955 | "add #1,r6 \n" /* x++; */ | 997 | "add #1,r6 \n" /* x++ */ |
956 | "cmp/hi r6,%2 \n" /* x < width ? */ | 998 | "cmp/hi r6,%2 \n" /* x < width ? */ |
957 | "bt .su_cloop \n" | 999 | "bt .su_cloop \n" |
958 | : /* outputs */ | 1000 | : /* outputs */ |
@@ -962,67 +1004,100 @@ void gray_scroll_up1(bool black_border) | |||
962 | /* %2 */ "r"(graybuf->width), | 1004 | /* %2 */ "r"(graybuf->width), |
963 | /* %3 */ "r"(graybuf->bheight), | 1005 | /* %3 */ "r"(graybuf->bheight), |
964 | /* %4 */ "r"(graybuf->plane_size), | 1006 | /* %4 */ "r"(graybuf->plane_size), |
965 | /* %5 */ "r"(filler) | 1007 | /* %5 */ "r"(filler), |
1008 | /* %6 */ "r"(count) | ||
966 | : /* clobbers */ | 1009 | : /* clobbers */ |
967 | "r1", "r2", "r3", "r4", "r5", "r6", "r7" | 1010 | "r0", "r1", "r2", "r3", "r4", "r5", "r6" |
968 | ); | 1011 | ); |
969 | } | 1012 | } |
970 | 1013 | ||
971 | /* Scroll the whole grayscale buffer down by 1 pixel | 1014 | /* Scroll the whole grayscale buffer down by <count> pixels (<= 7) |
972 | * | 1015 | * |
973 | * black_border determines if the pixels scrolled in at the top are black | 1016 | * black_border determines if the pixels scrolled in at the top are black |
974 | * or white | 1017 | * or white |
975 | * | 1018 | * |
976 | * Scrolling up/down pixel-wise is significantly slower than scrolling | 1019 | * Scrolling up/down pixel-wise is significantly slower than scrolling |
977 | * left/right or scrolling up/down byte-wise because it involves bit | 1020 | * left/right or scrolling up/down byte-wise because it involves bit |
978 | * shifting. That's why it is asm optimized. Scrolling down is a bit | 1021 | * shifting. That's why it is asm optimized. |
979 | * faster than scrolling up, though. | ||
980 | */ | 1022 | */ |
981 | void gray_scroll_down1(bool black_border) | 1023 | void gray_scroll_down(int count, bool black_border) |
982 | { | 1024 | { |
983 | int filler; | 1025 | unsigned long filler; |
984 | 1026 | ||
985 | if (graybuf == NULL) | 1027 | if (graybuf == NULL || (unsigned) count > 7) |
986 | return; | 1028 | return; |
987 | 1029 | ||
988 | if (black_border) | 1030 | if (black_border) |
989 | filler = -1; /* sets bit 31 */ | 1031 | filler = 0xFF << count; /* calculate filler bits */ |
990 | else | 1032 | else |
991 | filler = 0; | 1033 | filler = 0; |
992 | 1034 | ||
993 | /* scroll column by column to minimize flicker */ | 1035 | /* scroll column by column to minimize flicker */ |
994 | asm( | 1036 | asm( |
995 | "mov #0,r5 \n" /* x = 0; */ | 1037 | "mov #0,r6 \n" /* x = 0 */ |
1038 | "mova .sd_shifttbl,r0 \n" /* calculate jump destination for */ | ||
1039 | "mov.b @(r0,%6),%6 \n" /* shift amount from table */ | ||
1040 | "bra .sd_cloop \n" /* skip table */ | ||
1041 | "add r0,%6 \n" | ||
1042 | |||
1043 | ".align 2 \n" | ||
1044 | ".sd_shifttbl: \n" /* shift jump offset table */ | ||
1045 | ".byte .sd_shift0 - .sd_shifttbl \n" | ||
1046 | ".byte .sd_shift1 - .sd_shifttbl \n" | ||
1047 | ".byte .sd_shift2 - .sd_shifttbl \n" | ||
1048 | ".byte .sd_shift3 - .sd_shifttbl \n" | ||
1049 | ".byte .sd_shift4 - .sd_shifttbl \n" | ||
1050 | ".byte .sd_shift5 - .sd_shifttbl \n" | ||
1051 | ".byte .sd_shift6 - .sd_shifttbl \n" | ||
1052 | ".byte .sd_shift7 - .sd_shifttbl \n" | ||
996 | 1053 | ||
997 | ".sd_cloop: \n" /* repeat for every column */ | 1054 | ".sd_cloop: \n" /* repeat for every column */ |
998 | "mov %1,r6 \n" /* get start address */ | 1055 | "mov %1,r2 \n" /* get start address */ |
999 | "mov #0,r1 \n" /* current_plane = 0 */ | 1056 | "mov #0,r3 \n" /* current_plane = 0 */ |
1000 | 1057 | ||
1001 | ".sd_oloop: \n" /* repeat for every bitplane */ | 1058 | ".sd_oloop: \n" /* repeat for every bitplane */ |
1002 | "mov r6,r2 \n" /* get start address */ | 1059 | "mov r2,r4 \n" /* get start address */ |
1003 | "mov #0,r3 \n" /* current_row = 0 */ | 1060 | "mov #0,r5 \n" /* current_row = 0 */ |
1004 | "mov %5,r4 \n" /* get filler bit (bit 31) */ | 1061 | "mov %5,r1 \n" /* get filler bits */ |
1005 | 1062 | ||
1006 | ".sd_iloop: \n" /* repeat for all rows */ | 1063 | ".sd_iloop: \n" /* repeat for all rows */ |
1007 | "shll r4 \n" /* get old msb (again) */ | 1064 | "shlr8 r1 \n" /* shift right to get residue */ |
1008 | /* This is possible because the sh1 loads byte data sign-extended, | 1065 | "mov.b @r4,r0 \n" /* get data byte */ |
1009 | * so the upper 25 bits of the register are all identical */ | 1066 | "jmp @%6 \n" /* jump into shift "path" */ |
1010 | "mov.b @r2,r4 \n" /* get new byte */ | 1067 | "extu.b r0,r0 \n" /* extend unsigned */ |
1011 | "add #1,r3 \n" /* current_row++; */ | 1068 | |
1012 | "rotcl r4 \n" /* rotate left, merges previous msb */ | 1069 | ".sd_shift6: \n" /* shift left by 0..7 bits */ |
1013 | "mov.b r4,@r2 \n" /* store byte */ | 1070 | "shll2 r0 \n" |
1014 | "add %2,r2 \n" /* address += width; */ | 1071 | ".sd_shift4: \n" |
1015 | "cmp/hi r3,%3 \n" /* cuurent_row < bheight ? */ | 1072 | "shll2 r0 \n" |
1073 | ".sd_shift2: \n" | ||
1074 | "bra .sd_shift0 \n" | ||
1075 | "shll2 r0 \n" | ||
1076 | ".sd_shift7: \n" | ||
1077 | "shll2 r0 \n" | ||
1078 | ".sd_shift5: \n" | ||
1079 | "shll2 r0 \n" | ||
1080 | ".sd_shift3: \n" | ||
1081 | "shll2 r0 \n" | ||
1082 | ".sd_shift1: \n" | ||
1083 | "shll r0 \n" | ||
1084 | ".sd_shift0: \n" | ||
1085 | |||
1086 | "or r0,r1 \n" /* combine with last residue */ | ||
1087 | "mov.b r1,@r4 \n" /* store data */ | ||
1088 | "add %2,r4 \n" /* address += width */ | ||
1089 | "add #1,r5 \n" /* current_row++ */ | ||
1090 | "cmp/hi r5,%3 \n" /* current_row < bheight ? */ | ||
1016 | "bt .sd_iloop \n" | 1091 | "bt .sd_iloop \n" |
1017 | 1092 | ||
1018 | "add %4,r6 \n" /* start_address += plane_size; */ | 1093 | "add %4,r2 \n" /* start_address += plane_size */ |
1019 | "add #1,r1 \n" /* current_plane++; */ | 1094 | "add #1,r3 \n" /* current_plane++ */ |
1020 | "cmp/hi r1,%0 \n" /* current_plane < depth ? */ | 1095 | "cmp/hi r3,%0 \n" /* current_plane < depth ? */ |
1021 | "bt .sd_oloop \n" | 1096 | "bt .sd_oloop \n" |
1022 | 1097 | ||
1023 | "add #1,%1 \n" /* start_address++; */ | 1098 | "add #1,%1 \n" /* start_address++ */ |
1024 | "add #1,r5 \n" /* x++ */ | 1099 | "add #1,r6 \n" /* x++ */ |
1025 | "cmp/hi r5,%2 \n" /* x < width ? */ | 1100 | "cmp/hi r6,%2 \n" /* x < width ? */ |
1026 | "bt .sd_cloop \n" | 1101 | "bt .sd_cloop \n" |
1027 | : /* outputs */ | 1102 | : /* outputs */ |
1028 | : /* inputs */ | 1103 | : /* inputs */ |
@@ -1031,9 +1106,10 @@ void gray_scroll_down1(bool black_border) | |||
1031 | /* %2 */ "r"(graybuf->width), | 1106 | /* %2 */ "r"(graybuf->width), |
1032 | /* %3 */ "r"(graybuf->bheight), | 1107 | /* %3 */ "r"(graybuf->bheight), |
1033 | /* %4 */ "r"(graybuf->plane_size), | 1108 | /* %4 */ "r"(graybuf->plane_size), |
1034 | /* %5 */ "r"(filler) | 1109 | /* %5 */ "r"(filler), |
1110 | /* %6 */ "r"(count) | ||
1035 | : /* clobbers */ | 1111 | : /* clobbers */ |
1036 | "r1", "r2", "r3", "r4", "r5", "r6" | 1112 | "r0", "r1", "r2", "r3", "r4", "r5", "r6" |
1037 | ); | 1113 | ); |
1038 | } | 1114 | } |
1039 | 1115 | ||
@@ -1437,7 +1513,7 @@ void gray_drawgraymap(unsigned char *src, int x, int y, int nx, int ny, | |||
1437 | 1513 | ||
1438 | for (yi = y; yi < y + ny; ) | 1514 | for (yi = y; yi < y + ny; ) |
1439 | { | 1515 | { |
1440 | row = src; | 1516 | row = src; |
1441 | 1517 | ||
1442 | if (!(yi & 7) && (y + ny - yi > 7)) | 1518 | if (!(yi & 7) && (y + ny - yi > 7)) |
1443 | /* current row byte aligned in fb & at least 8 rows left */ | 1519 | /* current row byte aligned in fb & at least 8 rows left */ |
@@ -1448,7 +1524,7 @@ void gray_drawgraymap(unsigned char *src, int x, int y, int nx, int ny, | |||
1448 | grayblock(xi, yi >> 3, row++, stride); | 1524 | grayblock(xi, yi >> 3, row++, stride); |
1449 | } | 1525 | } |
1450 | yi += 8; | 1526 | yi += 8; |
1451 | src += stride << 3; | 1527 | src += stride << 3; |
1452 | } | 1528 | } |
1453 | else | 1529 | else |
1454 | { | 1530 | { |
@@ -1458,7 +1534,7 @@ void gray_drawgraymap(unsigned char *src, int x, int y, int nx, int ny, | |||
1458 | graybuf->depth + 1) >> 8]); | 1534 | graybuf->depth + 1) >> 8]); |
1459 | } | 1535 | } |
1460 | yi++; | 1536 | yi++; |
1461 | src += stride; | 1537 | src += stride; |
1462 | } | 1538 | } |
1463 | } | 1539 | } |
1464 | } | 1540 | } |
@@ -1646,11 +1722,11 @@ int main(void) | |||
1646 | /* draw a dark gray line star background */ | 1722 | /* draw a dark gray line star background */ |
1647 | for (y = 0; y < 56; y += 8) /* horizontal part */ | 1723 | for (y = 0; y < 56; y += 8) /* horizontal part */ |
1648 | { | 1724 | { |
1649 | gray_drawline(0, y, 111, 55 - y, 80); /* gray lines */ | 1725 | gray_drawline(0, y, 111, 55 - y, 80); /* gray lines */ |
1650 | } | 1726 | } |
1651 | for (x = 10; x < 112; x += 10) /* vertical part */ | 1727 | for (x = 10; x < 112; x += 10) /* vertical part */ |
1652 | { | 1728 | { |
1653 | gray_drawline(x, 0, 111 - x, 55, 80); /* gray lines */ | 1729 | gray_drawline(x, 0, 111 - x, 55, 80); /* gray lines */ |
1654 | } | 1730 | } |
1655 | 1731 | ||
1656 | gray_drawrect(0, 0, 111, 55, 0); /* black border */ | 1732 | gray_drawrect(0, 0, 111, 55, 0); /* black border */ |
@@ -1658,8 +1734,8 @@ int main(void) | |||
1658 | /* draw gray tones */ | 1734 | /* draw gray tones */ |
1659 | for (i = 0; i < 86; i++) | 1735 | for (i = 0; i < 86; i++) |
1660 | { | 1736 | { |
1661 | x = 13 + i; | 1737 | x = 13 + i; |
1662 | gray_fillrect(x, 6, x, 49, 3 * i); /* gray rectangles */ | 1738 | gray_fillrect(x, 6, x, 49, 3 * i); /* gray rectangles */ |
1663 | } | 1739 | } |
1664 | 1740 | ||
1665 | gray_invertrect(13, 29, 98, 49); /* invert rectangle (lower half) */ | 1741 | gray_invertrect(13, 29, 98, 49); /* invert rectangle (lower half) */ |
@@ -1715,12 +1791,12 @@ int main(void) | |||
1715 | 1791 | ||
1716 | case BUTTON_UP: | 1792 | case BUTTON_UP: |
1717 | 1793 | ||
1718 | gray_scroll_up1(black_border); /* scroll up by 1 pixel */ | 1794 | gray_scroll_up(scroll_amount, black_border); /* scroll up */ |
1719 | break; | 1795 | break; |
1720 | 1796 | ||
1721 | case BUTTON_DOWN: | 1797 | case BUTTON_DOWN: |
1722 | 1798 | ||
1723 | gray_scroll_down1(black_border); /* scroll down by 1 pixel */ | 1799 | gray_scroll_down(scroll_amount, black_border); /* scroll down */ |
1724 | break; | 1800 | break; |
1725 | 1801 | ||
1726 | case BUTTON_OFF: | 1802 | case BUTTON_OFF: |