diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2014-03-27 18:15:12 +1100 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2014-05-14 19:41:55 +1000 |
commit | 01cbb795e9a059238f0e39d44d279c1d52874e06 (patch) | |
tree | f1aca3081d170a3e5cc92ee4966b6698e1b20232 /apps/gui | |
parent | 440ff9500bc74cc278e0b66f528cfdf624547240 (diff) |
don't load the same bmp image more than once in a skin
Change-Id: Ie38146a80bb356f40810f017c262b81edac69688
Diffstat (limited to 'apps/gui')
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 57153ed602..cf90ff5eab 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -1826,7 +1826,7 @@ static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir) { struct wps_token *token = SKINOFFSETTOPTR(skin_buffer, list->token); struct gui_img *img = (struct gui_img*)SKINOFFSETTOPTR(skin_buffer, token->value.data); - if (img->bm.data) + if (!img->loaded) { if (img->using_preloaded_icons) { @@ -1835,10 +1835,30 @@ static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir) } else { - img->buflib_handle = load_skin_bmp(wps_data, &img->bm, bmpdir); + char path[MAX_PATH]; + int handle; + strcpy(path, img->bm.data); + handle = load_skin_bmp(wps_data, &img->bm, bmpdir); + img->buflib_handle = handle; img->loaded = img->buflib_handle >= 0; if (img->loaded) + { + struct skin_token_list *imglist = SKINOFFSETTOPTR(skin_buffer, list->next); + img->subimage_height = img->bm.height / img->num_subimages; + while (imglist) + { + token = SKINOFFSETTOPTR(skin_buffer, imglist->token); + img = (struct gui_img*)SKINOFFSETTOPTR(skin_buffer, token->value.data); + if (!strcmp(path, img->bm.data)) + { + img->loaded = true; + img->buflib_handle = handle; + img->subimage_height = img->bm.height / img->num_subimages; + } + imglist = SKINOFFSETTOPTR(skin_buffer, imglist->next); + } + } else retval = false; } |