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)
downloadrockbox-a79dc877615c2af571bf0416dd2867c000701e7e.tar.gz
rockbox-a79dc877615c2af571bf0416dd2867c000701e7e.zip
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 @@
48static void splash_internal(struct screen * screen, const char *fmt, va_list ap) 48static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
49{ 49{
50 char splash_buf[MAXBUFFER]; 50 char splash_buf[MAXBUFFER];
51 short widths[MAXLINES];
52 char *lines[MAXLINES]; 51 char *lines[MAXLINES];
53 52
54 char *next; 53 char *next;
@@ -95,7 +94,6 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
95 if (x + (next - lastbreak) * space_w + w 94 if (x + (next - lastbreak) * space_w + w
96 > screen->lcdwidth - RECT_SPACING*2) 95 > screen->lcdwidth - RECT_SPACING*2)
97 { /* too wide, wrap */ 96 { /* too wide, wrap */
98 widths[line] = x;
99#ifdef HAVE_LCD_BITMAP 97#ifdef HAVE_LCD_BITMAP
100 if (x > maxw) 98 if (x > maxw)
101 maxw = x; 99 maxw = x;
@@ -118,7 +116,6 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
118 next = strtok_r(NULL, " ", &store); 116 next = strtok_r(NULL, " ", &store);
119 if (!next) 117 if (!next)
120 { /* no more words */ 118 { /* no more words */
121 widths[line] = x;
122#ifdef HAVE_LCD_BITMAP 119#ifdef HAVE_LCD_BITMAP
123 if (x > maxw) 120 if (x > maxw)
124 maxw = x; 121 maxw = x;
@@ -149,7 +146,8 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
149 vp.width = screen->lcdwidth; 146 vp.width = screen->lcdwidth;
150 if (vp.height > screen->lcdheight) 147 if (vp.height > screen->lcdheight)
151 vp.height = screen->lcdheight; 148 vp.height = screen->lcdheight;
152 149
150 vp.flags |= VP_FLAG_CENTER_ALIGN;
153#if LCD_DEPTH > 1 151#if LCD_DEPTH > 1
154 if (screen->depth > 1) 152 if (screen->depth > 1)
155 { 153 {
@@ -179,7 +177,6 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
179 y = RECT_SPACING; 177 y = RECT_SPACING;
180#else /* HAVE_LCD_CHARCELLS */ 178#else /* HAVE_LCD_CHARCELLS */
181 y = 0; /* vertical centering on 2 lines would be silly */ 179 y = 0; /* vertical centering on 2 lines would be silly */
182 x = 0;
183 screen->clear_display(); 180 screen->clear_display();
184#endif 181#endif
185 182
@@ -187,19 +184,10 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
187 for (i = 0; i <= line; i++, y+=h) 184 for (i = 0; i <= line; i++, y+=h)
188 { 185 {
189#ifdef HAVE_LCD_BITMAP 186#ifdef HAVE_LCD_BITMAP
190#define W (vp.width - RECT_SPACING*2) 187 screen->putsxy(0, y, lines[i]);
191#else
192#define W (screens->lcdwidth)
193#endif
194 x = (W - widths[i])/2;
195 if (x < 0)
196 x = 0;
197#ifdef HAVE_LCD_BITMAP
198 screen->putsxy(x+RECT_SPACING, y, lines[i]);
199#else 188#else
200 screen->puts(x, y, lines[i]); 189 screen->puts(0, y, lines[i]);
201#endif 190#endif
202#undef W
203 } 191 }
204 screen->update_viewport(); 192 screen->update_viewport();
205end: 193end: