summaryrefslogtreecommitdiff
path: root/apps/gui/usb_screen.c
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/usb_screen.c
parentc4df53571c89945f920f82f7e25b6a3c0757d5d5 (diff)
downloadrockbox-0771686339d14fe9f0d3bfce447e2e63bba5a473.tar.gz
rockbox-0771686339d14fe9f0d3bfce447e2e63bba5a473.zip
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/usb_screen.c')
-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 @@
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22#include "action.h" 22#include "action.h"
23#include "font.h"
23#ifdef HAVE_REMOTE_LCD 24#ifdef HAVE_REMOTE_LCD
24#include "lcd-remote.h" 25#include "lcd-remote.h"
25#endif 26#endif
@@ -157,8 +158,8 @@ static void usb_screen_fix_viewports(struct screen *screen,
157 viewport_set_fullscreen(parent, screen->screen_type); 158 viewport_set_fullscreen(parent, screen->screen_type);
158 159
159 *logo = *parent; 160 *logo = *parent;
160 logo->x = parent->width - logo_width; 161 logo->x = parent->x + parent->width - logo_width;
161 logo->y = (parent->height - logo_height) / 2; 162 logo->y = parent->y + (parent->height - logo_height) / 2;
162 logo->width = logo_width; 163 logo->width = logo_width;
163 logo->height = logo_height; 164 logo->height = logo_height;
164 165
@@ -166,20 +167,16 @@ static void usb_screen_fix_viewports(struct screen *screen,
166 if (usb_hid) 167 if (usb_hid)
167 { 168 {
168 struct viewport *title = &usb_screen_vps->title; 169 struct viewport *title = &usb_screen_vps->title;
169 int char_height, nb_lines; 170 int char_height = font_get(parent->font)->height;
170
171 /* nb_lines only returns the number of fully visible lines, small
172 * screens or really large fonts could cause problems with the
173 * calculation below.
174 */
175 nb_lines = viewport_get_nb_lines(parent);
176 if (nb_lines == 0)
177 nb_lines++;
178
179 char_height = parent->height/nb_lines;
180
181 *title = *parent; 171 *title = *parent;
182 title->y = logo->y + logo->height + char_height; 172 title->y = logo->y + logo->height + char_height;
173 title->height = char_height;
174 /* try to fit logo and title to parent */
175 if (parent->y + parent->height < title->y + title->height)
176 {
177 logo->y = parent->y;
178 title->y = parent->y + logo->height;
179 }
183 } 180 }
184#endif 181#endif
185} 182}