summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-07-13 06:59:11 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-07-13 06:59:11 +0000
commit3dc50b0d74ff0eb1ef92d41ffc21a1f948c50051 (patch)
tree2e8f46f9fefa017644d0e626c1446905badeb0e1
parentea598c7b667057ad42c21eda8f57f368b897495d (diff)
Fixed the slow status bar update in bug report #727790.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4868 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/recorder/icons.c17
-rw-r--r--apps/recorder/icons.h2
-rw-r--r--apps/status.c6
3 files changed, 19 insertions, 6 deletions
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c
index 6e0ff73fc8..b831e59f53 100644
--- a/apps/recorder/icons.c
+++ b/apps/recorder/icons.c
@@ -205,7 +205,7 @@ void statusbar_icon_battery(int percent, bool charging)
/*
* Print volume gauge to status bar
*/
-void statusbar_icon_volume(int percent)
+bool statusbar_icon_volume(int percent)
{
int i,j;
int volume;
@@ -213,6 +213,8 @@ void statusbar_icon_volume(int percent)
int step=0;
char buffer[4];
unsigned int width, height;
+ bool needs_redraw = false;
+ int type = global_settings.volume_type;
#if defined(LOADABLE_FONTS)
unsigned char *font;
#endif
@@ -231,13 +233,20 @@ void statusbar_icon_volume(int percent)
STATUSBAR_Y_POS, 7, STATUSBAR_HEIGHT, false);
}
else {
+ /* We want to redraw the icon later on */
if (last_volume != volume && last_volume >= 0) {
switch_tick = current_tick + HZ;
}
+ /* If the timeout hasn't yet been reached, we show it numerically
+ and tell the caller that we want to be called again */
+ if(TIME_BEFORE(current_tick,switch_tick)) {
+ type = 1;
+ needs_redraw = true;
+ }
+
/* display volume level numerical? */
- if (global_settings.volume_type ||
- TIME_BEFORE(current_tick,switch_tick))
+ if (type)
{
snprintf(buffer, sizeof(buffer), "%2d", percent);
lcd_setfont(FONT_SYSFIXED);
@@ -259,6 +268,8 @@ void statusbar_icon_volume(int percent)
}
}
last_volume = volume;
+
+ return needs_redraw;
}
/*
diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h
index 3b4947aca7..afea0b1ae4 100644
--- a/apps/recorder/icons.h
+++ b/apps/recorder/icons.h
@@ -90,7 +90,7 @@ extern unsigned char slider_bar[];
extern void statusbar_wipe(void);
extern void statusbar_icon_battery(int percent, bool charging);
-extern void statusbar_icon_volume(int percent);
+extern bool statusbar_icon_volume(int percent);
extern void statusbar_icon_play_state(int state);
extern void statusbar_icon_play_mode(int mode);
extern void statusbar_icon_shuffle(void);
diff --git a/apps/status.c b/apps/status.c
index af6eaa4e2a..8c4a7ef809 100644
--- a/apps/status.c
+++ b/apps/status.c
@@ -54,6 +54,7 @@ struct status_info {
bool shuffle;
bool keylock;
bool battery_safe;
+ bool redraw_volume; /* true if the volume gauge needs updating */
};
void status_init(void)
@@ -158,7 +159,8 @@ void status_draw(bool force_redraw)
/* only redraw if forced to, or info has changed */
if (force_redraw ||
info.inserted ||
- !info.battery_safe ||
+ !info.battery_safe ||
+ info.redraw_volume ||
memcmp(&info, &lastinfo, sizeof(struct status_info)))
{
lcd_clearrect(0,0,LCD_WIDTH,8);
@@ -213,7 +215,7 @@ void status_draw(bool force_redraw)
if (battery_state)
statusbar_icon_battery(info.battlevel, plug_state);
- statusbar_icon_volume(info.volume);
+ info.redraw_volume = statusbar_icon_volume(info.volume);
statusbar_icon_play_state(current_playmode() + Icon_Play);
switch (info.repeat) {
case REPEAT_ONE: