summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2010-04-29 10:27:35 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2010-04-29 10:27:35 +0000
commit886ecaa7a48f33a3fb124b53253b3a5602bbc920 (patch)
tree08877df4b8c45fcb690e6ab24e48c097e7f5a7a9
parent893180d47d7dd606e208987d57b95b29a57dfcc0 (diff)
downloadrockbox-886ecaa7a48f33a3fb124b53253b3a5602bbc920.tar.gz
rockbox-886ecaa7a48f33a3fb124b53253b3a5602bbc920.zip
centre splashes inside the UI viewport instead of the whole screen. Fixes the flickering statusbar issue and saves alot of fullscreen clears
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25755 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/splash.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/apps/gui/splash.c b/apps/gui/splash.c
index 7e4617bb73..958d19a2ff 100644
--- a/apps/gui/splash.c
+++ b/apps/gui/splash.c
@@ -35,6 +35,7 @@
35#define MAXLINES (LCD_HEIGHT/6) 35#define MAXLINES (LCD_HEIGHT/6)
36#define MAXBUFFER 512 36#define MAXBUFFER 512
37#define RECT_SPACING 2 37#define RECT_SPACING 2
38#define SPLASH_MEMORY_INTERVAL (HZ)
38 39
39#else /* HAVE_LCD_CHARCELLS */ 40#else /* HAVE_LCD_CHARCELLS */
40 41
@@ -57,6 +58,7 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
57 int x = 0; 58 int x = 0;
58 int y, i; 59 int y, i;
59 int space_w, w, h; 60 int space_w, w, h;
61 int width, height;
60#ifdef HAVE_LCD_BITMAP 62#ifdef HAVE_LCD_BITMAP
61 struct viewport vp; 63 struct viewport vp;
62 int maxw = 0; 64 int maxw = 0;
@@ -92,13 +94,13 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
92 if (lastbreak) 94 if (lastbreak)
93 { 95 {
94 if (x + (next - lastbreak) * space_w + w 96 if (x + (next - lastbreak) * space_w + w
95 > screen->lcdwidth - RECT_SPACING*2) 97 > vp.width - RECT_SPACING*2)
96 { /* too wide, wrap */ 98 { /* too wide, wrap */
97#ifdef HAVE_LCD_BITMAP 99#ifdef HAVE_LCD_BITMAP
98 if (x > maxw) 100 if (x > maxw)
99 maxw = x; 101 maxw = x;
100#endif 102#endif
101 if ((y + h > screen->lcdheight) || (line >= (MAXLINES-1))) 103 if ((y + h > vp.height) || (line >= (MAXLINES-1)))
102 break; /* screen full or out of lines */ 104 break; /* screen full or out of lines */
103 x = 0; 105 x = 0;
104 y += h; 106 y += h;
@@ -131,22 +133,23 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
131 screen->stop_scroll(); 133 screen->stop_scroll();
132 134
133#ifdef HAVE_LCD_BITMAP 135#ifdef HAVE_LCD_BITMAP
134 /* If we center the display, then just clear the box we need and put 136
135 a nice little frame and put the text in there! */ 137 vp.y = (vp.height - vp.y - y) / 2 - RECT_SPACING; /* height => y start position */
136 vp.y = (screen->lcdheight - y) / 2 - RECT_SPACING; /* height => y start position */ 138 vp.x += (vp.width - maxw) / 2 - RECT_SPACING;
137 vp.x = (screen->lcdwidth - maxw) / 2 - RECT_SPACING; 139 width = maxw + 2*RECT_SPACING;
138 vp.width = maxw + 2*RECT_SPACING; 140 height = y + 2*RECT_SPACING;
139 vp.height = screen->lcdheight - (vp.y*2) + RECT_SPACING;
140 141
141 if (vp.y < 0) 142 if (vp.y < 0)
142 vp.y = 0; 143 vp.y = 0;
143 if (vp.x < 0) 144 if (vp.x < 0)
144 vp.x = 0; 145 vp.x = 0;
145 if (vp.width > screen->lcdwidth) 146 if (width > vp.width)
146 vp.width = screen->lcdwidth; 147 width = vp.width;
147 if (vp.height > screen->lcdheight) 148 if (height > vp.height)
148 vp.height = screen->lcdheight; 149 height = vp.height;
149 150 vp.width = width;
151 vp.height = height;
152
150 vp.flags |= VP_FLAG_ALIGN_CENTER; 153 vp.flags |= VP_FLAG_ALIGN_CENTER;
151#if LCD_DEPTH > 1 154#if LCD_DEPTH > 1
152 if (screen->depth > 1) 155 if (screen->depth > 1)
@@ -204,15 +207,12 @@ void splashf(int ticks, const char *fmt, ...)
204 fmt = P2STR((unsigned char *)fmt); 207 fmt = P2STR((unsigned char *)fmt);
205 FOR_NB_SCREENS(i) 208 FOR_NB_SCREENS(i)
206 { 209 {
207 viewportmanager_theme_enable(i, false, NULL);
208 va_start(ap, fmt); 210 va_start(ap, fmt);
209 splash_internal(&(screens[i]), fmt, ap); 211 splash_internal(&(screens[i]), fmt, ap);
210 va_end(ap); 212 va_end(ap);
211 } 213 }
212 if (ticks) 214 if (ticks)
213 sleep(ticks); 215 sleep(ticks);
214 FOR_NB_SCREENS(i)
215 viewportmanager_theme_undo(i, false);
216} 216}
217 217
218void splash(int ticks, const char *str) 218void splash(int ticks, const char *str)