mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 21:25:19 -05:00
rework AA load/display handling in the skins to get them working in viewports again
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22646 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
8898339fcf
commit
fe2f042670
8 changed files with 138 additions and 108 deletions
|
|
@ -77,6 +77,9 @@ void skin_data_init(struct wps_data *wps_data)
|
||||||
wps_data->peak_meter_enabled = false;
|
wps_data->peak_meter_enabled = false;
|
||||||
wps_data->images = NULL;
|
wps_data->images = NULL;
|
||||||
wps_data->progressbars = NULL;
|
wps_data->progressbars = NULL;
|
||||||
|
#ifdef HAVE_ALBUMART
|
||||||
|
wps_data->albumart = NULL;
|
||||||
|
#endif
|
||||||
/* progress bars */
|
/* progress bars */
|
||||||
#else /* HAVE_LCD_CHARCELLS */
|
#else /* HAVE_LCD_CHARCELLS */
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -265,6 +268,14 @@ static void wps_display_images(struct gui_wps *gwps, struct viewport* vp)
|
||||||
}
|
}
|
||||||
list = list->next;
|
list = list->next;
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_ALBUMART
|
||||||
|
/* now draw the AA */
|
||||||
|
if (data->albumart && data->albumart->vp == vp && data->albumart->draw)
|
||||||
|
{
|
||||||
|
draw_album_art(gwps, audio_current_aa_hid(), false);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
display->set_drawmode(DRMODE_SOLID);
|
display->set_drawmode(DRMODE_SOLID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -465,8 +476,11 @@ static bool evaluate_conditional(struct gui_wps *gwps, int *token_index)
|
||||||
clear_image_pos(gwps, find_image(data->tokens[i].value.i&0xFF, gwps->data));
|
clear_image_pos(gwps, find_image(data->tokens[i].value.i&0xFF, gwps->data));
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_ALBUMART
|
#ifdef HAVE_ALBUMART
|
||||||
if (data->tokens[i].type == WPS_TOKEN_ALBUMART_DISPLAY)
|
if (data->albumart && data->tokens[i].type == WPS_TOKEN_ALBUMART_DISPLAY)
|
||||||
|
{
|
||||||
draw_album_art(gwps, audio_current_aa_hid(), true);
|
draw_album_art(gwps, audio_current_aa_hid(), true);
|
||||||
|
data->albumart->draw = false;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -961,9 +975,9 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
|
||||||
skin_viewport->hidden_flags |= VP_DRAW_HIDDEN;
|
skin_viewport->hidden_flags |= VP_DRAW_HIDDEN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int viewport_count = 0;
|
||||||
for (viewport_list = data->viewports;
|
for (viewport_list = data->viewports;
|
||||||
viewport_list; viewport_list = viewport_list->next)
|
viewport_list; viewport_list = viewport_list->next, viewport_count++)
|
||||||
{
|
{
|
||||||
struct skin_viewport *skin_viewport =
|
struct skin_viewport *skin_viewport =
|
||||||
(struct skin_viewport *)viewport_list->token->value.data;
|
(struct skin_viewport *)viewport_list->token->value.data;
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ static int parse_image_special(const char *wps_bufptr,
|
||||||
#ifdef HAVE_ALBUMART
|
#ifdef HAVE_ALBUMART
|
||||||
static int parse_albumart_load(const char *wps_bufptr,
|
static int parse_albumart_load(const char *wps_bufptr,
|
||||||
struct wps_token *token, struct wps_data *wps_data);
|
struct wps_token *token, struct wps_data *wps_data);
|
||||||
static int parse_albumart_conditional(const char *wps_bufptr,
|
static int parse_albumart_display(const char *wps_bufptr,
|
||||||
struct wps_token *token, struct wps_data *wps_data);
|
struct wps_token *token, struct wps_data *wps_data);
|
||||||
#endif /* HAVE_ALBUMART */
|
#endif /* HAVE_ALBUMART */
|
||||||
#ifdef HAVE_TOUCHSCREEN
|
#ifdef HAVE_TOUCHSCREEN
|
||||||
|
|
@ -337,8 +337,7 @@ static const struct wps_tag all_tags[] = {
|
||||||
{ WPS_TOKEN_IMAGE_DISPLAY, "x", 0, parse_image_load },
|
{ WPS_TOKEN_IMAGE_DISPLAY, "x", 0, parse_image_load },
|
||||||
#ifdef HAVE_ALBUMART
|
#ifdef HAVE_ALBUMART
|
||||||
{ WPS_NO_TOKEN, "Cl", 0, parse_albumart_load },
|
{ WPS_NO_TOKEN, "Cl", 0, parse_albumart_load },
|
||||||
{ WPS_TOKEN_ALBUMART_DISPLAY, "C", WPS_REFRESH_STATIC,
|
{ WPS_TOKEN_ALBUMART_DISPLAY, "C", WPS_REFRESH_STATIC, parse_albumart_display },
|
||||||
parse_albumart_conditional },
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{ WPS_VIEWPORT_ENABLE, "Vd", WPS_REFRESH_DYNAMIC,
|
{ WPS_VIEWPORT_ENABLE, "Vd", WPS_REFRESH_DYNAMIC,
|
||||||
|
|
@ -960,13 +959,17 @@ static int parse_albumart_load(const char *wps_bufptr,
|
||||||
{
|
{
|
||||||
const char *_pos, *newline;
|
const char *_pos, *newline;
|
||||||
bool parsing;
|
bool parsing;
|
||||||
|
struct skin_albumart *aa = skin_buffer_alloc(sizeof(struct skin_albumart));
|
||||||
(void)token; /* silence warning */
|
(void)token; /* silence warning */
|
||||||
|
if (!aa)
|
||||||
|
return skip_end_of_line(wps_bufptr);
|
||||||
|
|
||||||
/* reset albumart info in wps */
|
/* reset albumart info in wps */
|
||||||
wps_data->albumart_max_width = -1;
|
aa->albumart_max_width = -1;
|
||||||
wps_data->albumart_max_height = -1;
|
aa->albumart_max_height = -1;
|
||||||
wps_data->albumart_xalign = WPS_ALBUMART_ALIGN_CENTER; /* default */
|
aa->albumart_xalign = WPS_ALBUMART_ALIGN_CENTER; /* default */
|
||||||
wps_data->albumart_yalign = WPS_ALBUMART_ALIGN_CENTER; /* default */
|
aa->albumart_yalign = WPS_ALBUMART_ALIGN_CENTER; /* default */
|
||||||
|
aa->vp = &curr_vp->vp;
|
||||||
|
|
||||||
/* format: %Cl|x|y|[[l|c|r]mwidth]|[[t|c|b]mheight]| */
|
/* format: %Cl|x|y|[[l|c|r]mwidth]|[[t|c|b]mheight]| */
|
||||||
|
|
||||||
|
|
@ -979,13 +982,13 @@ static int parse_albumart_load(const char *wps_bufptr,
|
||||||
_pos = wps_bufptr + 1;
|
_pos = wps_bufptr + 1;
|
||||||
if (!isdigit(*_pos))
|
if (!isdigit(*_pos))
|
||||||
return WPS_ERROR_INVALID_PARAM; /* malformed token: e.g. %Cl|@ */
|
return WPS_ERROR_INVALID_PARAM; /* malformed token: e.g. %Cl|@ */
|
||||||
wps_data->albumart_x = atoi(_pos);
|
aa->albumart_x = atoi(_pos);
|
||||||
|
|
||||||
_pos = strchr(_pos, '|');
|
_pos = strchr(_pos, '|');
|
||||||
if (!_pos || _pos > newline || !isdigit(*(++_pos)))
|
if (!_pos || _pos > newline || !isdigit(*(++_pos)))
|
||||||
return WPS_ERROR_INVALID_PARAM; /* malformed token: e.g. %Cl|7\n or %Cl|7|@ */
|
return WPS_ERROR_INVALID_PARAM; /* malformed token: e.g. %Cl|7\n or %Cl|7|@ */
|
||||||
|
|
||||||
wps_data->albumart_y = atoi(_pos);
|
aa->albumart_y = atoi(_pos);
|
||||||
|
|
||||||
_pos = strchr(_pos, '|');
|
_pos = strchr(_pos, '|');
|
||||||
if (!_pos || _pos > newline)
|
if (!_pos || _pos > newline)
|
||||||
|
|
@ -1003,16 +1006,16 @@ static int parse_albumart_load(const char *wps_bufptr,
|
||||||
case 'l':
|
case 'l':
|
||||||
case 'L':
|
case 'L':
|
||||||
case '+':
|
case '+':
|
||||||
wps_data->albumart_xalign = WPS_ALBUMART_ALIGN_LEFT;
|
aa->albumart_xalign = WPS_ALBUMART_ALIGN_LEFT;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
case 'C':
|
case 'C':
|
||||||
wps_data->albumart_xalign = WPS_ALBUMART_ALIGN_CENTER;
|
aa->albumart_xalign = WPS_ALBUMART_ALIGN_CENTER;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
case 'R':
|
case 'R':
|
||||||
case '-':
|
case '-':
|
||||||
wps_data->albumart_xalign = WPS_ALBUMART_ALIGN_RIGHT;
|
aa->albumart_xalign = WPS_ALBUMART_ALIGN_RIGHT;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
case 'D':
|
case 'D':
|
||||||
|
|
@ -1033,7 +1036,7 @@ static int parse_albumart_load(const char *wps_bufptr,
|
||||||
if (!isdigit(*_pos)) /* malformed token: e.g. %Cl|7|59|# */
|
if (!isdigit(*_pos)) /* malformed token: e.g. %Cl|7|59|# */
|
||||||
return WPS_ERROR_INVALID_PARAM;
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
|
|
||||||
wps_data->albumart_max_width = atoi(_pos);
|
aa->albumart_max_width = atoi(_pos);
|
||||||
|
|
||||||
_pos = strchr(_pos, '|');
|
_pos = strchr(_pos, '|');
|
||||||
if (!_pos || _pos > newline)
|
if (!_pos || _pos > newline)
|
||||||
|
|
@ -1052,16 +1055,16 @@ static int parse_albumart_load(const char *wps_bufptr,
|
||||||
case 't':
|
case 't':
|
||||||
case 'T':
|
case 'T':
|
||||||
case '-':
|
case '-':
|
||||||
wps_data->albumart_yalign = WPS_ALBUMART_ALIGN_TOP;
|
aa->albumart_yalign = WPS_ALBUMART_ALIGN_TOP;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
case 'C':
|
case 'C':
|
||||||
wps_data->albumart_yalign = WPS_ALBUMART_ALIGN_CENTER;
|
aa->albumart_yalign = WPS_ALBUMART_ALIGN_CENTER;
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
case 'B':
|
case 'B':
|
||||||
case '+':
|
case '+':
|
||||||
wps_data->albumart_yalign = WPS_ALBUMART_ALIGN_BOTTOM;
|
aa->albumart_yalign = WPS_ALBUMART_ALIGN_BOTTOM;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
case 'D':
|
case 'D':
|
||||||
|
|
@ -1082,7 +1085,7 @@ static int parse_albumart_load(const char *wps_bufptr,
|
||||||
if (!isdigit(*_pos))
|
if (!isdigit(*_pos))
|
||||||
return WPS_ERROR_INVALID_PARAM; /* malformed token e.g. %Cl|7|59|200|@ */
|
return WPS_ERROR_INVALID_PARAM; /* malformed token e.g. %Cl|7|59|200|@ */
|
||||||
|
|
||||||
wps_data->albumart_max_height = atoi(_pos);
|
aa->albumart_max_height = atoi(_pos);
|
||||||
|
|
||||||
_pos = strchr(_pos, '|');
|
_pos = strchr(_pos, '|');
|
||||||
if (!_pos || _pos > newline)
|
if (!_pos || _pos > newline)
|
||||||
|
|
@ -1091,54 +1094,41 @@ static int parse_albumart_load(const char *wps_bufptr,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we got here, we parsed everything ok .. ! */
|
/* if we got here, we parsed everything ok .. ! */
|
||||||
if (wps_data->albumart_max_width < 0)
|
if (aa->albumart_max_width < 0)
|
||||||
wps_data->albumart_max_width = 0;
|
aa->albumart_max_width = 0;
|
||||||
else if (wps_data->albumart_max_width > LCD_WIDTH)
|
else if (aa->albumart_max_width > LCD_WIDTH)
|
||||||
wps_data->albumart_max_width = LCD_WIDTH;
|
aa->albumart_max_width = LCD_WIDTH;
|
||||||
|
|
||||||
if (wps_data->albumart_max_height < 0)
|
if (aa->albumart_max_height < 0)
|
||||||
wps_data->albumart_max_height = 0;
|
aa->albumart_max_height = 0;
|
||||||
else if (wps_data->albumart_max_height > LCD_HEIGHT)
|
else if (aa->albumart_max_height > LCD_HEIGHT)
|
||||||
wps_data->albumart_max_height = LCD_HEIGHT;
|
aa->albumart_max_height = LCD_HEIGHT;
|
||||||
|
|
||||||
wps_data->wps_uses_albumart = WPS_ALBUMART_LOAD;
|
aa->wps_uses_albumart = WPS_ALBUMART_LOAD;
|
||||||
|
aa->draw = false;
|
||||||
|
wps_data->albumart = aa;
|
||||||
|
|
||||||
/* Skip the rest of the line */
|
/* Skip the rest of the line */
|
||||||
return skip_end_of_line(wps_bufptr);
|
return skip_end_of_line(wps_bufptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_albumart_conditional(const char *wps_bufptr,
|
static int parse_albumart_display(const char *wps_bufptr,
|
||||||
struct wps_token *token,
|
struct wps_token *token,
|
||||||
struct wps_data *wps_data)
|
struct wps_data *wps_data)
|
||||||
{
|
{
|
||||||
struct wps_token *prevtoken = token;
|
(void)wps_bufptr;
|
||||||
--prevtoken;
|
(void)token;
|
||||||
if (wps_data->num_tokens >= 1 && prevtoken->type == WPS_TOKEN_CONDITIONAL)
|
if (wps_data->albumart)
|
||||||
{
|
{
|
||||||
/* This %C is part of a %?C construct.
|
wps_data->albumart->vp = &curr_vp->vp;
|
||||||
It's either %?C<blah> or %?Cn<blah> */
|
|
||||||
token->type = WPS_TOKEN_ALBUMART_FOUND;
|
|
||||||
if (*wps_bufptr == 'n' && *(wps_bufptr + 1) == '<')
|
|
||||||
{
|
|
||||||
token->next = true;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if (*wps_bufptr == '<')
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
token->type = WPS_NO_TOKEN;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* This %C tag is in a conditional construct. */
|
|
||||||
wps_data->albumart_cond_index = condindex[level];
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
|
/* the old code did this so keep it here for now...
|
||||||
|
* this is to allow the posibility to showing the next tracks AA! */
|
||||||
|
if (wps_bufptr+1 == 'n')
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
};
|
};
|
||||||
#endif /* HAVE_ALBUMART */
|
#endif /* HAVE_ALBUMART */
|
||||||
|
|
||||||
|
|
@ -1675,16 +1665,21 @@ bool skin_data_load(struct wps_data *wps_data,
|
||||||
const char *buf,
|
const char *buf,
|
||||||
bool isfile)
|
bool isfile)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_ALBUMART
|
|
||||||
struct mp3entry *curtrack;
|
|
||||||
long offset;
|
|
||||||
int status;
|
|
||||||
int wps_uses_albumart = wps_data->wps_uses_albumart;
|
|
||||||
int albumart_max_height = wps_data->albumart_max_height;
|
|
||||||
int albumart_max_width = wps_data->albumart_max_width;
|
|
||||||
#endif
|
|
||||||
if (!wps_data || !buf)
|
if (!wps_data || !buf)
|
||||||
return false;
|
return false;
|
||||||
|
#ifdef HAVE_ALBUMART
|
||||||
|
int status;
|
||||||
|
struct mp3entry *curtrack;
|
||||||
|
long offset;
|
||||||
|
struct skin_albumart old_aa = {.wps_uses_albumart = WPS_ALBUMART_NONE};
|
||||||
|
if (wps_data->albumart)
|
||||||
|
{
|
||||||
|
old_aa.wps_uses_albumart = wps_data->albumart->wps_uses_albumart;
|
||||||
|
old_aa.albumart_max_height = wps_data->albumart->albumart_max_height;
|
||||||
|
old_aa.albumart_max_width = wps_data->albumart->albumart_max_width;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
wps_reset(wps_data);
|
wps_reset(wps_data);
|
||||||
|
|
||||||
|
|
@ -1799,17 +1794,20 @@ bool skin_data_load(struct wps_data *wps_data,
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_ALBUMART
|
#ifdef HAVE_ALBUMART
|
||||||
status = audio_status();
|
status = audio_status();
|
||||||
if (((!wps_uses_albumart && wps_data->wps_uses_albumart) ||
|
if (status & AUDIO_STATUS_PLAY)
|
||||||
(wps_data->wps_uses_albumart &&
|
|
||||||
(albumart_max_height != wps_data->albumart_max_height ||
|
|
||||||
albumart_max_width != wps_data->albumart_max_width))) &&
|
|
||||||
status & AUDIO_STATUS_PLAY)
|
|
||||||
{
|
{
|
||||||
curtrack = audio_current_track();
|
struct skin_albumart *aa = wps_data->albumart;
|
||||||
offset = curtrack->offset;
|
if (aa && ((aa->wps_uses_albumart && !old_aa.wps_uses_albumart) ||
|
||||||
audio_stop();
|
(aa->wps_uses_albumart &&
|
||||||
if (!(status & AUDIO_STATUS_PAUSE))
|
(((old_aa.albumart_max_height != aa->albumart_max_height) ||
|
||||||
audio_play(offset);
|
(old_aa.albumart_max_width != aa->albumart_max_width))))))
|
||||||
|
{
|
||||||
|
curtrack = audio_current_track();
|
||||||
|
offset = curtrack->offset;
|
||||||
|
audio_stop();
|
||||||
|
if (!(status & AUDIO_STATUS_PAUSE))
|
||||||
|
audio_play(offset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(DEBUG) || defined(SIMULATOR)
|
#if defined(DEBUG) || defined(SIMULATOR)
|
||||||
|
|
|
||||||
|
|
@ -319,13 +319,13 @@ const char *get_token_value(struct gui_wps *gwps,
|
||||||
|
|
||||||
#ifdef HAVE_ALBUMART
|
#ifdef HAVE_ALBUMART
|
||||||
case WPS_TOKEN_ALBUMART_DISPLAY:
|
case WPS_TOKEN_ALBUMART_DISPLAY:
|
||||||
draw_album_art(gwps, audio_current_aa_hid(), false);
|
if (!data->albumart)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
case WPS_TOKEN_ALBUMART_FOUND:
|
|
||||||
if (audio_current_aa_hid() >= 0) {
|
if (audio_current_aa_hid() >= 0) {
|
||||||
|
data->albumart->draw = true;
|
||||||
return "C";
|
return "C";
|
||||||
}
|
}
|
||||||
|
data->albumart->draw = false;
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,6 @@ enum wps_token_type {
|
||||||
WPS_TOKEN_PLAYLIST_NAME,
|
WPS_TOKEN_PLAYLIST_NAME,
|
||||||
WPS_TOKEN_PLAYLIST_POSITION,
|
WPS_TOKEN_PLAYLIST_POSITION,
|
||||||
WPS_TOKEN_PLAYLIST_SHUFFLE,
|
WPS_TOKEN_PLAYLIST_SHUFFLE,
|
||||||
|
|
||||||
#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
|
#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
|
||||||
/* Virtual LED */
|
/* Virtual LED */
|
||||||
WPS_TOKEN_VLED_HDD,
|
WPS_TOKEN_VLED_HDD,
|
||||||
|
|
|
||||||
|
|
@ -431,6 +431,12 @@ static char *get_token_desc(struct wps_token *token, char *buf, int bufsize)
|
||||||
snprintf(buf, bufsize, "pitch value");
|
snprintf(buf, bufsize, "pitch value");
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
|
||||||
|
case WPS_TOKEN_VLED_HDD:
|
||||||
|
snprintf(buf, bufsize, "display virtual HDD LED");
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case WPS_VIEWPORT_ENABLE:
|
case WPS_VIEWPORT_ENABLE:
|
||||||
snprintf(buf, bufsize, "enable VP:%d",
|
snprintf(buf, bufsize, "enable VP:%d",
|
||||||
token->value.i);
|
token->value.i);
|
||||||
|
|
|
||||||
|
|
@ -220,6 +220,24 @@ struct touchregion {
|
||||||
int action; /* action this button will return */
|
int action; /* action this button will return */
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_ALBUMART
|
||||||
|
struct skin_albumart {
|
||||||
|
/* Album art support */
|
||||||
|
struct viewport *vp;/* The viewport this is in */
|
||||||
|
unsigned char wps_uses_albumart; /* WPS_ALBUMART_NONE, _CHECK, _LOAD */
|
||||||
|
short albumart_x;
|
||||||
|
short albumart_y;
|
||||||
|
unsigned char albumart_xalign; /* WPS_ALBUMART_ALIGN_LEFT, _CENTER, _RIGHT */
|
||||||
|
unsigned char albumart_yalign; /* WPS_ALBUMART_ALIGN_TOP, _CENTER, _BOTTOM */
|
||||||
|
short albumart_max_width;
|
||||||
|
short albumart_max_height;
|
||||||
|
|
||||||
|
bool draw;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
/* wps_data
|
/* wps_data
|
||||||
this struct holds all necessary data which describes the
|
this struct holds all necessary data which describes the
|
||||||
viewable content of a wps */
|
viewable content of a wps */
|
||||||
|
|
@ -233,18 +251,8 @@ struct wps_data
|
||||||
struct skin_token_list *progressbars;
|
struct skin_token_list *progressbars;
|
||||||
|
|
||||||
bool peak_meter_enabled;
|
bool peak_meter_enabled;
|
||||||
|
|
||||||
#ifdef HAVE_ALBUMART
|
#ifdef HAVE_ALBUMART
|
||||||
/* Album art support */
|
struct skin_albumart *albumart;
|
||||||
unsigned char wps_uses_albumart; /* WPS_ALBUMART_NONE, _CHECK, _LOAD */
|
|
||||||
short albumart_x;
|
|
||||||
short albumart_y;
|
|
||||||
unsigned char albumart_xalign; /* WPS_ALBUMART_ALIGN_LEFT, _CENTER, _RIGHT */
|
|
||||||
unsigned char albumart_yalign; /* WPS_ALBUMART_ALIGN_TOP, _CENTER, _BOTTOM */
|
|
||||||
short albumart_max_width;
|
|
||||||
short albumart_max_height;
|
|
||||||
|
|
||||||
int albumart_cond_index;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else /*HAVE_LCD_CHARCELLS */
|
#else /*HAVE_LCD_CHARCELLS */
|
||||||
|
|
|
||||||
|
|
@ -1280,7 +1280,7 @@ void gui_sync_wps_init(void)
|
||||||
{
|
{
|
||||||
skin_data_init(&wps_datas[i]);
|
skin_data_init(&wps_datas[i]);
|
||||||
#ifdef HAVE_ALBUMART
|
#ifdef HAVE_ALBUMART
|
||||||
wps_datas[i].wps_uses_albumart = 0;
|
wps_datas[i].albumart = NULL;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
wps_datas[i].remote_wps = (i == SCREEN_REMOTE);
|
wps_datas[i].remote_wps = (i == SCREEN_REMOTE);
|
||||||
|
|
@ -1306,12 +1306,13 @@ bool wps_uses_albumart(int *width, int *height)
|
||||||
int i;
|
int i;
|
||||||
FOR_NB_SCREENS(i) {
|
FOR_NB_SCREENS(i) {
|
||||||
struct gui_wps *gwps = &gui_wps[i];
|
struct gui_wps *gwps = &gui_wps[i];
|
||||||
if (gwps->data && (gwps->data->wps_uses_albumart != WPS_ALBUMART_NONE))
|
struct skin_albumart *aa = gwps->data->albumart;
|
||||||
|
if (aa && (aa->wps_uses_albumart != WPS_ALBUMART_NONE))
|
||||||
{
|
{
|
||||||
if (width)
|
if (width)
|
||||||
*width = gui_wps[0].data->albumart_max_width;
|
*width = aa->albumart_max_width;
|
||||||
if (height)
|
if (height)
|
||||||
*height = gui_wps[0].data->albumart_max_height;
|
*height = aa->albumart_max_height;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -308,6 +308,7 @@ void draw_album_art(struct gui_wps *gwps, int handle_id, bool clear)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
struct wps_data *data = gwps->data;
|
struct wps_data *data = gwps->data;
|
||||||
|
struct skin_albumart *aa = data->albumart;
|
||||||
|
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
/* No album art on RWPS */
|
/* No album art on RWPS */
|
||||||
|
|
@ -315,37 +316,40 @@ void draw_album_art(struct gui_wps *gwps, int handle_id, bool clear)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (!aa)
|
||||||
|
return;
|
||||||
|
|
||||||
struct bitmap *bmp;
|
struct bitmap *bmp;
|
||||||
if (bufgetdata(handle_id, 0, (void *)&bmp) <= 0)
|
if (bufgetdata(handle_id, 0, (void *)&bmp) <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
short x = data->albumart_x;
|
short x = aa->albumart_x;
|
||||||
short y = data->albumart_y;
|
short y = aa->albumart_y;
|
||||||
short width = bmp->width;
|
short width = bmp->width;
|
||||||
short height = bmp->height;
|
short height = bmp->height;
|
||||||
|
|
||||||
if (data->albumart_max_width > 0)
|
if (aa->albumart_max_width > 0)
|
||||||
{
|
{
|
||||||
/* Crop if the bitmap is too wide */
|
/* Crop if the bitmap is too wide */
|
||||||
width = MIN(bmp->width, data->albumart_max_width);
|
width = MIN(bmp->width, aa->albumart_max_width);
|
||||||
|
|
||||||
/* Align */
|
/* Align */
|
||||||
if (data->albumart_xalign & WPS_ALBUMART_ALIGN_RIGHT)
|
if (aa->albumart_xalign & WPS_ALBUMART_ALIGN_RIGHT)
|
||||||
x += data->albumart_max_width - width;
|
x += aa->albumart_max_width - width;
|
||||||
else if (data->albumart_xalign & WPS_ALBUMART_ALIGN_CENTER)
|
else if (aa->albumart_xalign & WPS_ALBUMART_ALIGN_CENTER)
|
||||||
x += (data->albumart_max_width - width) / 2;
|
x += (aa->albumart_max_width - width) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->albumart_max_height > 0)
|
if (aa->albumart_max_height > 0)
|
||||||
{
|
{
|
||||||
/* Crop if the bitmap is too high */
|
/* Crop if the bitmap is too high */
|
||||||
height = MIN(bmp->height, data->albumart_max_height);
|
height = MIN(bmp->height, aa->albumart_max_height);
|
||||||
|
|
||||||
/* Align */
|
/* Align */
|
||||||
if (data->albumart_yalign & WPS_ALBUMART_ALIGN_BOTTOM)
|
if (aa->albumart_yalign & WPS_ALBUMART_ALIGN_BOTTOM)
|
||||||
y += data->albumart_max_height - height;
|
y += aa->albumart_max_height - height;
|
||||||
else if (data->albumart_yalign & WPS_ALBUMART_ALIGN_CENTER)
|
else if (aa->albumart_yalign & WPS_ALBUMART_ALIGN_CENTER)
|
||||||
y += (data->albumart_max_height - height) / 2;
|
y += (aa->albumart_max_height - height) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!clear)
|
if (!clear)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue