summaryrefslogtreecommitdiff
path: root/apps/gui/splash.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-10-11 12:21:27 +0000
committerThomas Martitz <kugel@rockbox.org>2009-10-11 12:21:27 +0000
commita79dc877615c2af571bf0416dd2867c000701e7e (patch)
tree20be2176756c12d56d4e1947a05c2331fe1666ca /apps/gui/splash.c
parente171294c1d50dc4e4ba30339940a854c2b82d1ea (diff)
Add a center flag, next to the rtl flag, for viewports. That results in any text being drawn centered. It overrides the RTL flag if set.
Simplify splashes and time menu by using it. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23105 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/splash.c')
-rw-r--r--apps/gui/splash.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/apps/gui/splash.c b/apps/gui/splash.c
index 10a6885f92..aaa259c09d 100644
--- a/apps/gui/splash.c
+++ b/apps/gui/splash.c
@@ -48,7 +48,6 @@
static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
{
char splash_buf[MAXBUFFER];
- short widths[MAXLINES];
char *lines[MAXLINES];
char *next;
@@ -95,7 +94,6 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
if (x + (next - lastbreak) * space_w + w
> screen->lcdwidth - RECT_SPACING*2)
{ /* too wide, wrap */
- widths[line] = x;
#ifdef HAVE_LCD_BITMAP
if (x > maxw)
maxw = x;
@@ -118,7 +116,6 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
next = strtok_r(NULL, " ", &store);
if (!next)
{ /* no more words */
- widths[line] = x;
#ifdef HAVE_LCD_BITMAP
if (x > maxw)
maxw = x;
@@ -149,7 +146,8 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
vp.width = screen->lcdwidth;
if (vp.height > screen->lcdheight)
vp.height = screen->lcdheight;
-
+
+ vp.flags |= VP_FLAG_CENTER_ALIGN;
#if LCD_DEPTH > 1
if (screen->depth > 1)
{
@@ -179,7 +177,6 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
y = RECT_SPACING;
#else /* HAVE_LCD_CHARCELLS */
y = 0; /* vertical centering on 2 lines would be silly */
- x = 0;
screen->clear_display();
#endif
@@ -187,19 +184,10 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
for (i = 0; i <= line; i++, y+=h)
{
#ifdef HAVE_LCD_BITMAP
-#define W (vp.width - RECT_SPACING*2)
-#else
-#define W (screens->lcdwidth)
-#endif
- x = (W - widths[i])/2;
- if (x < 0)
- x = 0;
-#ifdef HAVE_LCD_BITMAP
- screen->putsxy(x+RECT_SPACING, y, lines[i]);
+ screen->putsxy(0, y, lines[i]);
#else
- screen->puts(x, y, lines[i]);
+ screen->puts(0, y, lines[i]);
#endif
-#undef W
}
screen->update_viewport();
end: