1
0
Fork 0
forked from len0rd/rockbox

Fix FS #8981 (bounce color): save current forecolor before changing it so we can set it back

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17529 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Peter D'Hoye 2008-05-15 22:05:24 +00:00
parent cd8151f648
commit 83e6be5649

View file

@ -307,14 +307,14 @@ static void init_tables(void)
int pfrac; int pfrac;
unsigned long phase; unsigned long phase;
long sin; long sin;
phase = pfrac = 0; phase = pfrac = 0;
for (i = 0; i < TABLE_SIZE; i++) { for (i = 0; i < TABLE_SIZE; i++) {
sin = fsincos(phase, NULL); sin = fsincos(phase, NULL);
xtable[i] = RADIUS_X + sin / DIV_X; xtable[i] = RADIUS_X + sin / DIV_X;
ytable[i] = RADIUS_Y + sin / DIV_Y; ytable[i] = RADIUS_Y + sin / DIV_Y;
phase += PHASE_STEP; phase += PHASE_STEP;
pfrac += PHASE_FRAC; pfrac += PHASE_FRAC;
if (pfrac >= TABLE_SIZE) { if (pfrac >= TABLE_SIZE) {
@ -374,9 +374,9 @@ static void init_clock(void)
int pfrac; int pfrac;
unsigned long phase; unsigned long phase;
long sin, cos; long sin, cos;
phase = pfrac = 0; phase = pfrac = 0;
for (i = 0; i < 60; i++) { for (i = 0; i < 60; i++) {
sin = fsincos(phase, &cos); sin = fsincos(phase, &cos);
xminute[i] = LCD_WIDTH/2 + sin / DIV_MX; xminute[i] = LCD_WIDTH/2 + sin / DIV_MX;
@ -441,6 +441,9 @@ static int scrollit(void)
char* rock="Rockbox! Pure pleasure. Pure fun. Oooh. What fun! ;-) "; char* rock="Rockbox! Pure pleasure. Pure fun. Oooh. What fun! ;-) ";
unsigned int rocklen = rb->strlen(rock); unsigned int rocklen = rb->strlen(rock);
int letter; int letter;
#if LCD_DEPTH > 1
unsigned prev_color;
#endif
rb->lcd_clear_display(); rb->lcd_clear_display();
while(1) while(1)
@ -453,7 +456,7 @@ static int scrollit(void)
#endif #endif
case BOUNCE_QUIT : case BOUNCE_QUIT :
return 0; return 0;
case BOUNCE_MODE : case BOUNCE_MODE :
return 1; return 1;
default: default:
if ( rb->default_event_handler(b) == SYS_USB_CONNECTED ) if ( rb->default_event_handler(b) == SYS_USB_CONNECTED )
@ -464,6 +467,10 @@ static int scrollit(void)
addclock(); addclock();
#endif #endif
#if LCD_DEPTH > 1
prev_color = rb->lcd_get_foreground();
#endif
for(i=0, yy=y, xx=x; xx < LCD_WIDTH; i++) { for(i=0, yy=y, xx=x; xx < LCD_WIDTH; i++) {
letter = rock[(i+textpos) % rocklen ]; letter = rock[(i+textpos) % rocklen ];
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
@ -476,12 +483,12 @@ static int scrollit(void)
xx += LETTER_WIDTH; xx += LETTER_WIDTH;
} }
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
rb->lcd_set_foreground(LCD_BLACK); rb->lcd_set_foreground(prev_color);
#endif #endif
rb->lcd_update(); rb->lcd_update();
x-= XSPEED; x-= XSPEED;
if(x < -LETTER_WIDTH) { if(x < -LETTER_WIDTH) {
x += LETTER_WIDTH; x += LETTER_WIDTH;
y += YADD; y += YADD;
@ -517,7 +524,7 @@ static int loopit(void)
return 0; return 0;
if ( b == BOUNCE_MODE ) if ( b == BOUNCE_MODE )
return 1; return 1;
if ( rb->default_event_handler(b) == SYS_USB_CONNECTED ) if ( rb->default_event_handler(b) == SYS_USB_CONNECTED )
return -1; return -1;
@ -573,7 +580,8 @@ static int loopit(void)
} }
enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) enum plugin_status plugin_start(const struct plugin_api* api,
const void* parameter)
{ {
int w, h; int w, h;
char *off = "[Off] to stop"; char *off = "[Off] to stop";
@ -607,7 +615,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
if (h > 0) if (h > 0)
h = scrollit(); h = scrollit();
} while(h > 0); } while(h > 0);
rb->lcd_set_drawmode(DRMODE_SOLID); rb->lcd_set_drawmode(DRMODE_SOLID);
rb->lcd_setfont(FONT_UI); rb->lcd_setfont(FONT_UI);