Don't set the drawmode twice and simplify two cases in viewport_parse_viewport.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22227 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2009-08-09 18:44:49 +00:00
parent f909428321
commit a1b0e165cc
2 changed files with 21 additions and 23 deletions

View file

@ -625,9 +625,6 @@ static int parse_viewport(const char *wps_bufptr,
struct viewport *vp = &wps_data->viewports[wps_data->num_viewports].vp;
/* format: %V|x|y|width|height|font|fg_pattern|bg_pattern| */
/* Set the defaults for fields not user-specified */
vp->drawmode = DRMODE_SOLID;
if (!(ptr = viewport_parse_viewport(vp, screen, ptr, '|')))
return WPS_ERROR_INVALID_PARAM;

View file

@ -168,6 +168,12 @@ void viewportmanager_statusbar_changed(void* data)
viewportmanager_set_statusbar(statusbar_enabled);
}
#ifdef HAVE_LCD_COLOR
#define ARG_STRING (depth == 2 ? "dddddgg":"dddddcc")
#else
#define ARG_STRING "dddddcc"
#endif
#ifdef HAVE_LCD_BITMAP
const char* viewport_parse_viewport(struct viewport *vp,
enum screen_type screen,
@ -191,31 +197,25 @@ const char* viewport_parse_viewport(struct viewport *vp,
/* Work out the depth of this display */
depth = screens[screen].depth;
#ifdef HAVE_LCD_COLOR
if (depth == 16)
{
if (!(ptr = parse_list("dddddcc", &set, separator, ptr, &vp->x, &vp->y, &vp->width,
&vp->height, &vp->font, &vp->fg_pattern,&vp->bg_pattern)))
return VP_ERROR;
}
else
#endif
#if (LCD_DEPTH == 2) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 2)
if (depth == 2) {
if (!(ptr = parse_list("dddddgg", &set, separator, ptr, &vp->x, &vp->y, &vp->width,
&vp->height, &vp->font, &vp->fg_pattern, &vp->bg_pattern)))
return VP_ERROR;
}
else
#endif
#if (LCD_DEPTH == 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 1)
if (depth == 1)
{
if (!(ptr = parse_list("ddddd", &set, separator, ptr, &vp->x, &vp->y, &vp->width,
&vp->height, &vp->font)))
if (!(ptr = parse_list("ddddd", &set, separator, ptr,
&vp->x, &vp->y, &vp->width, &vp->height, &vp->font)))
return VP_ERROR;
}
else
#endif
#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)
if (depth >= 2)
{
if (!(ptr = parse_list(ARG_STRING, &set, separator, ptr,
&vp->x, &vp->y, &vp->width, &vp->height, &vp->font,
&vp->fg_pattern,&vp->bg_pattern)))
return VP_ERROR;
}
else
#undef ARG_STRING
#endif
{}
@ -254,7 +254,8 @@ const char* viewport_parse_viewport(struct viewport *vp,
|| !LIST_VALUE_PARSED(set, PL_FONT)
)
vp->font = FONT_UI;
/* Set the defaults for fields not user-specified */
vp->drawmode = DRMODE_SOLID;
return ptr;