diff options
author | Teruaki Kawashima <teru@rockbox.org> | 2010-03-06 14:14:44 +0000 |
---|---|---|
committer | Teruaki Kawashima <teru@rockbox.org> | 2010-03-06 14:14:44 +0000 |
commit | 1fbdd913337cbf235ebe3a2cf52f73b661f3b1cf (patch) | |
tree | de142d611e1912ebb315025f506535008b71f51d /apps/gui/skin_engine/skin_display.c | |
parent | f79b45d8bb30d80c453f4722b23de31db3b49bf0 (diff) | |
download | rockbox-1fbdd913337cbf235ebe3a2cf52f73b661f3b1cf.tar.gz rockbox-1fbdd913337cbf235ebe3a2cf52f73b661f3b1cf.zip |
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
Diffstat (limited to 'apps/gui/skin_engine/skin_display.c')
-rw-r--r-- | apps/gui/skin_engine/skin_display.c | 55 |
1 files changed, 27 insertions, 28 deletions
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) | |||
116 | 116 | ||
117 | static void draw_progressbar(struct gui_wps *gwps, | 117 | static void draw_progressbar(struct gui_wps *gwps, |
118 | struct skin_viewport *wps_vp) | 118 | struct skin_viewport *wps_vp) |
119 | { | 119 | { |
120 | struct screen *display = gwps->display; | 120 | struct screen *display = gwps->display; |
121 | struct wps_state *state = gwps->state; | 121 | struct wps_state *state = gwps->state; |
122 | struct progressbar *pb = wps_vp->pb; | 122 | struct progressbar *pb = wps_vp->pb; |
123 | struct mp3entry *id3 = state->id3; | 123 | struct mp3entry *id3 = state->id3; |
124 | int y = pb->y; | 124 | int y = pb->y, height = pb->height; |
125 | int height = pb->height; | 125 | unsigned long length, elapsed; |
126 | 126 | ||
127 | if (pb->height < 0 && !pb->have_bitmap_pb) | 127 | if (pb->height < 0 && !pb->have_bitmap_pb) |
128 | height = font_get(wps_vp->vp.font)->height; | 128 | height = font_get(wps_vp->vp.font)->height; |
@@ -136,39 +136,39 @@ static void draw_progressbar(struct gui_wps *gwps, | |||
136 | y = (-y -1)*line_height + (0 > center ? 0 : center); | 136 | y = (-y -1)*line_height + (0 > center ? 0 : center); |
137 | } | 137 | } |
138 | 138 | ||
139 | int elapsed, length; | 139 | if (id3 && id3->length) |
140 | if (id3) | ||
141 | { | 140 | { |
142 | elapsed = id3->elapsed; | ||
143 | length = id3->length; | 141 | length = id3->length; |
142 | elapsed = id3->elapsed + state->ff_rewind_count; | ||
144 | } | 143 | } |
145 | else | 144 | else |
146 | { | 145 | { |
146 | length = 1; | ||
147 | elapsed = 0; | 147 | elapsed = 0; |
148 | length = 0; | ||
149 | } | 148 | } |
150 | 149 | ||
151 | if (pb->have_bitmap_pb) | 150 | if (pb->have_bitmap_pb) |
152 | gui_bitmap_scrollbar_draw(display, pb->bm, | 151 | gui_bitmap_scrollbar_draw(display, pb->bm, |
153 | pb->x, y, pb->width, pb->bm.height, | 152 | pb->x, y, pb->width, pb->bm.height, |
154 | length ? length : 1, 0, | 153 | length, 0, elapsed, HORIZONTAL); |
155 | length ? elapsed + state->ff_rewind_count : 0, | ||
156 | HORIZONTAL); | ||
157 | else | 154 | else |
158 | gui_scrollbar_draw(display, pb->x, y, pb->width, height, | 155 | gui_scrollbar_draw(display, pb->x, y, pb->width, height, |
159 | length ? length : 1, 0, | 156 | length, 0, elapsed, HORIZONTAL); |
160 | length ? elapsed + state->ff_rewind_count : 0, | 157 | |
161 | HORIZONTAL); | 158 | if (id3 && id3->length) |
159 | { | ||
162 | #ifdef AB_REPEAT_ENABLE | 160 | #ifdef AB_REPEAT_ENABLE |
163 | if ( ab_repeat_mode_enabled() && length != 0 ) | 161 | if (ab_repeat_mode_enabled()) |
164 | ab_draw_markers(display, length, | 162 | ab_draw_markers(display, id3->length, |
165 | pb->x, pb->x + pb->width, y, height); | 163 | pb->x, pb->x + pb->width, y, height); |
166 | #endif | 164 | #endif |
167 | 165 | ||
168 | if (id3 && id3->cuesheet) | 166 | if (id3->cuesheet) |
169 | cue_draw_markers(display, state->id3->cuesheet, length, | 167 | cue_draw_markers(display, id3->cuesheet, id3->length, |
170 | pb->x, pb->x + pb->width, y+1, height-2); | 168 | pb->x, pb->x + pb->width, y+1, height-2); |
169 | } | ||
171 | } | 170 | } |
171 | |||
172 | bool audio_peek_track(struct mp3entry* id3, int offset); | 172 | bool audio_peek_track(struct mp3entry* id3, int offset); |
173 | static void draw_playlist_viewer_list(struct gui_wps *gwps, | 173 | static void draw_playlist_viewer_list(struct gui_wps *gwps, |
174 | struct playlistviewer *viewer) | 174 | struct playlistviewer *viewer) |
@@ -185,11 +185,10 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps, | |||
185 | struct mp3entry *pid3; | 185 | struct mp3entry *pid3; |
186 | #if CONFIG_CODEC == SWCODEC | 186 | #if CONFIG_CODEC == SWCODEC |
187 | struct mp3entry id3; | 187 | struct mp3entry id3; |
188 | #endif | 188 | #endif |
189 | char buf[MAX_PATH*2], tempbuf[MAX_PATH]; | 189 | char buf[MAX_PATH*2], tempbuf[MAX_PATH]; |
190 | unsigned int buf_used = 0; | 190 | unsigned int buf_used = 0; |
191 | 191 | ||
192 | |||
193 | gwps->display->set_viewport(viewer->vp); | 192 | gwps->display->set_viewport(viewer->vp); |
194 | for(i=start_item; (i-start_item)<lines && i<playlist_amount(); i++) | 193 | for(i=start_item; (i-start_item)<lines && i<playlist_amount(); i++) |
195 | { | 194 | { |
@@ -211,8 +210,8 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps, | |||
211 | { | 210 | { |
212 | pid3 = NULL; | 211 | pid3 = NULL; |
213 | } | 212 | } |
214 | 213 | ||
215 | int line = pid3 ? TRACK_HAS_INFO : TRACK_HAS_NO_INFO; | 214 | int line = pid3 ? TRACK_HAS_INFO : TRACK_HAS_NO_INFO; |
216 | int j = 0, cur_string = 0; | 215 | int j = 0, cur_string = 0; |
217 | char *filename = playlist_peek(i-cur_playlist_pos); | 216 | char *filename = playlist_peek(i-cur_playlist_pos); |
218 | buf[0] = '\0'; | 217 | buf[0] = '\0'; |
@@ -267,7 +266,7 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps, | |||
267 | } | 266 | } |
268 | j++; | 267 | j++; |
269 | } | 268 | } |
270 | 269 | ||
271 | int vpwidth = viewer->vp->width; | 270 | int vpwidth = viewer->vp->width; |
272 | length = gwps->display->getstringsize(buf, NULL, NULL); | 271 | length = gwps->display->getstringsize(buf, NULL, NULL); |
273 | if (viewer->lines[line].scroll && length >= vpwidth) | 272 | if (viewer->lines[line].scroll && length >= vpwidth) |
@@ -275,7 +274,7 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps, | |||
275 | gwps->display->puts_scroll(0, (i-start_item), buf ); | 274 | gwps->display->puts_scroll(0, (i-start_item), buf ); |
276 | } | 275 | } |
277 | else | 276 | else |
278 | { | 277 | { |
279 | if (length >= vpwidth) | 278 | if (length >= vpwidth) |
280 | x = 0; | 279 | x = 0; |
281 | else | 280 | else |
@@ -307,7 +306,7 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps, | |||
307 | x = 0; | 306 | x = 0; |
308 | break; | 307 | break; |
309 | } | 308 | } |
310 | } | 309 | } |
311 | gwps->display->putsxy(x, (i-start_item)*line_height, buf ); | 310 | gwps->display->putsxy(x, (i-start_item)*line_height, buf ); |
312 | } | 311 | } |
313 | } | 312 | } |
@@ -1088,8 +1087,8 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode) | |||
1088 | int i; | 1087 | int i; |
1089 | for (i = 0; i < 8; i++) | 1088 | for (i = 0; i < 8; i++) |
1090 | { | 1089 | { |
1091 | if (data->wps_progress_pat[i] == 0) | 1090 | if (data->wps_progress_pat[i] == 0) |
1092 | data->wps_progress_pat[i] = display->get_locked_pattern(); | 1091 | data->wps_progress_pat[i] = display->get_locked_pattern(); |
1093 | } | 1092 | } |
1094 | #endif | 1093 | #endif |
1095 | 1094 | ||