summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-11-18 15:32:45 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-11-18 15:32:45 +0000
commit720cfe3954693618cbc50f474d2a38aabd9f5939 (patch)
treea89905cec1846fb87869d6fd40b08e359da3dcfd
parent4acae4da032ebd045456d3a625cc96ad4d4745d8 (diff)
downloadrockbox-720cfe3954693618cbc50f474d2a38aabd9f5939.zip
rockbox-720cfe3954693618cbc50f474d2a38aabd9f5939.tar.gz
rockbox-720cfe3954693618cbc50f474d2a38aabd9f5939.tar.bz2
rockbox-720cfe3954693618cbc50f474d2a38aabd9f5939.tar.xz
Improve clearing of pictures in conditional constructs. This fixes improper clearing of pictures used in several conditionals or in nested conditionals (FS#7856).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15663 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/gwps-common.c23
-rw-r--r--apps/gui/gwps.h3
-rw-r--r--apps/gui/wps_debug.c17
-rw-r--r--apps/gui/wps_parser.c5
4 files changed, 11 insertions, 37 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index ca6fd66..8491a6d 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -1390,7 +1390,7 @@ static bool evaluate_conditional(struct gui_wps *gwps, int *token_index)
struct wps_data *data = gwps->data;
- int i;
+ int i, cond_end;
int cond_index = *token_index;
char result[128], *value;
unsigned char num_options = data->tokens[cond_index].value.i & 0xFF;
@@ -1429,22 +1429,19 @@ static bool evaluate_conditional(struct gui_wps *gwps, int *token_index)
return false;
}
-#ifdef HAVE_LCD_BITMAP
- /* clear all pictures in the conditional */
- for (i = 0; i < MAX_IMAGES; i++)
+ cond_end = find_conditional_end(data, cond_index + 2);
+ for (i = cond_index + 3; i < cond_end; i++)
{
- if (data->img[i].cond_index == cond_index)
- clear_image_pos(gwps, i);
- }
+#ifdef HAVE_LCD_BITMAP
+ /* clear all pictures in the conditional and nested ones */
+ if (data->tokens[i].type == WPS_TOKEN_IMAGE_PRELOAD_DISPLAY)
+ clear_image_pos(gwps, data->tokens[i].value.i);
#endif
-
#ifdef HAVE_ALBUMART
- if (data->wps_uses_albumart != WPS_ALBUMART_NONE &&
- data->albumart_cond_index == cond_index)
- {
- draw_album_art(gwps, audio_current_aa_hid(), true);
- }
+ if (data->tokens[i].type == WPS_TOKEN_ALBUMART_DISPLAY)
+ draw_album_art(gwps, audio_current_aa_hid(), true);
#endif
+ }
return true;
}
diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h
index 56c8a6d..fd43589 100644
--- a/apps/gui/gwps.h
+++ b/apps/gui/gwps.h
@@ -66,9 +66,6 @@ struct gui_img{
bool loaded; /* load state */
bool display; /* is to be displayed */
bool always_display; /* not using the preload/display mechanism */
-
- /* the index of the conditional the image is in */
- unsigned short cond_index;
};
struct prog_img{ /*progressbar image*/
diff --git a/apps/gui/wps_debug.c b/apps/gui/wps_debug.c
index d0e0f32..4fa39dc 100644
--- a/apps/gui/wps_debug.c
+++ b/apps/gui/wps_debug.c
@@ -559,20 +559,6 @@ static void print_wps_strings(struct wps_data *data)
}
}
-#ifdef HAVE_LCD_BITMAP
-static void print_img_cond_indexes(struct wps_data *data)
-{
- DEBUGF("Image conditional indexes:\n");
- int i;
- for (i = 0; i < MAX_IMAGES; i++)
- {
- if (data->img[i].cond_index)
- DEBUGF("%2d: %d\n", i, data->img[i].cond_index);
- }
- DEBUGF("\n");
-}
-#endif /*HAVE_LCD_BITMAP */
-
void print_debug_info(struct wps_data *data, int fail, int line)
{
#if defined(SIMULATOR) || defined(__PCTOOL__)
@@ -581,9 +567,6 @@ void print_debug_info(struct wps_data *data, int fail, int line)
dump_wps_tokens(data);
print_wps_strings(data);
print_line_info(data);
-#ifdef HAVE_LCD_BITMAP
- if (wps_verbose_level > 2) print_img_cond_indexes(data);
-#endif
}
#endif /* SIMULATOR */
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index 07805f2..a0b2373 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -426,6 +426,7 @@ static int parse_image_display(const char *wps_bufptr,
struct wps_token *token,
struct wps_data *wps_data)
{
+ (void)wps_data;
int n = get_image_id(*wps_bufptr);
if (n == -1)
@@ -436,10 +437,6 @@ static int parse_image_display(const char *wps_bufptr,
token->value.i = n;
- /* if the image is in a conditional, remember it */
- if (level >= 0)
- wps_data->img[n].cond_index = condindex[level];
-
return 1;
}