Skin Engine: Fix loading images with same file name

Looks like this was a regression introduced in 01cbb79.
The duplicate img uses an existing buflib handle for
the data, but still didn't have access to the dimensions
from the bitmap struct.

Test case: DancePuffDuo theme for Sansa E200. Only one
dancepuff was displayed. Thank you to goatikins for
reporting the issue.

Change-Id: I32c3ebd1f00738f7db52e7a66f98c4ab3489ee4a
This commit is contained in:
Christian Soffke 2023-11-17 15:56:04 +01:00
parent 5114827937
commit 35f9a5b415

View file

@ -2007,6 +2007,7 @@ static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir)
{ {
struct skin_token_list *imglist = SKINOFFSETTOPTR(skin_buffer, list->next); struct skin_token_list *imglist = SKINOFFSETTOPTR(skin_buffer, list->next);
img->subimage_height = img->bm.height / img->num_subimages; img->subimage_height = img->bm.height / img->num_subimages;
struct bitmap* loaded_bm = &img->bm;
while (imglist) while (imglist)
{ {
token = SKINOFFSETTOPTR(skin_buffer, imglist->token); token = SKINOFFSETTOPTR(skin_buffer, imglist->token);
@ -2016,6 +2017,7 @@ static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir)
{ {
img->loaded = true; img->loaded = true;
img->buflib_handle = handle; img->buflib_handle = handle;
img->bm = *loaded_bm;
img->subimage_height = img->bm.height / img->num_subimages; img->subimage_height = img->bm.height / img->num_subimages;
} }
} }