1
0
Fork 0
forked from len0rd/rockbox

When using the tag argument in %%xd(): 1) clear the image first, so that images with transparency can be used; 2) allow things like battery level or volume, where a value is limited to the number of sub-images.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27786 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Magnus Holmgren 2010-08-12 10:01:46 +00:00
parent 0b9215809a
commit 6d7900e330

View file

@ -157,21 +157,24 @@ static bool do_non_text_tags(struct gui_wps *gwps, struct skin_draw_info *info,
{
char buf[16];
const char *out;
int a = TOKEN_VALUE_ONLY;
int a = img->num_subimages;
out = get_token_value(gwps, id->token, buf, sizeof(buf), &a);
/* NOTE: get_token_value() returns values starting at 1! */
if (a == -1)
a = (out && *out) ? 1 : 2;
a--;
a += id->offset;
/* Clear the image, as in conditionals */
clear_image_pos(gwps, img);
/* If the token returned a value which is higher than
* the amount of subimages clear the image. */
if (a<0 || a >= img->num_subimages)
* the amount of subimages, don't draw it. */
if (a >= 0 && a < img->num_subimages)
{
clear_image_pos(gwps, img);
}
else
img->display = a;
}
}
}
break;