summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2010-10-10 06:47:52 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2010-10-10 06:47:52 +0000
commit0b824da4dea91770fce0deccc3fb8040baa77b44 (patch)
treee0dc5f486a6a0519638a1c55a532adfeb94de1a4
parenta5ba1bf4fb209159ecb4082deed85724b1f02307 (diff)
downloadrockbox-0b824da4dea91770fce0deccc3fb8040baa77b44.tar.gz
rockbox-0b824da4dea91770fce0deccc3fb8040baa77b44.tar.bz2
rockbox-0b824da4dea91770fce0deccc3fb8040baa77b44.zip
fix FS#11662 and FS#11629 - skin %t() issues. %t should now work properly inside and outside of conditionals.
Remember that skins update at a rather slow speed so even if you have %t(0.2) in your skin it depends on which screen you are in for it to work (the main menu only updates at 2FPS, the WPS is 25FPS with peakmeters enabled... this is on the fixme list) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28226 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/skin_engine/skin_parser.c5
-rw-r--r--apps/gui/skin_engine/skin_render.c30
-rw-r--r--apps/gui/skin_engine/wps_internals.h3
3 files changed, 18 insertions, 20 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 50dad6feee..9475e5feb5 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -572,8 +572,6 @@ static int parse_timeout_tag(struct skin_element *element,
else
val = element->params[0].data.number;
token->value.i = val * TIMEOUT_UNIT;
- if (token->type == SKIN_TOKEN_SUBLINE_TIMEOUT)
- curr_line->timeout = token->value.i;
return 0;
}
@@ -1457,7 +1455,6 @@ static int skin_element_callback(struct skin_element* element, void* data)
struct line *line =
(struct line *)skin_buffer_alloc(sizeof(struct line));
line->update_mode = SKIN_REFRESH_STATIC;
- line->timeout = DEFAULT_SUBLINE_TIME_MULTIPLIER * TIMEOUT_UNIT;
curr_line = line;
element->data = line;
}
@@ -1468,7 +1465,7 @@ static int skin_element_callback(struct skin_element* element, void* data)
(struct line_alternator *)skin_buffer_alloc(sizeof(struct line_alternator));
alternator->current_line = 0;
#ifndef __PCTOOL__
- alternator->last_change_tick = current_tick;
+ alternator->next_change_tick = current_tick;
#endif
element->data = alternator;
}
diff --git a/apps/gui/skin_engine/skin_render.c b/apps/gui/skin_engine/skin_render.c
index baa1f82b43..304ebf140e 100644
--- a/apps/gui/skin_engine/skin_render.c
+++ b/apps/gui/skin_engine/skin_render.c
@@ -482,9 +482,13 @@ static int get_subline_timeout(struct gui_wps *gwps, struct skin_element* line)
{
struct skin_element *element=line;
struct wps_token *token;
- int retval = -1;
+ int retval = DEFAULT_SUBLINE_TIME_MULTIPLIER*TIMEOUT_UNIT;
if (element->type == LINE)
+ {
+ if (element->children_count == 0)
+ return retval; /* empty line, so force redraw */
element = element->children[0];
+ }
while (element)
{
if (element->type == TAG &&
@@ -517,27 +521,21 @@ bool skin_render_alternator(struct skin_element* element, struct skin_draw_info
unsigned old_refresh = info->refresh_type;
if (info->refresh_type == SKIN_REFRESH_ALL)
{
- alternator->current_line = 0;
- alternator->last_change_tick = current_tick;
+ alternator->current_line = element->children_count-1;
changed_lines = true;
}
- else
+ else if (TIME_AFTER(current_tick, alternator->next_change_tick))
{
- struct skin_element *current_line = element->children[alternator->current_line];
- struct line *line = (struct line *)current_line->data;
- int next_change = alternator->last_change_tick + line->timeout;
- if (TIME_AFTER(current_tick, next_change))
- {
- alternator->last_change_tick = current_tick;
- changed_lines = true;
- }
+ changed_lines = true;
}
+
if (changed_lines)
{
struct skin_element *current_line = element->children[alternator->current_line];
int start = alternator->current_line;
int try_line = start;
bool suitable = false;
+ int rettimeout = DEFAULT_SUBLINE_TIME_MULTIPLIER*TIMEOUT_UNIT;
/* find a subline which has at least one token in it,
* and that line doesnt have a timeout set to 0 through conditionals */
@@ -548,8 +546,9 @@ bool skin_render_alternator(struct skin_element* element, struct skin_draw_info
if (element->children[try_line]->children_count != 0)
{
current_line = element->children[try_line];
- if ((current_line->children[0]->type != CONDITIONAL) ||
- get_subline_timeout(info->gwps, current_line->children[0]) > 0)
+ rettimeout = get_subline_timeout(info->gwps,
+ current_line->children[0]);
+ if (rettimeout > 0)
{
suitable = true;
}
@@ -558,7 +557,10 @@ bool skin_render_alternator(struct skin_element* element, struct skin_draw_info
while (try_line != start && !suitable);
if (suitable)
+ {
alternator->current_line = try_line;
+ alternator->next_change_tick = current_tick + rettimeout;
+ }
info->refresh_type = SKIN_REFRESH_ALL;
info->force_redraw = true;
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index 5c3d953fdb..7bd74b5636 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -227,13 +227,12 @@ struct skin_albumart {
struct line {
- int timeout; /* if inside a line alternator */
unsigned update_mode;
};
struct line_alternator {
int current_line;
- unsigned long last_change_tick;
+ unsigned long next_change_tick;
};
struct conditional {