summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
authorTeruaki Kawashima <teru@rockbox.org>2009-11-10 13:40:50 +0000
committerTeruaki Kawashima <teru@rockbox.org>2009-11-10 13:40:50 +0000
commit0771686339d14fe9f0d3bfce447e2e63bba5a473 (patch)
tree58b8e487bb50ec43e8c0e65ee6f0a472436a260d /apps/gui
parentc4df53571c89945f920f82f7e25b6a3c0757d5d5 (diff)
usb screen: show logo at center of ui viewport and try to fit logo and title to the viewoprt to avoid possible redraw issue with sbs.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23601 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/usb_screen.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/apps/gui/usb_screen.c b/apps/gui/usb_screen.c
index 7d61435eb8..5306b014f0 100644
--- a/apps/gui/usb_screen.c
+++ b/apps/gui/usb_screen.c
@@ -20,6 +20,7 @@
****************************************************************************/
#include "action.h"
+#include "font.h"
#ifdef HAVE_REMOTE_LCD
#include "lcd-remote.h"
#endif
@@ -157,8 +158,8 @@ static void usb_screen_fix_viewports(struct screen *screen,
viewport_set_fullscreen(parent, screen->screen_type);
*logo = *parent;
- logo->x = parent->width - logo_width;
- logo->y = (parent->height - logo_height) / 2;
+ logo->x = parent->x + parent->width - logo_width;
+ logo->y = parent->y + (parent->height - logo_height) / 2;
logo->width = logo_width;
logo->height = logo_height;
@@ -166,20 +167,16 @@ static void usb_screen_fix_viewports(struct screen *screen,
if (usb_hid)
{
struct viewport *title = &usb_screen_vps->title;
- int char_height, nb_lines;
-
- /* nb_lines only returns the number of fully visible lines, small
- * screens or really large fonts could cause problems with the
- * calculation below.
- */
- nb_lines = viewport_get_nb_lines(parent);
- if (nb_lines == 0)
- nb_lines++;
-
- char_height = parent->height/nb_lines;
-
+ int char_height = font_get(parent->font)->height;
*title = *parent;
title->y = logo->y + logo->height + char_height;
+ title->height = char_height;
+ /* try to fit logo and title to parent */
+ if (parent->y + parent->height < title->y + title->height)
+ {
+ logo->y = parent->y;
+ title->y = parent->y + logo->height;
+ }
}
#endif
}