summaryrefslogtreecommitdiff
path: root/apps/plugins
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/plugins
parentcd8151f6481f7adb3fcecdad31196e22b4bc7ee1 (diff)
downloadrockbox-83e6be56493de6f66d6c6b6d2e3f06b01bc8730d.zip
rockbox-83e6be56493de6f66d6c6b6d2e3f06b01bc8730d.tar.gz
rockbox-83e6be56493de6f66d6c6b6d2e3f06b01bc8730d.tar.bz2
rockbox-83e6be56493de6f66d6c6b6d2e3f06b01bc8730d.tar.xz
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/plugins')
-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 7ad73f6..163b3f0 100644
--- a/apps/plugins/bounce.c
+++ b/apps/plugins/bounce.c
@@ -307,14 +307,14 @@ static void init_tables(void)
int pfrac;
unsigned long phase;
long sin;
-
+
phase = pfrac = 0;
for (i = 0; i < TABLE_SIZE; i++) {
sin = fsincos(phase, NULL);
xtable[i] = RADIUS_X + sin / DIV_X;
ytable[i] = RADIUS_Y + sin / DIV_Y;
-
+
phase += PHASE_STEP;
pfrac += PHASE_FRAC;
if (pfrac >= TABLE_SIZE) {
@@ -374,9 +374,9 @@ static void init_clock(void)
int pfrac;
unsigned long phase;
long sin, cos;
-
+
phase = pfrac = 0;
-
+
for (i = 0; i < 60; i++) {
sin = fsincos(phase, &cos);
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! ;-) ";
unsigned int rocklen = rb->strlen(rock);
int letter;
+#if LCD_DEPTH > 1
+ unsigned prev_color;
+#endif
rb->lcd_clear_display();
while(1)
@@ -453,7 +456,7 @@ static int scrollit(void)
#endif
case BOUNCE_QUIT :
return 0;
- case BOUNCE_MODE :
+ case BOUNCE_MODE :
return 1;
default:
if ( rb->default_event_handler(b) == SYS_USB_CONNECTED )
@@ -464,6 +467,10 @@ static int scrollit(void)
addclock();
#endif
+#if LCD_DEPTH > 1
+ prev_color = rb->lcd_get_foreground();
+#endif
+
for(i=0, yy=y, xx=x; xx < LCD_WIDTH; i++) {
letter = rock[(i+textpos) % rocklen ];
#if LCD_DEPTH > 1
@@ -476,12 +483,12 @@ static int scrollit(void)
xx += LETTER_WIDTH;
}
#if LCD_DEPTH > 1
- rb->lcd_set_foreground(LCD_BLACK);
+ rb->lcd_set_foreground(prev_color);
#endif
rb->lcd_update();
x-= XSPEED;
-
+
if(x < -LETTER_WIDTH) {
x += LETTER_WIDTH;
y += YADD;
@@ -517,7 +524,7 @@ static int loopit(void)
return 0;
if ( b == BOUNCE_MODE )
- return 1;
+ return 1;
if ( rb->default_event_handler(b) == SYS_USB_CONNECTED )
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;
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)
h = scrollit();
} while(h > 0);
-
+
rb->lcd_set_drawmode(DRMODE_SOLID);
rb->lcd_setfont(FONT_UI);