diff options
Diffstat (limited to 'firmware/drivers/lcd-16bit.c')
-rw-r--r-- | firmware/drivers/lcd-16bit.c | 98 |
1 files changed, 93 insertions, 5 deletions
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c index 96a9e1a4d7..44d468521d 100644 --- a/firmware/drivers/lcd-16bit.c +++ b/firmware/drivers/lcd-16bit.c | |||
@@ -51,9 +51,15 @@ static long lcd_backdrop_offset IDATA_ATTR = 0; | |||
51 | #if !defined(TOSHIBA_GIGABEAT_F) || defined(SIMULATOR) | 51 | #if !defined(TOSHIBA_GIGABEAT_F) || defined(SIMULATOR) |
52 | static unsigned fg_pattern IDATA_ATTR = LCD_DEFAULT_FG; | 52 | static unsigned fg_pattern IDATA_ATTR = LCD_DEFAULT_FG; |
53 | static unsigned bg_pattern IDATA_ATTR = LCD_DEFAULT_BG; | 53 | static unsigned bg_pattern IDATA_ATTR = LCD_DEFAULT_BG; |
54 | static unsigned lss_pattern IDATA_ATTR = LCD_DEFAULT_LS; | ||
55 | static unsigned lse_pattern IDATA_ATTR = LCD_DEFAULT_BG; | ||
56 | static unsigned lst_pattern IDATA_ATTR = LCD_DEFAULT_FG; | ||
54 | #else | 57 | #else |
55 | unsigned fg_pattern IDATA_ATTR = LCD_DEFAULT_FG; | 58 | unsigned fg_pattern IDATA_ATTR = LCD_DEFAULT_FG; |
56 | unsigned bg_pattern IDATA_ATTR = LCD_DEFAULT_BG; | 59 | unsigned bg_pattern IDATA_ATTR = LCD_DEFAULT_BG; |
60 | unsigned lss_pattern IDATA_ATTR = LCD_DEFAULT_LS; | ||
61 | unsigned lse_pattern IDATA_ATTR = LCD_DEFAULT_BG; | ||
62 | unsigned lst_pattern IDATA_ATTR = LCD_DEFAULT_FG; | ||
57 | #endif | 63 | #endif |
58 | 64 | ||
59 | static int drawmode = DRMODE_SOLID; | 65 | static int drawmode = DRMODE_SOLID; |
@@ -103,6 +109,21 @@ unsigned lcd_get_background(void) | |||
103 | return bg_pattern; | 109 | return bg_pattern; |
104 | } | 110 | } |
105 | 111 | ||
112 | void lcd_set_selector_start(unsigned color) | ||
113 | { | ||
114 | lss_pattern = color; | ||
115 | } | ||
116 | |||
117 | void lcd_set_selector_end(unsigned color) | ||
118 | { | ||
119 | lse_pattern = color; | ||
120 | } | ||
121 | |||
122 | void lcd_set_selector_text(unsigned color) | ||
123 | { | ||
124 | lst_pattern = color; | ||
125 | } | ||
126 | |||
106 | void lcd_set_drawinfo(int mode, unsigned fg_color, unsigned bg_color) | 127 | void lcd_set_drawinfo(int mode, unsigned fg_color, unsigned bg_color) |
107 | { | 128 | { |
108 | lcd_set_drawmode(mode); | 129 | lcd_set_drawmode(mode); |
@@ -808,16 +829,48 @@ void lcd_puts_style_offset(int x, int y, const unsigned char *str, int style, | |||
808 | ypos = ymargin + y*h; | 829 | ypos = ymargin + y*h; |
809 | drawmode = (style & STYLE_INVERT) ? | 830 | drawmode = (style & STYLE_INVERT) ? |
810 | (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; | 831 | (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; |
811 | if (style & STYLE_COLORED) { | 832 | if (style & STYLE_GRADIENT || style & STYLE_COLORBAR) { |
833 | fg_pattern = lss_pattern; | ||
834 | } | ||
835 | else if (style & STYLE_COLORED) { | ||
812 | if (drawmode == DRMODE_SOLID) | 836 | if (drawmode == DRMODE_SOLID) |
813 | fg_pattern = style & STYLE_COLOR_MASK; | 837 | fg_pattern = style & STYLE_COLOR_MASK; |
814 | else | 838 | else |
815 | bg_pattern = style & STYLE_COLOR_MASK; | 839 | bg_pattern = style & STYLE_COLOR_MASK; |
816 | } | 840 | } |
817 | lcd_putsxyofs(xpos, ypos, offset, str); | ||
818 | drawmode ^= DRMODE_INVERSEVID; | 841 | drawmode ^= DRMODE_INVERSEVID; |
819 | xrect = xpos + MAX(w - offset, 0); | 842 | xrect = xpos + MAX(w - offset, 0); |
820 | lcd_fillrect(xrect, ypos, LCD_WIDTH - xrect, h); | 843 | |
844 | if (style & STYLE_GRADIENT) { | ||
845 | int h_r = RGB_UNPACK_RED(lss_pattern) << 16; | ||
846 | int h_b = RGB_UNPACK_BLUE(lss_pattern) << 16; | ||
847 | int h_g = RGB_UNPACK_GREEN(lss_pattern) << 16; | ||
848 | int rstep = (h_r - ((signed)RGB_UNPACK_RED(lse_pattern) << 16)) / h; | ||
849 | int gstep = (h_g - ((signed)RGB_UNPACK_GREEN(lse_pattern) << 16)) / h; | ||
850 | int bstep = (h_b - ((signed)RGB_UNPACK_BLUE(lse_pattern) << 16)) / h; | ||
851 | int count; | ||
852 | |||
853 | drawmode = DRMODE_FG; | ||
854 | for(count = 0; count < h; count++) { | ||
855 | lcd_hline(xpos, LCD_WIDTH, ypos + count); | ||
856 | h_r -= rstep; | ||
857 | h_g -= gstep; | ||
858 | h_b -= bstep; | ||
859 | fg_pattern = LCD_RGBPACK(h_r >> 16, h_g >> 16, h_b >> 16); | ||
860 | } | ||
861 | fg_pattern = lst_pattern; | ||
862 | } | ||
863 | else if (style & STYLE_COLORBAR) { | ||
864 | drawmode = DRMODE_FG; | ||
865 | lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, h); | ||
866 | fg_pattern = lst_pattern; | ||
867 | } | ||
868 | else { | ||
869 | lcd_fillrect(xrect, ypos, LCD_WIDTH - xrect, h); | ||
870 | drawmode = (style & STYLE_INVERT) ? | ||
871 | (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; | ||
872 | } | ||
873 | lcd_putsxyofs(xpos, ypos, offset, str); | ||
821 | drawmode = lastmode; | 874 | drawmode = lastmode; |
822 | fg_pattern = oldfgcolor; | 875 | fg_pattern = oldfgcolor; |
823 | bg_pattern = oldbgcolor; | 876 | bg_pattern = oldbgcolor; |
@@ -852,7 +905,13 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, | |||
852 | s->start_tick = current_tick + lcd_scroll_info.delay; | 905 | s->start_tick = current_tick + lcd_scroll_info.delay; |
853 | s->invert = false; | 906 | s->invert = false; |
854 | if (style & STYLE_INVERT) { | 907 | if (style & STYLE_INVERT) { |
855 | s->invert = true; | 908 | s->invert = 1; |
909 | } | ||
910 | else if (style & STYLE_COLORBAR) { | ||
911 | s->invert = 2; | ||
912 | } | ||
913 | else if (style & STYLE_GRADIENT) { | ||
914 | s->invert = 3; | ||
856 | } | 915 | } |
857 | lcd_puts_style_offset(x,y,string,style,offset); | 916 | lcd_puts_style_offset(x,y,string,style,offset); |
858 | 917 | ||
@@ -961,8 +1020,37 @@ void lcd_scroll_fn(void) | |||
961 | } | 1020 | } |
962 | 1021 | ||
963 | lastmode = drawmode; | 1022 | lastmode = drawmode; |
964 | drawmode = s->invert ? | 1023 | drawmode = s->invert == 1 ? |
965 | (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; | 1024 | (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; |
1025 | if (s->invert == 2) { | ||
1026 | fg_pattern = lss_pattern; | ||
1027 | drawmode = DRMODE_FG; | ||
1028 | lcd_fillrect(0, ypos, LCD_WIDTH, pf->height); | ||
1029 | fg_pattern = lst_pattern; | ||
1030 | } | ||
1031 | else if (s->invert == 3) { | ||
1032 | int h_r = RGB_UNPACK_RED(lss_pattern) << 16; | ||
1033 | int h_b = RGB_UNPACK_BLUE(lss_pattern) << 16; | ||
1034 | int h_g = RGB_UNPACK_GREEN(lss_pattern) << 16; | ||
1035 | int rstep = (h_r - ((signed)RGB_UNPACK_RED(lse_pattern) << 16)) | ||
1036 | / pf->height; | ||
1037 | int gstep = (h_g - ((signed)RGB_UNPACK_GREEN(lse_pattern) << 16)) | ||
1038 | / pf->height; | ||
1039 | int bstep = (h_b - ((signed)RGB_UNPACK_BLUE(lse_pattern) << 16)) | ||
1040 | / pf->height; | ||
1041 | unsigned int count; | ||
1042 | |||
1043 | fg_pattern = lss_pattern; | ||
1044 | drawmode = DRMODE_FG; | ||
1045 | for(count = 0; count < pf->height; count++) { | ||
1046 | lcd_hline(0, LCD_WIDTH , ypos + count); | ||
1047 | h_r -= rstep; | ||
1048 | h_g -= gstep; | ||
1049 | h_b -= bstep; | ||
1050 | fg_pattern = LCD_RGBPACK(h_r >> 16, h_g >> 16, h_b >> 16); | ||
1051 | } | ||
1052 | fg_pattern = lst_pattern; | ||
1053 | } | ||
966 | lcd_putsxyofs(xpos, ypos, s->offset, s->line); | 1054 | lcd_putsxyofs(xpos, ypos, s->offset, s->line); |
967 | drawmode = lastmode; | 1055 | drawmode = lastmode; |
968 | lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height); | 1056 | lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height); |