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)
downloadrockbox-3dc50b0d74ff0eb1ef92d41ffc21a1f948c50051.tar.gz
rockbox-3dc50b0d74ff0eb1ef92d41ffc21a1f948c50051.zip
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)
205/* 205/*
206 * Print volume gauge to status bar 206 * Print volume gauge to status bar
207 */ 207 */
208void statusbar_icon_volume(int percent) 208bool statusbar_icon_volume(int percent)
209{ 209{
210 int i,j; 210 int i,j;
211 int volume; 211 int volume;
@@ -213,6 +213,8 @@ void statusbar_icon_volume(int percent)
213 int step=0; 213 int step=0;
214 char buffer[4]; 214 char buffer[4];
215 unsigned int width, height; 215 unsigned int width, height;
216 bool needs_redraw = false;
217 int type = global_settings.volume_type;
216#if defined(LOADABLE_FONTS) 218#if defined(LOADABLE_FONTS)
217 unsigned char *font; 219 unsigned char *font;
218#endif 220#endif
@@ -231,13 +233,20 @@ void statusbar_icon_volume(int percent)
231 STATUSBAR_Y_POS, 7, STATUSBAR_HEIGHT, false); 233 STATUSBAR_Y_POS, 7, STATUSBAR_HEIGHT, false);
232 } 234 }
233 else { 235 else {
236 /* We want to redraw the icon later on */
234 if (last_volume != volume && last_volume >= 0) { 237 if (last_volume != volume && last_volume >= 0) {
235 switch_tick = current_tick + HZ; 238 switch_tick = current_tick + HZ;
236 } 239 }
237 240
241 /* If the timeout hasn't yet been reached, we show it numerically
242 and tell the caller that we want to be called again */
243 if(TIME_BEFORE(current_tick,switch_tick)) {
244 type = 1;
245 needs_redraw = true;
246 }
247
238 /* display volume level numerical? */ 248 /* display volume level numerical? */
239 if (global_settings.volume_type || 249 if (type)
240 TIME_BEFORE(current_tick,switch_tick))
241 { 250 {
242 snprintf(buffer, sizeof(buffer), "%2d", percent); 251 snprintf(buffer, sizeof(buffer), "%2d", percent);
243 lcd_setfont(FONT_SYSFIXED); 252 lcd_setfont(FONT_SYSFIXED);
@@ -259,6 +268,8 @@ void statusbar_icon_volume(int percent)
259 } 268 }
260 } 269 }
261 last_volume = volume; 270 last_volume = volume;
271
272 return needs_redraw;
262} 273}
263 274
264/* 275/*
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[];
90 90
91extern void statusbar_wipe(void); 91extern void statusbar_wipe(void);
92extern void statusbar_icon_battery(int percent, bool charging); 92extern void statusbar_icon_battery(int percent, bool charging);
93extern void statusbar_icon_volume(int percent); 93extern bool statusbar_icon_volume(int percent);
94extern void statusbar_icon_play_state(int state); 94extern void statusbar_icon_play_state(int state);
95extern void statusbar_icon_play_mode(int mode); 95extern void statusbar_icon_play_mode(int mode);
96extern void statusbar_icon_shuffle(void); 96extern 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 {
54 bool shuffle; 54 bool shuffle;
55 bool keylock; 55 bool keylock;
56 bool battery_safe; 56 bool battery_safe;
57 bool redraw_volume; /* true if the volume gauge needs updating */
57}; 58};
58 59
59void status_init(void) 60void status_init(void)
@@ -158,7 +159,8 @@ void status_draw(bool force_redraw)
158 /* only redraw if forced to, or info has changed */ 159 /* only redraw if forced to, or info has changed */
159 if (force_redraw || 160 if (force_redraw ||
160 info.inserted || 161 info.inserted ||
161 !info.battery_safe || 162 !info.battery_safe ||
163 info.redraw_volume ||
162 memcmp(&info, &lastinfo, sizeof(struct status_info))) 164 memcmp(&info, &lastinfo, sizeof(struct status_info)))
163 { 165 {
164 lcd_clearrect(0,0,LCD_WIDTH,8); 166 lcd_clearrect(0,0,LCD_WIDTH,8);
@@ -213,7 +215,7 @@ void status_draw(bool force_redraw)
213 if (battery_state) 215 if (battery_state)
214 statusbar_icon_battery(info.battlevel, plug_state); 216 statusbar_icon_battery(info.battlevel, plug_state);
215 217
216 statusbar_icon_volume(info.volume); 218 info.redraw_volume = statusbar_icon_volume(info.volume);
217 statusbar_icon_play_state(current_playmode() + Icon_Play); 219 statusbar_icon_play_state(current_playmode() + Icon_Play);
218 switch (info.repeat) { 220 switch (info.repeat) {
219 case REPEAT_ONE: 221 case REPEAT_ONE: