summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-08-09 18:44:49 +0000
committerThomas Martitz <kugel@rockbox.org>2009-08-09 18:44:49 +0000
commita1b0e165ccf3f65119e43751bb77ee772e89da51 (patch)
tree6c6d2aed3fd2080f53fded06e2f74d2fa1b082a2
parentf909428321ce297758358dcfcf75ad23871c2819 (diff)
downloadrockbox-a1b0e165ccf3f65119e43751bb77ee772e89da51.tar.gz
rockbox-a1b0e165ccf3f65119e43751bb77ee772e89da51.zip
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
-rw-r--r--apps/gui/skin_engine/wps_parser.c3
-rw-r--r--apps/gui/viewport.c37
2 files changed, 19 insertions, 21 deletions
diff --git a/apps/gui/skin_engine/wps_parser.c b/apps/gui/skin_engine/wps_parser.c
index 9671d7c4dc..4a41a26c7d 100644
--- a/apps/gui/skin_engine/wps_parser.c
+++ b/apps/gui/skin_engine/wps_parser.c
@@ -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;
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index a2c4351d03..2819d36625 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -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 (LCD_DEPTH == 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 1)
+ if (depth == 1)
{
- 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)))
+ if (!(ptr = parse_list("ddddd", &set, separator, ptr,
+ &vp->x, &vp->y, &vp->width, &vp->height, &vp->font)))
return VP_ERROR;
}
- else
+ else
#endif
-#if (LCD_DEPTH == 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 1)
- if (depth == 1)
+#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)
+ if (depth >= 2)
{
- if (!(ptr = parse_list("ddddd", &set, separator, ptr, &vp->x, &vp->y, &vp->width,
- &vp->height, &vp->font)))
+ 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;