diff options
author | William Wilgus <wilgus.william@gmail.com> | 2022-11-09 03:04:50 -0500 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2022-11-09 11:22:56 -0500 |
commit | e8aaee4979800b51ee18ebed7690da1e81a95893 (patch) | |
tree | 81226b6b699afa57307724d035f97d720939c059 | |
parent | 51c1e3ce7fa2874f2b1afd0788ff7d2beba6a96e (diff) | |
download | rockbox-e8aaee4979.tar.gz rockbox-e8aaee4979.zip |
misc.c show_logo remove 'ver.' when screen is too small
since its too early for the scroll engine just remove 'ver. '
cleanup the getstringsize calls, only need to calculate it once
Change-Id: I5e866733ed38ffa0bf34ce1b5e11ed3afd78a04a
-rw-r--r-- | apps/misc.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/apps/misc.c b/apps/misc.c index 91f87ad06b..0ad1e62902 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -748,25 +748,32 @@ long default_event_handler(long event) int show_logo( void ) { - char version[32]; - int font_h, font_w; + unsigned char version[32]; + int font_h, ver_w; snprintf(version, sizeof(version), "Ver. %s", rbversion); + ver_w = font_getstringsize(version, NULL, &font_h, FONT_SYSFIXED); + lcd_clear_display(); + + lcd_setfont(FONT_SYSFIXED); + #if defined(SANSA_CLIP) || defined(SANSA_CLIPV2) || defined(SANSA_CLIPPLUS) /* display the logo in the blue area of the screen (bottom 48 pixels) */ - lcd_setfont(FONT_SYSFIXED); - lcd_getstringsize((unsigned char *)"A", &font_w, &font_h); - lcd_putsxy((LCD_WIDTH/2) - ((strlen(version)*font_w)/2), - 0, (unsigned char *)version); + if (ver_w > LCD_WIDTH) + lcd_putsxy(0, 0, rbversion); + else + lcd_putsxy((LCD_WIDTH/2) - (ver_w/2), 0, version); + lcd_bmp(&bm_rockboxlogo, (LCD_WIDTH - BMPWIDTH_rockboxlogo) / 2, 16); #else lcd_bmp(&bm_rockboxlogo, (LCD_WIDTH - BMPWIDTH_rockboxlogo) / 2, 10); - lcd_setfont(FONT_SYSFIXED); - lcd_getstringsize((unsigned char *)"A", &font_w, &font_h); - lcd_putsxy((LCD_WIDTH/2) - ((strlen(version)*font_w)/2), - LCD_HEIGHT-font_h, (unsigned char *)version); + + if (ver_w > LCD_WIDTH) + lcd_putsxy(0, LCD_HEIGHT-font_h, rbversion); + else + lcd_putsxy((LCD_WIDTH/2) - (ver_w/2), LCD_HEIGHT-font_h, version); #endif lcd_setfont(FONT_UI); @@ -776,9 +783,13 @@ int show_logo( void ) lcd_remote_clear_display(); lcd_remote_bmp(&bm_remote_rockboxlogo, 0, 10); lcd_remote_setfont(FONT_SYSFIXED); - lcd_remote_getstringsize((unsigned char *)"A", &font_w, &font_h); - lcd_remote_putsxy((LCD_REMOTE_WIDTH/2) - ((strlen(version)*font_w)/2), - LCD_REMOTE_HEIGHT-font_h, (unsigned char *)version); + + if (ver_w > LCD_REMOTE_WIDTH) + lcd_remote_putsxy(0, LCD_REMOTE_HEIGHT-font_h, rbversion); + else + lcd_remote_putsxy((LCD_REMOTE_WIDTH/2) - (ver_w/2), + LCD_REMOTE_HEIGHT-font_h, version); + lcd_remote_setfont(FONT_UI); lcd_remote_update(); #endif |