summaryrefslogtreecommitdiffstats
path: root/apps
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 /apps
parent893180d47d7dd606e208987d57b95b29a57dfcc0 (diff)
downloadrockbox-886ecaa7a48f33a3fb124b53253b3a5602bbc920.tar.gz
rockbox-886ecaa7a48f33a3fb124b53253b3a5602bbc920.tar.bz2
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
Diffstat (limited to 'apps')
-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 @@
#define MAXLINES (LCD_HEIGHT/6)
#define MAXBUFFER 512
#define RECT_SPACING 2
+#define SPLASH_MEMORY_INTERVAL (HZ)
#else /* HAVE_LCD_CHARCELLS */
@@ -57,6 +58,7 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
int x = 0;
int y, i;
int space_w, w, h;
+ int width, height;
#ifdef HAVE_LCD_BITMAP
struct viewport vp;
int maxw = 0;
@@ -92,13 +94,13 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
if (lastbreak)
{
if (x + (next - lastbreak) * space_w + w
- > screen->lcdwidth - RECT_SPACING*2)
+ > vp.width - RECT_SPACING*2)
{ /* too wide, wrap */
#ifdef HAVE_LCD_BITMAP
if (x > maxw)
maxw = x;
#endif
- if ((y + h > screen->lcdheight) || (line >= (MAXLINES-1)))
+ if ((y + h > vp.height) || (line >= (MAXLINES-1)))
break; /* screen full or out of lines */
x = 0;
y += h;
@@ -131,22 +133,23 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
screen->stop_scroll();
#ifdef HAVE_LCD_BITMAP
- /* If we center the display, then just clear the box we need and put
- a nice little frame and put the text in there! */
- vp.y = (screen->lcdheight - y) / 2 - RECT_SPACING; /* height => y start position */
- vp.x = (screen->lcdwidth - maxw) / 2 - RECT_SPACING;
- vp.width = maxw + 2*RECT_SPACING;
- vp.height = screen->lcdheight - (vp.y*2) + RECT_SPACING;
+
+ vp.y = (vp.height - vp.y - y) / 2 - RECT_SPACING; /* height => y start position */
+ vp.x += (vp.width - maxw) / 2 - RECT_SPACING;
+ width = maxw + 2*RECT_SPACING;
+ height = y + 2*RECT_SPACING;
if (vp.y < 0)
vp.y = 0;
if (vp.x < 0)
vp.x = 0;
- if (vp.width > screen->lcdwidth)
- vp.width = screen->lcdwidth;
- if (vp.height > screen->lcdheight)
- vp.height = screen->lcdheight;
-
+ if (width > vp.width)
+ width = vp.width;
+ if (height > vp.height)
+ height = vp.height;
+ vp.width = width;
+ vp.height = height;
+
vp.flags |= VP_FLAG_ALIGN_CENTER;
#if LCD_DEPTH > 1
if (screen->depth > 1)
@@ -204,15 +207,12 @@ void splashf(int ticks, const char *fmt, ...)
fmt = P2STR((unsigned char *)fmt);
FOR_NB_SCREENS(i)
{
- viewportmanager_theme_enable(i, false, NULL);
va_start(ap, fmt);
splash_internal(&(screens[i]), fmt, ap);
va_end(ap);
}
if (ticks)
sleep(ticks);
- FOR_NB_SCREENS(i)
- viewportmanager_theme_undo(i, false);
}
void splash(int ticks, const char *str)