From aa4c2a53f35c6bdca7e64ddc1539d2c00f6f4a18 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Thu, 16 Jan 2014 00:28:18 +0100 Subject: 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 --- apps/gui/usb_screen.c | 11 +++++++---- 1 file 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, #ifdef HAVE_REMOTE_LCD if (screen->screen_type == SCREEN_REMOTE) { - logo_width = (BMPWIDTH_remote_usblogo > LCD_REMOTE_WIDTH) ? - LCD_REMOTE_WIDTH : BMPWIDTH_remote_usblogo; - logo_height = (BMPHEIGHT_remote_usblogo > LCD_REMOTE_HEIGHT) ? - LCD_REMOTE_HEIGHT : BMPHEIGHT_remote_usblogo; + logo_width = BMPWIDTH_remote_usblogo; + logo_height = BMPHEIGHT_remote_usblogo; } else #endif @@ -156,6 +154,11 @@ static void usb_screen_fix_viewports(struct screen *screen, 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->x = parent->x + parent->width - logo_width; logo->y = parent->y + (parent->height - logo_height) / 2; -- cgit v1.2.3