summaryrefslogtreecommitdiff
path: root/apps/wps-display.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-10-30 23:01:27 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-10-30 23:01:27 +0000
commita02ffd5afaa7a1a82f2da572b4c3cea01782b7c5 (patch)
tree015c75b9213e150503f37f12c300c90bd53948a9 /apps/wps-display.c
parentd2df3c01dc34157fe3c0d414df7c68687f6aaedc (diff)
downloadrockbox-a02ffd5afaa7a1a82f2da572b4c3cea01782b7c5.tar.gz
rockbox-a02ffd5afaa7a1a82f2da572b4c3cea01782b7c5.zip
Some peak meter optimizations
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2784 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/wps-display.c')
-rw-r--r--apps/wps-display.c30
1 files changed, 18 insertions, 12 deletions
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
524 char buf[MAX_PATH]; 524 char buf[MAX_PATH];
525 unsigned char flags; 525 unsigned char flags;
526 int i; 526 int i;
527 int h = font_get(FONT_UI)->height;
528 bool update_line;
527#ifdef HAVE_LCD_BITMAP 529#ifdef HAVE_LCD_BITMAP
528 /* to find out wether the peak meter is enabled we 530 /* to find out wether the peak meter is enabled we
529 assume it wasn't until we find a line that contains 531 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
544 546
545 for (i = 0; i < MAX_LINES; i++) 547 for (i = 0; i < MAX_LINES; i++)
546 { 548 {
549 update_line = false;
547 if ( !format_lines[i] ) 550 if ( !format_lines[i] )
548 break; 551 break;
549 552
@@ -559,24 +562,21 @@ bool wps_refresh(struct mp3entry* id3, int ffwd_offset, unsigned char refresh_mo
559#ifdef HAVE_LCD_CHARCELLS 562#ifdef HAVE_LCD_CHARCELLS
560 draw_player_progress(id3, ff_rewind_count); 563 draw_player_progress(id3, ff_rewind_count);
561#else 564#else
562 int w,h;
563 int offset = global_settings.statusbar ? STATUSBAR_HEIGHT : 0; 565 int offset = global_settings.statusbar ? STATUSBAR_HEIGHT : 0;
564 lcd_getstringsize("M",&w,&h);
565 slidebar(0, i*h + offset + 1, LCD_WIDTH, 6, 566 slidebar(0, i*h + offset + 1, LCD_WIDTH, 6,
566 (id3->elapsed + ff_rewind_count) * 100 / id3->length, 567 (id3->elapsed + ff_rewind_count) * 100 / id3->length,
567 Grow_Right); 568 Grow_Right);
568 continue;
569#endif 569#endif
570 } 570 update_line = true;
571 } else
571 572
572#ifdef HAVE_LCD_BITMAP 573#ifdef HAVE_LCD_BITMAP
573 /* peak meter */ 574 /* peak meter */
574 if (flags & refresh_mode & WPS_REFRESH_PEAK_METER) { 575 if (flags & refresh_mode & WPS_REFRESH_PEAK_METER) {
575 int peak_meter_y; 576 int peak_meter_y;
576 struct font *fnt = font_get(FONT_UI);
577 int h = fnt->height;
578 int offset = global_settings.statusbar ? STATUSBAR_HEIGHT : 0; 577 int offset = global_settings.statusbar ? STATUSBAR_HEIGHT : 0;
579 578
579 update_line = true;
580 peak_meter_y = i * h + offset; 580 peak_meter_y = i * h + offset;
581 581
582 /* The user might decide to have the peak meter in the last 582 /* 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
590 peak_meter_draw(0, peak_meter_y, LCD_WIDTH, 590 peak_meter_draw(0, peak_meter_y, LCD_WIDTH,
591 MIN(h, LCD_HEIGHT - peak_meter_y)); 591 MIN(h, LCD_HEIGHT - peak_meter_y));
592 } 592 }
593 continue; 593 } else
594 }
595#endif 594#endif
596 595
597 /* static line */ 596 /* scroll line */
598 if (flags & WPS_REFRESH_SCROLL) 597 if (flags & WPS_REFRESH_SCROLL)
599 { 598 {
600 if (refresh_mode & WPS_REFRESH_SCROLL) { 599 if (refresh_mode & WPS_REFRESH_SCROLL)
600 {
601 lcd_puts_scroll(0, i, buf); 601 lcd_puts_scroll(0, i, buf);
602 } 602 }
603 } 603 }
604 else 604
605 /* dynamic / static line */
606 if ((flags & refresh_mode & WPS_REFRESH_DYNAMIC) ||
607 (flags & refresh_mode & WPS_REFRESH_STATIC))
605 { 608 {
609 update_line = true;
606 lcd_puts(0, i, buf); 610 lcd_puts(0, i, buf);
607 } 611 }
608 } 612 }
613 if (update_line) {
614 lcd_update_rect(0, i * h, LCD_WIDTH, h);
615 }
609 } 616 }
610#ifdef HAVE_LCD_BITMAP 617#ifdef HAVE_LCD_BITMAP
611 /* Now we know wether the peak meter is used. 618 /* Now we know wether the peak meter is used.
612 So we can enable / disable the peak meter thread */ 619 So we can enable / disable the peak meter thread */
613 peak_meter_enabled = enable_pm; 620 peak_meter_enabled = enable_pm;
614#endif 621#endif
615 lcd_update();
616 622
617 return true; 623 return true;
618} 624}