summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorPeter D'Hoye <peter.dhoye@gmail.com>2008-05-15 22:05:24 +0000
committerPeter D'Hoye <peter.dhoye@gmail.com>2008-05-15 22:05:24 +0000
commit83e6be56493de6f66d6c6b6d2e3f06b01bc8730d (patch)
treea6b14f3aee85e705c022a37744a07d97d4249fd6 /apps
parentcd8151f6481f7adb3fcecdad31196e22b4bc7ee1 (diff)
downloadrockbox-83e6be56493de6f66d6c6b6d2e3f06b01bc8730d.tar.gz
rockbox-83e6be56493de6f66d6c6b6d2e3f06b01bc8730d.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/bounce.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/apps/plugins/bounce.c b/apps/plugins/bounce.c
index 7ad73f6aa4..163b3f0d45 100644
--- a/apps/plugins/bounce.c
+++ b/apps/plugins/bounce.c
@@ -307,14 +307,14 @@ static void init_tables(void)
307 int pfrac; 307 int pfrac;
308 unsigned long phase; 308 unsigned long phase;
309 long sin; 309 long sin;
310 310
311 phase = pfrac = 0; 311 phase = pfrac = 0;
312 312
313 for (i = 0; i < TABLE_SIZE; i++) { 313 for (i = 0; i < TABLE_SIZE; i++) {
314 sin = fsincos(phase, NULL); 314 sin = fsincos(phase, NULL);
315 xtable[i] = RADIUS_X + sin / DIV_X; 315 xtable[i] = RADIUS_X + sin / DIV_X;
316 ytable[i] = RADIUS_Y + sin / DIV_Y; 316 ytable[i] = RADIUS_Y + sin / DIV_Y;
317 317
318 phase += PHASE_STEP; 318 phase += PHASE_STEP;
319 pfrac += PHASE_FRAC; 319 pfrac += PHASE_FRAC;
320 if (pfrac >= TABLE_SIZE) { 320 if (pfrac >= TABLE_SIZE) {
@@ -374,9 +374,9 @@ static void init_clock(void)
374 int pfrac; 374 int pfrac;
375 unsigned long phase; 375 unsigned long phase;
376 long sin, cos; 376 long sin, cos;
377 377
378 phase = pfrac = 0; 378 phase = pfrac = 0;
379 379
380 for (i = 0; i < 60; i++) { 380 for (i = 0; i < 60; i++) {
381 sin = fsincos(phase, &cos); 381 sin = fsincos(phase, &cos);
382 xminute[i] = LCD_WIDTH/2 + sin / DIV_MX; 382 xminute[i] = LCD_WIDTH/2 + sin / DIV_MX;
@@ -441,6 +441,9 @@ static int scrollit(void)
441 char* rock="Rockbox! Pure pleasure. Pure fun. Oooh. What fun! ;-) "; 441 char* rock="Rockbox! Pure pleasure. Pure fun. Oooh. What fun! ;-) ";
442 unsigned int rocklen = rb->strlen(rock); 442 unsigned int rocklen = rb->strlen(rock);
443 int letter; 443 int letter;
444#if LCD_DEPTH > 1
445 unsigned prev_color;
446#endif
444 447
445 rb->lcd_clear_display(); 448 rb->lcd_clear_display();
446 while(1) 449 while(1)
@@ -453,7 +456,7 @@ static int scrollit(void)
453#endif 456#endif
454 case BOUNCE_QUIT : 457 case BOUNCE_QUIT :
455 return 0; 458 return 0;
456 case BOUNCE_MODE : 459 case BOUNCE_MODE :
457 return 1; 460 return 1;
458 default: 461 default:
459 if ( rb->default_event_handler(b) == SYS_USB_CONNECTED ) 462 if ( rb->default_event_handler(b) == SYS_USB_CONNECTED )
@@ -464,6 +467,10 @@ static int scrollit(void)
464 addclock(); 467 addclock();
465#endif 468#endif
466 469
470#if LCD_DEPTH > 1
471 prev_color = rb->lcd_get_foreground();
472#endif
473
467 for(i=0, yy=y, xx=x; xx < LCD_WIDTH; i++) { 474 for(i=0, yy=y, xx=x; xx < LCD_WIDTH; i++) {
468 letter = rock[(i+textpos) % rocklen ]; 475 letter = rock[(i+textpos) % rocklen ];
469#if LCD_DEPTH > 1 476#if LCD_DEPTH > 1
@@ -476,12 +483,12 @@ static int scrollit(void)
476 xx += LETTER_WIDTH; 483 xx += LETTER_WIDTH;
477 } 484 }
478#if LCD_DEPTH > 1 485#if LCD_DEPTH > 1
479 rb->lcd_set_foreground(LCD_BLACK); 486 rb->lcd_set_foreground(prev_color);
480#endif 487#endif
481 rb->lcd_update(); 488 rb->lcd_update();
482 489
483 x-= XSPEED; 490 x-= XSPEED;
484 491
485 if(x < -LETTER_WIDTH) { 492 if(x < -LETTER_WIDTH) {
486 x += LETTER_WIDTH; 493 x += LETTER_WIDTH;
487 y += YADD; 494 y += YADD;
@@ -517,7 +524,7 @@ static int loopit(void)
517 return 0; 524 return 0;
518 525
519 if ( b == BOUNCE_MODE ) 526 if ( b == BOUNCE_MODE )
520 return 1; 527 return 1;
521 528
522 if ( rb->default_event_handler(b) == SYS_USB_CONNECTED ) 529 if ( rb->default_event_handler(b) == SYS_USB_CONNECTED )
523 return -1; 530 return -1;
@@ -573,7 +580,8 @@ static int loopit(void)
573} 580}
574 581
575 582
576enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) 583enum plugin_status plugin_start(const struct plugin_api* api,
584 const void* parameter)
577{ 585{
578 int w, h; 586 int w, h;
579 char *off = "[Off] to stop"; 587 char *off = "[Off] to stop";
@@ -607,7 +615,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
607 if (h > 0) 615 if (h > 0)
608 h = scrollit(); 616 h = scrollit();
609 } while(h > 0); 617 } while(h > 0);
610 618
611 rb->lcd_set_drawmode(DRMODE_SOLID); 619 rb->lcd_set_drawmode(DRMODE_SOLID);
612 rb->lcd_setfont(FONT_UI); 620 rb->lcd_setfont(FONT_UI);
613 621