summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-11-12 01:31:42 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-11-12 01:31:42 +0000
commit81dedee7d050e2b52dfe1a294dbd349c4fe79155 (patch)
tree23cd47d71b9f6aead2d3d83b0b0131a36f806709
parent49639257677ab98dc4730bebf1044ea1ca7591b0 (diff)
downloadrockbox-81dedee7d050e2b52dfe1a294dbd349c4fe79155.tar.gz
rockbox-81dedee7d050e2b52dfe1a294dbd349c4fe79155.zip
Various album art improvements:
* Make the album art display tag static instead of dynamic, making it be drawn less often, which is good. * Add the possibility of clearing the album art bitmap instead of drawing it, and use this abaility when the display tag is inside a conditional construct. * Add the album art display tag to wps_debug.c. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15592 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/gwps-common.c7
-rw-r--r--apps/gui/gwps.h2
-rw-r--r--apps/gui/wps_debug.c9
-rw-r--r--apps/gui/wps_parser.c6
-rw-r--r--apps/recorder/albumart.c25
-rw-r--r--apps/recorder/albumart.h5
6 files changed, 43 insertions, 11 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 3c29884260..00505afbed 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -932,7 +932,7 @@ static char *get_token_value(struct gui_wps *gwps,
932 932
933#ifdef HAVE_ALBUMART 933#ifdef HAVE_ALBUMART
934 case WPS_TOKEN_ALBUMART_DISPLAY: 934 case WPS_TOKEN_ALBUMART_DISPLAY:
935 draw_album_art(gwps, audio_current_aa_hid()); 935 draw_album_art(gwps, audio_current_aa_hid(), false);
936 return NULL; 936 return NULL;
937 937
938 case WPS_TOKEN_ALBUMART_FOUND: 938 case WPS_TOKEN_ALBUMART_FOUND:
@@ -1418,6 +1418,11 @@ static int evaluate_conditional(struct gui_wps *gwps, int cond_index)
1418 } 1418 }
1419#endif 1419#endif
1420 1420
1421#ifdef HAVE_ALBUMART
1422 if (data->albumart_cond_index == cond_index)
1423 draw_album_art(gwps, audio_current_aa_hid(), true);
1424#endif
1425
1421 return ret; 1426 return ret;
1422} 1427}
1423 1428
diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h
index 391fc72943..f57656b0ae 100644
--- a/apps/gui/gwps.h
+++ b/apps/gui/gwps.h
@@ -344,6 +344,8 @@ struct wps_data
344 + .._INCREASE, + .._DECREASE */ 344 + .._INCREASE, + .._DECREASE */
345 short albumart_max_width; 345 short albumart_max_width;
346 short albumart_max_height; 346 short albumart_max_height;
347
348 int albumart_cond_index;
347#endif 349#endif
348 350
349#else /*HAVE_LCD_CHARCELLS */ 351#else /*HAVE_LCD_CHARCELLS */
diff --git a/apps/gui/wps_debug.c b/apps/gui/wps_debug.c
index 58e6ab49aa..883626d040 100644
--- a/apps/gui/wps_debug.c
+++ b/apps/gui/wps_debug.c
@@ -214,6 +214,15 @@ static void dump_wps_tokens(struct wps_data *data)
214 break; 214 break;
215#endif 215#endif
216 216
217#ifdef HAVE_ALBUMART
218 case WPS_TOKEN_ALBUMART_DISPLAY:
219 snprintf(buf, sizeof(buf), "album art display at x=%d, y=%d, "
220 "maxwidth=%d, maxheight=%d", data->albumart_x,
221 data->albumart_y, data->albumart_max_width,
222 data->albumart_max_height);
223 break;
224#endif
225
217#ifdef HAVE_LCD_BITMAP 226#ifdef HAVE_LCD_BITMAP
218 case WPS_TOKEN_IMAGE_BACKDROP: 227 case WPS_TOKEN_IMAGE_BACKDROP:
219 snprintf(buf, sizeof(buf), "backdrop image"); 228 snprintf(buf, sizeof(buf), "backdrop image");
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index 097a60c90f..86bd096e8c 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -293,7 +293,7 @@ static const struct wps_tag all_tags[] = {
293 { WPS_TOKEN_IMAGE_PROGRESS_BAR, "P", 0, parse_image_special }, 293 { WPS_TOKEN_IMAGE_PROGRESS_BAR, "P", 0, parse_image_special },
294#ifdef HAVE_ALBUMART 294#ifdef HAVE_ALBUMART
295 { WPS_NO_TOKEN, "Cl", 0, parse_albumart_load }, 295 { WPS_NO_TOKEN, "Cl", 0, parse_albumart_load },
296 { WPS_TOKEN_ALBUMART_DISPLAY, "C", WPS_REFRESH_DYNAMIC, 296 { WPS_TOKEN_ALBUMART_DISPLAY, "C", WPS_REFRESH_STATIC,
297 parse_albumart_conditional }, 297 parse_albumart_conditional },
298#endif 298#endif
299#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) 299#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1))
@@ -824,7 +824,11 @@ static int parse_albumart_conditional(const char *wps_bufptr,
824 } 824 }
825 } 825 }
826 else 826 else
827 {
828 /* This %C tag is in a conditional construct. */
829 wps_data->albumart_cond_index = condindex[level];
827 return 0; 830 return 0;
831 }
828}; 832};
829#endif /* HAVE_ALBUMART */ 833#endif /* HAVE_ALBUMART */
830 834
diff --git a/apps/recorder/albumart.c b/apps/recorder/albumart.c
index abae8c1afc..2722b57f8a 100644
--- a/apps/recorder/albumart.c
+++ b/apps/recorder/albumart.c
@@ -231,8 +231,9 @@ bool find_albumart(const struct mp3entry *id3, char *buf, int buflen)
231 return search_files(id3, size_string, buf, buflen); 231 return search_files(id3, size_string, buf, buflen);
232} 232}
233 233
234/* Draw the album art bitmap from the given handle ID onto the given WPS. */ 234/* Draw the album art bitmap from the given handle ID onto the given WPS.
235void draw_album_art(struct gui_wps *gwps, int handle_id) 235 Call with clear = true to clear the bitmap instead of drawing it. */
236void draw_album_art(struct gui_wps *gwps, int handle_id, bool clear)
236{ 237{
237 if (!gwps || !gwps->data || !gwps->display || handle_id < 0) 238 if (!gwps || !gwps->data || !gwps->display || handle_id < 0)
238 return; 239 return;
@@ -277,9 +278,19 @@ void draw_album_art(struct gui_wps *gwps, int handle_id)
277 y += (data->albumart_max_height - height) / 2; 278 y += (data->albumart_max_height - height) / 2;
278 } 279 }
279 280
280 /* Draw the bitmap */ 281 if (!clear)
281 gwps->display->set_drawmode(DRMODE_FG); 282 {
282 gwps->display->bitmap_part((fb_data*)bmp->data, 0, 0, bmp->width, 283 /* Draw the bitmap */
283 x, y, width, height); 284 gwps->display->set_drawmode(DRMODE_FG);
284 gwps->display->set_drawmode(DRMODE_SOLID); 285 gwps->display->bitmap_part((fb_data*)bmp->data, 0, 0, bmp->width,
286 x, y, width, height);
287 gwps->display->set_drawmode(DRMODE_SOLID);
288 }
289 else
290 {
291 /* Clear the bitmap */
292 gwps->display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
293 gwps->display->fillrect(x, y, width, height);
294 gwps->display->set_drawmode(DRMODE_SOLID);
295 }
285} 296}
diff --git a/apps/recorder/albumart.h b/apps/recorder/albumart.h
index 21ae50edb9..dcd106465b 100644
--- a/apps/recorder/albumart.h
+++ b/apps/recorder/albumart.h
@@ -31,8 +31,9 @@
31 * Returns true if a bitmap was found, false otherwise */ 31 * Returns true if a bitmap was found, false otherwise */
32bool find_albumart(const struct mp3entry *id3, char *buf, int buflen); 32bool find_albumart(const struct mp3entry *id3, char *buf, int buflen);
33 33
34/* Draw the album art bitmap from the given handle ID onto the given WPS. */ 34/* Draw the album art bitmap from the given handle ID onto the given WPS.
35void draw_album_art(struct gui_wps *gwps, int handle_id); 35 Call with clear = true to clear the bitmap instead of drawing it. */
36void draw_album_art(struct gui_wps *gwps, int handle_id, bool clear);
36 37
37#endif /* HAVE_ALBUMART */ 38#endif /* HAVE_ALBUMART */
38 39