From a02ffd5afaa7a1a82f2da572b4c3cea01782b7c5 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Wed, 30 Oct 2002 23:01:27 +0000 Subject: Some peak meter optimizations git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2784 a1c6a512-1295-4272-9138-f99709370657 --- apps/wps-display.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'apps/wps-display.c') diff --git a/apps/wps-display.c b/apps/wps-display.c index f8dbcde420..cfc968a3ec 100644 --- a/apps/wps-display.c +++ b/apps/wps-display.c @@ -524,6 +524,8 @@ bool wps_refresh(struct mp3entry* id3, int ffwd_offset, unsigned char refresh_mo char buf[MAX_PATH]; unsigned char flags; int i; + int h = font_get(FONT_UI)->height; + bool update_line; #ifdef HAVE_LCD_BITMAP /* to find out wether the peak meter is enabled we assume it wasn't until we find a line that contains @@ -544,6 +546,7 @@ bool wps_refresh(struct mp3entry* id3, int ffwd_offset, unsigned char refresh_mo for (i = 0; i < MAX_LINES; i++) { + update_line = false; if ( !format_lines[i] ) break; @@ -559,24 +562,21 @@ bool wps_refresh(struct mp3entry* id3, int ffwd_offset, unsigned char refresh_mo #ifdef HAVE_LCD_CHARCELLS draw_player_progress(id3, ff_rewind_count); #else - int w,h; int offset = global_settings.statusbar ? STATUSBAR_HEIGHT : 0; - lcd_getstringsize("M",&w,&h); slidebar(0, i*h + offset + 1, LCD_WIDTH, 6, (id3->elapsed + ff_rewind_count) * 100 / id3->length, Grow_Right); - continue; #endif - } + update_line = true; + } else #ifdef HAVE_LCD_BITMAP /* peak meter */ if (flags & refresh_mode & WPS_REFRESH_PEAK_METER) { int peak_meter_y; - struct font *fnt = font_get(FONT_UI); - int h = fnt->height; int offset = global_settings.statusbar ? STATUSBAR_HEIGHT : 0; + update_line = true; peak_meter_y = i * h + offset; /* The user might decide to have the peak meter in the last @@ -590,29 +590,35 @@ bool wps_refresh(struct mp3entry* id3, int ffwd_offset, unsigned char refresh_mo peak_meter_draw(0, peak_meter_y, LCD_WIDTH, MIN(h, LCD_HEIGHT - peak_meter_y)); } - continue; - } + } else #endif - /* static line */ + /* scroll line */ if (flags & WPS_REFRESH_SCROLL) { - if (refresh_mode & WPS_REFRESH_SCROLL) { + if (refresh_mode & WPS_REFRESH_SCROLL) + { lcd_puts_scroll(0, i, buf); } } - else + + /* dynamic / static line */ + if ((flags & refresh_mode & WPS_REFRESH_DYNAMIC) || + (flags & refresh_mode & WPS_REFRESH_STATIC)) { + update_line = true; lcd_puts(0, i, buf); } } + if (update_line) { + lcd_update_rect(0, i * h, LCD_WIDTH, h); + } } #ifdef HAVE_LCD_BITMAP /* Now we know wether the peak meter is used. So we can enable / disable the peak meter thread */ peak_meter_enabled = enable_pm; #endif - lcd_update(); return true; } -- cgit v1.2.3