forked from len0rd/rockbox
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
This commit is contained in:
parent
f79b45d8bb
commit
1fbdd91333
9 changed files with 77 additions and 95 deletions
|
@ -93,7 +93,7 @@ char* skin_backdrop_load(char* backdrop, char *bmpdir, enum screen_type screen)
|
|||
{
|
||||
return backdrops[i].buffer;
|
||||
}
|
||||
else if (backdrops[i].buffer == NULL)
|
||||
else if (!bdrop && backdrops[i].buffer == NULL)
|
||||
{
|
||||
bdrop = &backdrops[i];
|
||||
}
|
||||
|
@ -107,7 +107,6 @@ char* skin_backdrop_load(char* backdrop, char *bmpdir, enum screen_type screen)
|
|||
loaded = screens[screen].backdrop_load(filename, bdrop->buffer);
|
||||
bdrop->screen = screen;
|
||||
strlcpy(bdrop->name, backdrop, MAX_FILENAME+1);
|
||||
bdrop->name[MAX_FILENAME] = '\0';
|
||||
|
||||
return loaded ? bdrop->buffer : NULL;
|
||||
}
|
||||
|
@ -117,4 +116,3 @@ void skin_backdrop_init(void)
|
|||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
@ -189,7 +189,6 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps,
|
|||
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)<lines && i<playlist_amount(); i++)
|
||||
{
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -133,8 +133,3 @@ void skin_font_unload(int font_id)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -41,5 +41,4 @@ int skin_font_load(char* font_name);
|
|||
/* unload a skin font. If a font has been loaded more than once it wont actually
|
||||
* be unloaded untill all references have been unloaded */
|
||||
void skin_font_unload(int font_id);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -910,7 +910,6 @@ static int parse_viewport(const char *wps_bufptr,
|
|||
if (!skin_start_new_line(skin_vp, wps_data->num_tokens))
|
||||
return WPS_ERROR_INVALID_PARAM;
|
||||
|
||||
|
||||
if (*ptr == 'i')
|
||||
{
|
||||
skin_vp->label = VP_INFO_LABEL;
|
||||
|
@ -978,7 +977,6 @@ static int parse_image_special(const char *wps_bufptr,
|
|||
|
||||
error = (pos > newline);
|
||||
|
||||
|
||||
#if LCD_DEPTH > 1
|
||||
if (token->type == WPS_TOKEN_IMAGE_BACKDROP)
|
||||
{
|
||||
|
@ -2084,7 +2082,7 @@ static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir)
|
|||
{
|
||||
bool needed = wps_data->backdrop[0] != '-';
|
||||
wps_data->backdrop = skin_backdrop_load(wps_data->backdrop,
|
||||
bmpdir, curr_screen);
|
||||
bmpdir, curr_screen);
|
||||
if (!wps_data->backdrop && needed)
|
||||
retval = false;
|
||||
}
|
||||
|
|
|
@ -158,6 +158,8 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
|
|||
struct wps_state *state = &wps_state;
|
||||
if (id3)
|
||||
{
|
||||
unsigned long length = id3->length;
|
||||
unsigned long elapsed = id3->elapsed + state->ff_rewind_count;
|
||||
switch (token->type)
|
||||
{
|
||||
case WPS_TOKEN_METADATA_ARTIST:
|
||||
|
@ -226,31 +228,26 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
|
|||
return "?";
|
||||
return buf;
|
||||
case WPS_TOKEN_TRACK_TIME_ELAPSED:
|
||||
format_time(buf, buf_size,
|
||||
id3->elapsed + state->ff_rewind_count);
|
||||
format_time(buf, buf_size, elapsed);
|
||||
return buf;
|
||||
|
||||
case WPS_TOKEN_TRACK_TIME_REMAINING:
|
||||
format_time(buf, buf_size,
|
||||
id3->length - id3->elapsed -
|
||||
state->ff_rewind_count);
|
||||
format_time(buf, buf_size, length - elapsed);
|
||||
return buf;
|
||||
|
||||
case WPS_TOKEN_TRACK_LENGTH:
|
||||
format_time(buf, buf_size, id3->length);
|
||||
format_time(buf, buf_size, length);
|
||||
return buf;
|
||||
|
||||
case WPS_TOKEN_TRACK_ELAPSED_PERCENT:
|
||||
if (id3->length <= 0)
|
||||
if (length <= 0)
|
||||
return NULL;
|
||||
|
||||
if (intval)
|
||||
{
|
||||
*intval = limit * (id3->elapsed + state->ff_rewind_count)
|
||||
/ id3->length + 1;
|
||||
*intval = limit * elapsed / length + 1;
|
||||
}
|
||||
snprintf(buf, buf_size, "%d",
|
||||
100*(id3->elapsed + state->ff_rewind_count) / id3->length);
|
||||
snprintf(buf, buf_size, "%d", 100 * elapsed / length);
|
||||
return buf;
|
||||
|
||||
|
||||
|
@ -443,7 +440,8 @@ const char *get_token_value(struct gui_wps *gwps,
|
|||
snprintf(buf, buf_size, "%d", global_settings.volume);
|
||||
if (intval)
|
||||
{
|
||||
if (global_settings.volume == sound_min(SOUND_VOLUME))
|
||||
int minvol = sound_min(SOUND_VOLUME);
|
||||
if (global_settings.volume == minvol)
|
||||
{
|
||||
*intval = 1;
|
||||
}
|
||||
|
@ -457,9 +455,8 @@ const char *get_token_value(struct gui_wps *gwps,
|
|||
}
|
||||
else
|
||||
{
|
||||
*intval = (limit - 3) * (global_settings.volume
|
||||
- sound_min(SOUND_VOLUME) - 1)
|
||||
/ (-1 - sound_min(SOUND_VOLUME)) + 2;
|
||||
*intval = (limit-3) * (global_settings.volume - minvol - 1)
|
||||
/ (-1 - minvol) + 2;
|
||||
}
|
||||
}
|
||||
return buf;
|
||||
|
@ -1053,7 +1050,7 @@ const char *get_token_value(struct gui_wps *gwps,
|
|||
#else /* HWCODEC */
|
||||
|
||||
static const char * const freq_strings[] =
|
||||
{"--", "44", "48", "32", "22", "24", "16"};
|
||||
{"--", "44", "48", "32", "22", "24", "16"};
|
||||
int freq = 1 + global_settings.rec_frequency;
|
||||
#ifdef HAVE_SPDIF_REC
|
||||
if (global_settings.rec_source == AUDIO_SRC_SPDIF)
|
||||
|
@ -1201,7 +1198,6 @@ const char *get_token_value(struct gui_wps *gwps,
|
|||
}
|
||||
if (intval)
|
||||
{
|
||||
|
||||
*intval = curr_screen;
|
||||
}
|
||||
snprintf(buf, buf_size, "%d", curr_screen);
|
||||
|
|
|
@ -244,4 +244,3 @@ struct skin_token_list {
|
|||
char* get_dir(char* buf, int buf_size, const char* path, int level);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -500,7 +500,7 @@ static char *get_token_desc(struct wps_token *token, char *buf,
|
|||
break;
|
||||
case WPS_TOKEN_SETTING:
|
||||
snprintf(buf, bufsize, "Setting value: '%s'",
|
||||
settings[token->value.i].cfg_name);
|
||||
settings[token->value.i].cfg_name);
|
||||
break;
|
||||
case WPS_TOKEN_LANG_IS_RTL:
|
||||
snprintf(buf, bufsize, "lang: is_rtl?");
|
||||
|
@ -649,5 +649,4 @@ void debug_skin_usage(void)
|
|||
(unsigned long)(skin_buffer_usage() + skin_buffer_freespace()));
|
||||
}
|
||||
|
||||
|
||||
#endif /* DEBUG || SIMULATOR */
|
||||
|
|
|
@ -247,7 +247,6 @@ struct playlistviewer {
|
|||
};
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_ALBUMART
|
||||
struct skin_albumart {
|
||||
/* Album art support */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue