From 1fbdd913337cbf235ebe3a2cf52f73b661f3b1cf Mon Sep 17 00:00:00 2001 From: Teruaki Kawashima Date: Sat, 6 Mar 2010 14:14:44 +0000 Subject: skin: don't calculate id3->elapsed+state->ff_rewind_count each time. remove trailing spaces. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25045 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/skin_engine/skin_display.c | 55 ++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 28 deletions(-) (limited to 'apps/gui/skin_engine/skin_display.c') diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index 316b97523c..97f9ee3748 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c @@ -116,13 +116,13 @@ void skin_statusbar_changed(struct gui_wps *skin) static void draw_progressbar(struct gui_wps *gwps, struct skin_viewport *wps_vp) - { +{ struct screen *display = gwps->display; struct wps_state *state = gwps->state; struct progressbar *pb = wps_vp->pb; struct mp3entry *id3 = state->id3; - int y = pb->y; - int height = pb->height; + int y = pb->y, height = pb->height; + unsigned long length, elapsed; if (pb->height < 0 && !pb->have_bitmap_pb) height = font_get(wps_vp->vp.font)->height; @@ -136,39 +136,39 @@ static void draw_progressbar(struct gui_wps *gwps, y = (-y -1)*line_height + (0 > center ? 0 : center); } - int elapsed, length; - if (id3) + if (id3 && id3->length) { - elapsed = id3->elapsed; length = id3->length; + elapsed = id3->elapsed + state->ff_rewind_count; } else { + length = 1; elapsed = 0; - length = 0; } if (pb->have_bitmap_pb) gui_bitmap_scrollbar_draw(display, pb->bm, pb->x, y, pb->width, pb->bm.height, - length ? length : 1, 0, - length ? elapsed + state->ff_rewind_count : 0, - HORIZONTAL); + length, 0, elapsed, HORIZONTAL); else gui_scrollbar_draw(display, pb->x, y, pb->width, height, - length ? length : 1, 0, - length ? elapsed + state->ff_rewind_count : 0, - HORIZONTAL); + length, 0, elapsed, HORIZONTAL); + + if (id3 && id3->length) + { #ifdef AB_REPEAT_ENABLE - if ( ab_repeat_mode_enabled() && length != 0 ) - ab_draw_markers(display, length, - pb->x, pb->x + pb->width, y, height); + if (ab_repeat_mode_enabled()) + ab_draw_markers(display, id3->length, + pb->x, pb->x + pb->width, y, height); #endif - if (id3 && id3->cuesheet) - cue_draw_markers(display, state->id3->cuesheet, length, - pb->x, pb->x + pb->width, y+1, height-2); + if (id3->cuesheet) + cue_draw_markers(display, id3->cuesheet, id3->length, + pb->x, pb->x + pb->width, y+1, height-2); + } } + bool audio_peek_track(struct mp3entry* id3, int offset); static void draw_playlist_viewer_list(struct gui_wps *gwps, struct playlistviewer *viewer) @@ -185,11 +185,10 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps, struct mp3entry *pid3; #if CONFIG_CODEC == SWCODEC struct mp3entry id3; -#endif +#endif char buf[MAX_PATH*2], tempbuf[MAX_PATH]; unsigned int buf_used = 0; - gwps->display->set_viewport(viewer->vp); for(i=start_item; (i-start_item)vp->width; length = gwps->display->getstringsize(buf, NULL, NULL); if (viewer->lines[line].scroll && length >= vpwidth) @@ -275,7 +274,7 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps, gwps->display->puts_scroll(0, (i-start_item), buf ); } else - { + { if (length >= vpwidth) x = 0; else @@ -307,7 +306,7 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps, x = 0; break; } - } + } gwps->display->putsxy(x, (i-start_item)*line_height, buf ); } } @@ -1088,8 +1087,8 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) int i; for (i = 0; i < 8; i++) { - if (data->wps_progress_pat[i] == 0) - data->wps_progress_pat[i] = display->get_locked_pattern(); + if (data->wps_progress_pat[i] == 0) + data->wps_progress_pat[i] = display->get_locked_pattern(); } #endif -- cgit v1.2.3