skin engine: Remove albumart viewport field

The viewport field in albumart is unnecessary, but for a different
reason than eg. the progressbar was. The skin engine draws images
by going over a global list of images shared between all viewports.
Prior to drawing a viewport, every image is marked "not displayed."
When an image display tag is encountered during rendering this mark
is set to the index of the subimage to be displayed.

The albumart is handled similarily, by setting a handle to -1 and
then updating it when the %Cd tag is encountered. The albumart is
not drawn unless the handle is set to >= 0 by the %Cd tag. So we
don't need to track or check viewports at all, because only the
viewport that contains the %Cd tag will ever draw the albumart.

Change-Id: Ibc0233d168012759325d3c16dc317de9ad3dcf6c
This commit is contained in:
Aidan MacDonald 2022-10-04 14:23:04 +01:00
parent 830436a282
commit 3815ef8050
3 changed files with 1 additions and 11 deletions

View file

@ -413,8 +413,7 @@ void wps_display_images(struct gui_wps *gwps, struct viewport* vp)
#ifdef HAVE_ALBUMART
/* now draw the AA */
struct skin_albumart *aa = SKINOFFSETTOPTR(get_skin_buffer(data), data->albumart);
if (aa && SKINOFFSETTOPTR(get_skin_buffer(data), aa->vp) == vp
&& aa->draw_handle >= 0)
if (aa && aa->draw_handle >= 0)
{
draw_album_art(gwps, aa->draw_handle, false);
aa->draw_handle = -1;

View file

@ -1317,7 +1317,6 @@ static int parse_albumart_load(struct skin_element* element,
if (!isdefault(param3) && param3->type == PERCENT)
aa->height = param3->data.number * curr_vp->vp.height / 1000;
aa->vp = PTRTOSKINOFFSET(skin_buffer, &curr_vp->vp);
aa->draw_handle = -1;
/* if we got here, we parsed everything ok .. ! */
@ -2405,13 +2404,6 @@ static int skin_element_callback(struct skin_element* element, void* data)
break;
#endif
#ifdef HAVE_ALBUMART
case SKIN_TOKEN_ALBUMART_DISPLAY:
if (SKINOFFSETTOPTR(skin_buffer, wps_data->albumart))
{
struct skin_albumart *aa = SKINOFFSETTOPTR(skin_buffer, wps_data->albumart);
aa->vp = PTRTOSKINOFFSET(skin_buffer, &curr_vp->vp);
}
break;
case SKIN_TOKEN_ALBUMART_LOAD:
function = parse_albumart_load;
break;

View file

@ -272,7 +272,6 @@ struct skin_albumart {
unsigned char yalign; /* WPS_ALBUMART_ALIGN_TOP, _CENTER, _BOTTOM */
unsigned char state; /* WPS_ALBUMART_NONE, _CHECK, _LOAD */
OFFSETTYPE(struct viewport *) vp;
int draw_handle;
};
#endif