1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Thomas Martitz 2014-01-16 00:28:18 +01:00
parent a6483344f6
commit aa4c2a53f3

View file

@ -142,10 +142,8 @@ static void usb_screen_fix_viewports(struct screen *screen,
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
if (screen->screen_type == SCREEN_REMOTE) if (screen->screen_type == SCREEN_REMOTE)
{ {
logo_width = (BMPWIDTH_remote_usblogo > LCD_REMOTE_WIDTH) ? logo_width = BMPWIDTH_remote_usblogo;
LCD_REMOTE_WIDTH : BMPWIDTH_remote_usblogo; logo_height = BMPHEIGHT_remote_usblogo;
logo_height = (BMPHEIGHT_remote_usblogo > LCD_REMOTE_HEIGHT) ?
LCD_REMOTE_HEIGHT : BMPHEIGHT_remote_usblogo;
} }
else else
#endif #endif
@ -156,6 +154,11 @@ static void usb_screen_fix_viewports(struct screen *screen,
viewportmanager_theme_enable(screen->screen_type, true, parent); viewportmanager_theme_enable(screen->screen_type, true, parent);
if (logo_width > parent->width)
logo_width = parent->width;
if (logo_height > parent->height)
logo_height = parent->height;
*logo = *parent; *logo = *parent;
logo->x = parent->x + parent->width - logo_width; logo->x = parent->x + parent->width - logo_width;
logo->y = parent->y + (parent->height - logo_height) / 2; logo->y = parent->y + (parent->height - logo_height) / 2;