forked from len0rd/rockbox
small cleanup skin_parser parse_album_art parse_image_load
bugfix parse_font_load() allow fonts with . in filename Change-Id: Idcd201f624699e184e5181a46848c36b7e3fca49
This commit is contained in:
parent
7c678f5e7a
commit
7d1cdf3ece
1 changed files with 36 additions and 36 deletions
|
@ -398,16 +398,18 @@ static int parse_image_load(struct skin_element *element,
|
||||||
subimages = get_param(element, 2)->data.number;
|
subimages = get_param(element, 2)->data.number;
|
||||||
else if (element->params_count > 3)
|
else if (element->params_count > 3)
|
||||||
{
|
{
|
||||||
struct skin_tag_parameter *param2 = get_param(element, 2);
|
struct skin_tag_parameter *param;
|
||||||
struct skin_tag_parameter *param3 = get_param(element, 3);
|
param = get_param(element, 2);
|
||||||
if (param2->type == PERCENT)
|
if (param->type == PERCENT)
|
||||||
x = param2->data.number * curr_vp->vp.width / 1000;
|
x = param->data.number * curr_vp->vp.width / 1000;
|
||||||
else
|
else
|
||||||
x = param2->data.number;
|
x = param->data.number;
|
||||||
if (param3->type == PERCENT)
|
|
||||||
y = param3->data.number * curr_vp->vp.height / 1000;
|
param = get_param(element, 3);
|
||||||
|
if (param->type == PERCENT)
|
||||||
|
y = param->data.number * curr_vp->vp.height / 1000;
|
||||||
else
|
else
|
||||||
y = param3->data.number;
|
y = param->data.number;
|
||||||
|
|
||||||
if (element->params_count == 5)
|
if (element->params_count == 5)
|
||||||
subimages = get_param(element, 4)->data.number;
|
subimages = get_param(element, 4)->data.number;
|
||||||
|
@ -489,7 +491,7 @@ static int parse_font_load(struct skin_element *element,
|
||||||
#endif
|
#endif
|
||||||
/* make sure the filename contains .fnt,
|
/* make sure the filename contains .fnt,
|
||||||
* we dont actually use it, but require it anyway */
|
* we dont actually use it, but require it anyway */
|
||||||
ptr = strchr(filename, '.');
|
ptr = strrchr(filename, '.');
|
||||||
if (!ptr || strncmp(ptr, ".fnt", 4))
|
if (!ptr || strncmp(ptr, ".fnt", 4))
|
||||||
return WPS_ERROR_INVALID_PARAM;
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
skinfonts[id-2].id = -1;
|
skinfonts[id-2].id = -1;
|
||||||
|
@ -1272,7 +1274,8 @@ static int parse_progressbar_tag(struct skin_element* element,
|
||||||
else if (token->type == SKIN_TOKEN_LIST_NEEDS_SCROLLBAR)
|
else if (token->type == SKIN_TOKEN_LIST_NEEDS_SCROLLBAR)
|
||||||
token->type = SKIN_TOKEN_LIST_SCROLLBAR;
|
token->type = SKIN_TOKEN_LIST_SCROLLBAR;
|
||||||
else if (token->type == SKIN_TOKEN_SETTING)
|
else if (token->type == SKIN_TOKEN_SETTING)
|
||||||
token->type = SKIN_TOKEN_SETTINGBAR;
|
token->type = SKIN_TOKEN_SETTINGBAR;
|
||||||
|
|
||||||
pb->type = token->type;
|
pb->type = token->type;
|
||||||
|
|
||||||
#ifdef HAVE_TOUCHSCREEN
|
#ifdef HAVE_TOUCHSCREEN
|
||||||
|
@ -1450,32 +1453,35 @@ static int parse_albumart_load(struct skin_element* element,
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* reset albumart info in wps */
|
/* reset albumart info in wps */
|
||||||
aa->width = -1;
|
|
||||||
aa->height = -1;
|
|
||||||
aa->xalign = WPS_ALBUMART_ALIGN_CENTER; /* default */
|
aa->xalign = WPS_ALBUMART_ALIGN_CENTER; /* default */
|
||||||
aa->yalign = WPS_ALBUMART_ALIGN_CENTER; /* default */
|
aa->yalign = WPS_ALBUMART_ALIGN_CENTER; /* default */
|
||||||
|
|
||||||
struct skin_tag_parameter *param0 = get_param(element, 0);
|
struct skin_tag_parameter *param;
|
||||||
struct skin_tag_parameter *param1 = get_param(element, 1);
|
|
||||||
struct skin_tag_parameter *param2 = get_param(element, 2);
|
|
||||||
struct skin_tag_parameter *param3 = get_param(element, 3);
|
|
||||||
|
|
||||||
aa->x = param0->data.number;
|
param = get_param(element, 0);
|
||||||
aa->y = param1->data.number;
|
if (!isdefault(param) && param->type == PERCENT)
|
||||||
aa->width = param2->data.number;
|
aa->x = param->data.number * curr_vp->vp.width / 1000;
|
||||||
aa->height = param3->data.number;
|
else
|
||||||
|
aa->x = param->data.number;
|
||||||
|
|
||||||
if (!isdefault(param0) && param0->type == PERCENT)
|
param = get_param(element, 1);
|
||||||
aa->x = param0->data.number * curr_vp->vp.width / 1000;
|
if (!isdefault(param) && param->type == PERCENT)
|
||||||
|
aa->y = param->data.number * curr_vp->vp.height / 1000;
|
||||||
|
else
|
||||||
|
aa->y = param->data.number;
|
||||||
|
|
||||||
if (!isdefault(param1) && param1->type == PERCENT)
|
param = get_param(element, 2);
|
||||||
aa->y = param1->data.number * curr_vp->vp.height / 1000;
|
if (!isdefault(param) && param->type == PERCENT)
|
||||||
|
aa->width = param->data.number * curr_vp->vp.width / 1000;
|
||||||
|
else
|
||||||
|
aa->width = param->data.number;
|
||||||
|
|
||||||
if (!isdefault(param2) && param2->type == PERCENT)
|
param = get_param(element, 3);
|
||||||
aa->width = param2->data.number * curr_vp->vp.width / 1000;
|
|
||||||
|
|
||||||
if (!isdefault(param3) && param3->type == PERCENT)
|
if (!isdefault(param) && param->type == PERCENT)
|
||||||
aa->height = param3->data.number * curr_vp->vp.height / 1000;
|
aa->height = param->data.number * curr_vp->vp.height / 1000;
|
||||||
|
else
|
||||||
|
aa->height = param->data.number;
|
||||||
|
|
||||||
aa->draw_handle = -1;
|
aa->draw_handle = -1;
|
||||||
|
|
||||||
|
@ -1502,21 +1508,18 @@ static int parse_albumart_load(struct skin_element* element,
|
||||||
|
|
||||||
if (element->params_count > 4 && !isdefault(get_param(element, 4)))
|
if (element->params_count > 4 && !isdefault(get_param(element, 4)))
|
||||||
{
|
{
|
||||||
switch (*get_param_text(element, 4))
|
switch (tolower(*get_param_text(element, 4)))
|
||||||
{
|
{
|
||||||
case 'l':
|
case 'l':
|
||||||
case 'L':
|
|
||||||
if (swap_for_rtl)
|
if (swap_for_rtl)
|
||||||
aa->xalign = WPS_ALBUMART_ALIGN_RIGHT;
|
aa->xalign = WPS_ALBUMART_ALIGN_RIGHT;
|
||||||
else
|
else
|
||||||
aa->xalign = WPS_ALBUMART_ALIGN_LEFT;
|
aa->xalign = WPS_ALBUMART_ALIGN_LEFT;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
case 'C':
|
|
||||||
aa->xalign = WPS_ALBUMART_ALIGN_CENTER;
|
aa->xalign = WPS_ALBUMART_ALIGN_CENTER;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
case 'R':
|
|
||||||
if (swap_for_rtl)
|
if (swap_for_rtl)
|
||||||
aa->xalign = WPS_ALBUMART_ALIGN_LEFT;
|
aa->xalign = WPS_ALBUMART_ALIGN_LEFT;
|
||||||
else
|
else
|
||||||
|
@ -1526,18 +1529,15 @@ static int parse_albumart_load(struct skin_element* element,
|
||||||
}
|
}
|
||||||
if (element->params_count > 5 && !isdefault(get_param(element, 5)))
|
if (element->params_count > 5 && !isdefault(get_param(element, 5)))
|
||||||
{
|
{
|
||||||
switch (*get_param_text(element, 5))
|
switch (tolower(*get_param_text(element, 5)))
|
||||||
{
|
{
|
||||||
case 't':
|
case 't':
|
||||||
case 'T':
|
|
||||||
aa->yalign = WPS_ALBUMART_ALIGN_TOP;
|
aa->yalign = WPS_ALBUMART_ALIGN_TOP;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
case 'C':
|
|
||||||
aa->yalign = WPS_ALBUMART_ALIGN_CENTER;
|
aa->yalign = WPS_ALBUMART_ALIGN_CENTER;
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
case 'B':
|
|
||||||
aa->yalign = WPS_ALBUMART_ALIGN_BOTTOM;
|
aa->yalign = WPS_ALBUMART_ALIGN_BOTTOM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue