diff options
author | Thomas Martitz <kugel@rockbox.org> | 2014-01-16 00:28:18 +0100 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2014-01-16 00:28:18 +0100 |
commit | aa4c2a53f35c6bdca7e64ddc1539d2c00f6f4a18 (patch) | |
tree | 39156aa3316bea96fc760960956f9c43b24a3a57 /apps | |
parent | a6483344f6936f9f4daf657410f2873bf0247be5 (diff) | |
download | rockbox-aa4c2a53f35c6bdca7e64ddc1539d2c00f6f4a18.tar.gz rockbox-aa4c2a53f35c6bdca7e64ddc1539d2c00f6f4a18.zip |
usb screen: Crop logo to the UI viewport dimensions.
If the UI viewport is too small only the most top/left parts of the logo will
be displayed. This goes one step further than bac85f2.
Change-Id: I832b0e787e57e3b102a9c097cf1cccd7d4ad92d9
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/usb_screen.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/gui/usb_screen.c b/apps/gui/usb_screen.c index dc75f81a71..9915e27cac 100644 --- a/apps/gui/usb_screen.c +++ b/apps/gui/usb_screen.c | |||
@@ -142,10 +142,8 @@ static void usb_screen_fix_viewports(struct screen *screen, | |||
142 | #ifdef HAVE_REMOTE_LCD | 142 | #ifdef HAVE_REMOTE_LCD |
143 | if (screen->screen_type == SCREEN_REMOTE) | 143 | if (screen->screen_type == SCREEN_REMOTE) |
144 | { | 144 | { |
145 | logo_width = (BMPWIDTH_remote_usblogo > LCD_REMOTE_WIDTH) ? | 145 | logo_width = BMPWIDTH_remote_usblogo; |
146 | LCD_REMOTE_WIDTH : BMPWIDTH_remote_usblogo; | 146 | logo_height = BMPHEIGHT_remote_usblogo; |
147 | logo_height = (BMPHEIGHT_remote_usblogo > LCD_REMOTE_HEIGHT) ? | ||
148 | LCD_REMOTE_HEIGHT : BMPHEIGHT_remote_usblogo; | ||
149 | } | 147 | } |
150 | else | 148 | else |
151 | #endif | 149 | #endif |
@@ -156,6 +154,11 @@ static void usb_screen_fix_viewports(struct screen *screen, | |||
156 | 154 | ||
157 | viewportmanager_theme_enable(screen->screen_type, true, parent); | 155 | viewportmanager_theme_enable(screen->screen_type, true, parent); |
158 | 156 | ||
157 | if (logo_width > parent->width) | ||
158 | logo_width = parent->width; | ||
159 | if (logo_height > parent->height) | ||
160 | logo_height = parent->height; | ||
161 | |||
159 | *logo = *parent; | 162 | *logo = *parent; |
160 | logo->x = parent->x + parent->width - logo_width; | 163 | logo->x = parent->x + parent->width - logo_width; |
161 | logo->y = parent->y + (parent->height - logo_height) / 2; | 164 | logo->y = parent->y + (parent->height - logo_height) / 2; |