diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-10-16 19:14:41 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-10-16 19:14:41 +0000 |
commit | e9c10189e93fe53cff74ae8fa15d19b1c522d5e4 (patch) | |
tree | e3c39a41ff160194dfd9ce617893e0367a6fdcc8 /apps/gui/skin_engine | |
parent | a72ffe7bb533302dbf4e6c7c4f1e4bd4078d3ed6 (diff) | |
download | rockbox-e9c10189e93fe53cff74ae8fa15d19b1c522d5e4.tar.gz rockbox-e9c10189e93fe53cff74ae8fa15d19b1c522d5e4.zip |
Rework albumart buffering internally to allow for mutliple albumart sizes.
Playback now has a few albumart slots. Anything (most importantly: skins) can obtain such a slot.
The slot has fields for the size which is passed to bufopen then to image_load to buffer the albumart with the proper size.
Currently there's 1 slot. We can increase it for remotes if we want. Custom statusbar will increase it.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23209 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/skin_engine')
-rw-r--r-- | apps/gui/skin_engine/skin_display.c | 6 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 21 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_tokens.c | 5 | ||||
-rw-r--r-- | apps/gui/skin_engine/wps_internals.h | 1 |
4 files changed, 29 insertions, 4 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index 67984cd2bb..a5ea28619a 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c | |||
@@ -259,7 +259,8 @@ static void wps_display_images(struct gui_wps *gwps, struct viewport* vp) | |||
259 | if (data->albumart && data->albumart->vp == vp | 259 | if (data->albumart && data->albumart->vp == vp |
260 | && data->albumart->draw) | 260 | && data->albumart->draw) |
261 | { | 261 | { |
262 | draw_album_art(gwps, audio_current_aa_hid(), false); | 262 | draw_album_art(gwps, playback_current_aa_hid(data->playback_aa_slot), |
263 | false); | ||
263 | data->albumart->draw = false; | 264 | data->albumart->draw = false; |
264 | } | 265 | } |
265 | #endif | 266 | #endif |
@@ -486,7 +487,8 @@ static bool evaluate_conditional(struct gui_wps *gwps, int *token_index) | |||
486 | #ifdef HAVE_ALBUMART | 487 | #ifdef HAVE_ALBUMART |
487 | if (data->albumart && data->tokens[i].type == WPS_TOKEN_ALBUMART_DISPLAY) | 488 | if (data->albumart && data->tokens[i].type == WPS_TOKEN_ALBUMART_DISPLAY) |
488 | { | 489 | { |
489 | draw_album_art(gwps, audio_current_aa_hid(), true); | 490 | draw_album_art(gwps, |
491 | playback_current_aa_hid(data->playback_aa_slot), true); | ||
490 | data->albumart->draw = false; | 492 | data->albumart->draw = false; |
491 | } | 493 | } |
492 | #endif | 494 | #endif |
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 016126bffb..fa35ed994f 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c | |||
@@ -56,6 +56,10 @@ | |||
56 | #include "bmp.h" | 56 | #include "bmp.h" |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | #ifdef HAVE_ALBUMART | ||
60 | #include "playback.h" | ||
61 | #endif | ||
62 | |||
59 | #include "backdrop.h" | 63 | #include "backdrop.h" |
60 | 64 | ||
61 | #define WPS_ERROR_INVALID_PARAM -1 | 65 | #define WPS_ERROR_INVALID_PARAM -1 |
@@ -985,6 +989,8 @@ static int parse_albumart_load(const char *wps_bufptr, | |||
985 | { | 989 | { |
986 | const char *_pos, *newline; | 990 | const char *_pos, *newline; |
987 | bool parsing; | 991 | bool parsing; |
992 | struct dim dimensions; | ||
993 | int albumart_slot; | ||
988 | struct skin_albumart *aa = skin_buffer_alloc(sizeof(struct skin_albumart)); | 994 | struct skin_albumart *aa = skin_buffer_alloc(sizeof(struct skin_albumart)); |
989 | (void)token; /* silence warning */ | 995 | (void)token; /* silence warning */ |
990 | if (!aa) | 996 | if (!aa) |
@@ -1125,6 +1131,16 @@ static int parse_albumart_load(const char *wps_bufptr, | |||
1125 | aa->draw = false; | 1131 | aa->draw = false; |
1126 | wps_data->albumart = aa; | 1132 | wps_data->albumart = aa; |
1127 | 1133 | ||
1134 | dimensions.width = aa->width; | ||
1135 | dimensions.height = aa->height; | ||
1136 | |||
1137 | albumart_slot = playback_claim_aa_slot(&dimensions); | ||
1138 | |||
1139 | if (albumart_slot < 0) /* didn't get a slot ? */ | ||
1140 | return skip_end_of_line(wps_bufptr); | ||
1141 | else | ||
1142 | wps_data->playback_aa_slot = albumart_slot; | ||
1143 | |||
1128 | /* Skip the rest of the line */ | 1144 | /* Skip the rest of the line */ |
1129 | return skip_end_of_line(wps_bufptr); | 1145 | return skip_end_of_line(wps_bufptr); |
1130 | } | 1146 | } |
@@ -1601,6 +1617,11 @@ void skin_data_reset(struct wps_data *wps_data) | |||
1601 | wps_data->strings = NULL; | 1617 | wps_data->strings = NULL; |
1602 | #ifdef HAVE_ALBUMART | 1618 | #ifdef HAVE_ALBUMART |
1603 | wps_data->albumart = NULL; | 1619 | wps_data->albumart = NULL; |
1620 | if (wps_data->playback_aa_slot >= 0) | ||
1621 | { | ||
1622 | playback_release_aa_slot(wps_data->playback_aa_slot); | ||
1623 | wps_data->playback_aa_slot = -1; | ||
1624 | } | ||
1604 | #endif | 1625 | #endif |
1605 | wps_data->tokens = NULL; | 1626 | wps_data->tokens = NULL; |
1606 | wps_data->num_tokens = 0; | 1627 | wps_data->num_tokens = 0; |
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index d607538f0f..6b29091fe6 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c | |||
@@ -368,8 +368,9 @@ const char *get_token_value(struct gui_wps *gwps, | |||
368 | 368 | ||
369 | #ifdef HAVE_ALBUMART | 369 | #ifdef HAVE_ALBUMART |
370 | case WPS_TOKEN_ALBUMART_FOUND: | 370 | case WPS_TOKEN_ALBUMART_FOUND: |
371 | if (data->albumart && audio_current_aa_hid() >= 0) { | 371 | if (data->albumart) { |
372 | return "C"; | 372 | if (playback_current_aa_hid(data->playback_aa_slot) >= 0) |
373 | return "C"; | ||
373 | } | 374 | } |
374 | return NULL; | 375 | return NULL; |
375 | 376 | ||
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h index 7a4fdddc7c..638fb0a081 100644 --- a/apps/gui/skin_engine/wps_internals.h +++ b/apps/gui/skin_engine/wps_internals.h | |||
@@ -255,6 +255,7 @@ struct wps_data | |||
255 | struct skin_token_list *strings; | 255 | struct skin_token_list *strings; |
256 | #ifdef HAVE_ALBUMART | 256 | #ifdef HAVE_ALBUMART |
257 | struct skin_albumart *albumart; | 257 | struct skin_albumart *albumart; |
258 | int playback_aa_slot; | ||
258 | #endif | 259 | #endif |
259 | struct wps_token *tokens; | 260 | struct wps_token *tokens; |
260 | /* Total number of tokens in the WPS. During WPS parsing, this is | 261 | /* Total number of tokens in the WPS. During WPS parsing, this is |