diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2007-06-22 04:30:08 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2007-06-22 04:30:08 +0000 |
commit | 6e21c146f80b17e158f3f13f84afab2978367917 (patch) | |
tree | 09b0cd972476c8e3dbf48867bd19deba34580b99 /firmware/drivers | |
parent | 49af12a5ba760a011a8f6e1547fb30b8f30c1ac0 (diff) | |
download | rockbox-6e21c146f80b17e158f3f13f84afab2978367917.tar.gz rockbox-6e21c146f80b17e158f3f13f84afab2978367917.zip |
Fix FS#7336 - scrolling lines don't stay coloured.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13682 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/lcd-16bit.c | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c index 16c97c9e99..f03cab3877 100644 --- a/firmware/drivers/lcd-16bit.c +++ b/firmware/drivers/lcd-16bit.c | |||
@@ -807,7 +807,8 @@ void lcd_puts_style_offset(int x, int y, const unsigned char *str, int style, | |||
807 | { | 807 | { |
808 | int xpos,ypos,w,h,xrect; | 808 | int xpos,ypos,w,h,xrect; |
809 | int lastmode = drawmode; | 809 | int lastmode = drawmode; |
810 | int oldcolor = fg_pattern; | 810 | int oldfgcolor = fg_pattern; |
811 | int oldbgcolor = bg_pattern; | ||
811 | 812 | ||
812 | /* make sure scrolling is turned off on the line we are updating */ | 813 | /* make sure scrolling is turned off on the line we are updating */ |
813 | scrolling_lines &= ~(1 << y); | 814 | scrolling_lines &= ~(1 << y); |
@@ -820,15 +821,19 @@ void lcd_puts_style_offset(int x, int y, const unsigned char *str, int style, | |||
820 | ypos = ymargin + y*h; | 821 | ypos = ymargin + y*h; |
821 | drawmode = (style & STYLE_INVERT) ? | 822 | drawmode = (style & STYLE_INVERT) ? |
822 | (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; | 823 | (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; |
823 | if (drawmode == DRMODE_SOLID && style & STYLE_COLORED) { | 824 | if (style & STYLE_COLORED) { |
824 | fg_pattern = style & STYLE_COLOR_MASK; | 825 | if (drawmode == DRMODE_SOLID) |
826 | fg_pattern = style & STYLE_COLOR_MASK; | ||
827 | else | ||
828 | bg_pattern = style & STYLE_COLOR_MASK; | ||
825 | } | 829 | } |
826 | lcd_putsxyofs(xpos, ypos, offset, str); | 830 | lcd_putsxyofs(xpos, ypos, offset, str); |
827 | drawmode ^= DRMODE_INVERSEVID; | 831 | drawmode ^= DRMODE_INVERSEVID; |
828 | xrect = xpos + MAX(w - offset, 0); | 832 | xrect = xpos + MAX(w - offset, 0); |
829 | lcd_fillrect(xrect, ypos, LCD_WIDTH - xrect, h); | 833 | lcd_fillrect(xrect, ypos, LCD_WIDTH - xrect, h); |
830 | drawmode = lastmode; | 834 | drawmode = lastmode; |
831 | fg_pattern = oldcolor; | 835 | fg_pattern = oldfgcolor; |
836 | bg_pattern = oldbgcolor; | ||
832 | } | 837 | } |
833 | 838 | ||
834 | /*** scrolling ***/ | 839 | /*** scrolling ***/ |
@@ -938,6 +943,8 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, | |||
938 | s->offset = offset; | 943 | s->offset = offset; |
939 | s->startx = xmargin + x * s->width / s->len; | 944 | s->startx = xmargin + x * s->width / s->len; |
940 | s->backward = false; | 945 | s->backward = false; |
946 | s->line_colour = (style&STYLE_COLORED)? | ||
947 | (style&STYLE_COLOR_MASK): -1; | ||
941 | scrolling_lines |= (1<<y); | 948 | scrolling_lines |= (1<<y); |
942 | } | 949 | } |
943 | else | 950 | else |
@@ -952,6 +959,7 @@ static void scroll_thread(void) | |||
952 | int index; | 959 | int index; |
953 | int xpos, ypos; | 960 | int xpos, ypos; |
954 | int lastmode; | 961 | int lastmode; |
962 | unsigned old_bgcolour, old_fgcolour; | ||
955 | 963 | ||
956 | /* initialize scroll struct array */ | 964 | /* initialize scroll struct array */ |
957 | scrolling_lines = 0; | 965 | scrolling_lines = 0; |
@@ -961,17 +969,31 @@ static void scroll_thread(void) | |||
961 | sleep(scroll_ticks); | 969 | sleep(scroll_ticks); |
962 | continue; | 970 | continue; |
963 | } | 971 | } |
972 | old_fgcolour = lcd_get_foreground(); | ||
973 | old_bgcolour = lcd_get_background(); | ||
964 | for ( index = 0; index < SCROLLABLE_LINES; index++ ) { | 974 | for ( index = 0; index < SCROLLABLE_LINES; index++ ) { |
965 | /* really scroll? */ | 975 | /* really scroll? */ |
966 | if ( !(scrolling_lines&(1<<index)) ) | 976 | if ( !(scrolling_lines&(1<<index)) ) |
967 | continue; | 977 | continue; |
968 | 978 | ||
969 | s = &scroll[index]; | 979 | s = &scroll[index]; |
970 | |||
971 | /* check pause */ | 980 | /* check pause */ |
972 | if (TIME_BEFORE(current_tick, s->start_tick)) | 981 | if (TIME_BEFORE(current_tick, s->start_tick)) |
973 | continue; | 982 | continue; |
974 | 983 | if (s->line_colour >= 0) | |
984 | { | ||
985 | if (s->invert) | ||
986 | { | ||
987 | lcd_set_foreground(old_fgcolour); | ||
988 | lcd_set_background(s->line_colour); | ||
989 | } | ||
990 | else | ||
991 | { | ||
992 | lcd_set_foreground(s->line_colour); | ||
993 | lcd_set_background(old_bgcolour); | ||
994 | } | ||
995 | } | ||
996 | |||
975 | if (s->backward) | 997 | if (s->backward) |
976 | s->offset -= scroll_step; | 998 | s->offset -= scroll_step; |
977 | else | 999 | else |
@@ -1008,7 +1030,8 @@ static void scroll_thread(void) | |||
1008 | drawmode = lastmode; | 1030 | drawmode = lastmode; |
1009 | lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height); | 1031 | lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height); |
1010 | } | 1032 | } |
1011 | 1033 | lcd_set_foreground(old_fgcolour); | |
1034 | lcd_set_background(old_bgcolour); | ||
1012 | sleep(scroll_ticks); | 1035 | sleep(scroll_ticks); |
1013 | } | 1036 | } |
1014 | } | 1037 | } |