forked from len0rd/rockbox
skin_engine: Fix albumart logic on skin reloading.
This logic checks whether the skin's albumart dimensions differ from the previous skin to force rebuffering if necessary. This was broken since a while as the necessary information was reset. Change-Id: I3b9f3a819c6af202af8ad66c13742f704ce45ab1 Reviewed-on: http://gerrit.rockbox.org/476 Tested-by: Thomas Martitz <kugel@rockbox.org> Reviewed-by: Thomas Martitz <kugel@rockbox.org>
This commit is contained in:
parent
280a0eb27e
commit
58b4e71d32
3 changed files with 24 additions and 22 deletions
|
|
@ -83,10 +83,23 @@ struct skin_stats *skin_get_stats(int number, int screen)
|
|||
|
||||
static void gui_skin_reset(struct gui_skin *skin)
|
||||
{
|
||||
struct wps_data *data;
|
||||
struct skin_albumart *aa_save;
|
||||
skin->failsafe_loaded = false;
|
||||
skin->needs_full_update = true;
|
||||
skin->gui_wps.data = &skin->data;
|
||||
memset(skin->gui_wps.data, 0, sizeof(struct wps_data));
|
||||
skin->gui_wps.data = data = &skin->data;
|
||||
/* copy to temp var to protect against memset */
|
||||
if ((aa_save = SKINOFFSETTOPTR(get_skin_buffer(data), data->albumart)))
|
||||
{
|
||||
short old_width, old_height;
|
||||
old_width = aa_save->width;
|
||||
old_height = aa_save->height;
|
||||
memset(data, 0, sizeof(struct wps_data));
|
||||
data->last_albumart_width = old_width;
|
||||
data->last_albumart_height = old_height;
|
||||
}
|
||||
else
|
||||
memset(data, 0, sizeof(struct wps_data));
|
||||
skin->data.wps_loaded = false;
|
||||
skin->data.buflib_handle = -1;
|
||||
skin->data.tree = -1;
|
||||
|
|
|
|||
|
|
@ -2286,19 +2286,6 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
|
|||
char *wps_buffer = NULL;
|
||||
if (!wps_data || !buf)
|
||||
return false;
|
||||
#ifdef HAVE_ALBUMART
|
||||
int status;
|
||||
struct mp3entry *curtrack;
|
||||
long offset;
|
||||
struct skin_albumart old_aa = {.state = WPS_ALBUMART_NONE};
|
||||
struct skin_albumart *aa = SKINOFFSETTOPTR(skin_buffer, wps_data->albumart);
|
||||
if (aa)
|
||||
{
|
||||
old_aa.state = aa->state;
|
||||
old_aa.height = aa->height;
|
||||
old_aa.width = aa->width;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
int i;
|
||||
for (i=0;i<MAXUSERFONTS;i++)
|
||||
|
|
@ -2401,17 +2388,16 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
|
|||
}
|
||||
#endif
|
||||
#if defined(HAVE_ALBUMART) && !defined(__PCTOOL__)
|
||||
status = audio_status();
|
||||
int status = audio_status();
|
||||
if (status & AUDIO_STATUS_PLAY)
|
||||
{
|
||||
/* last_albumart_{width,height} is either both 0 or valid AA dimensions */
|
||||
struct skin_albumart *aa = SKINOFFSETTOPTR(skin_buffer, wps_data->albumart);
|
||||
if (aa && ((aa->state && !old_aa.state) ||
|
||||
(aa->state &&
|
||||
(((old_aa.height != aa->height) ||
|
||||
(old_aa.width != aa->width))))))
|
||||
if (aa && (aa->state != WPS_ALBUMART_NONE ||
|
||||
(((wps_data->last_albumart_height != aa->height) ||
|
||||
(wps_data->last_albumart_width != aa->width)))))
|
||||
{
|
||||
curtrack = audio_current_track();
|
||||
offset = curtrack->offset;
|
||||
long offset = audio_current_track()->offset;
|
||||
audio_stop();
|
||||
if (!(status & AUDIO_STATUS_PAUSE))
|
||||
audio_play(offset);
|
||||
|
|
|
|||
|
|
@ -361,6 +361,9 @@ struct wps_data
|
|||
#ifdef HAVE_ALBUMART
|
||||
OFFSETTYPE(struct skin_albumart *) albumart;
|
||||
int playback_aa_slot;
|
||||
/* copy of albumart to survive skin resets, used to check if albumart
|
||||
* dimensions changed on skin change */
|
||||
short last_albumart_width, last_albumart_height;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SKIN_VARIABLES
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue