diff options
author | Dave Chapman <dave@dchapman.com> | 2008-10-12 22:35:03 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2008-10-12 22:35:03 +0000 |
commit | 5134612ca903a854ff636e2442948b4ed1d5d885 (patch) | |
tree | d744429aadb59afb0cd6470d2d7d85a22ffa11c8 | |
parent | ca99f8efa49fbc053ea3a264c5cc23bda3b2a50c (diff) | |
download | rockbox-5134612ca903a854ff636e2442948b4ed1d5d885.tar.gz rockbox-5134612ca903a854ff636e2442948b4ed1d5d885.zip |
Remove usage of snprintf and strlen and instead calculate things at compile-time. Also swap the positions of the version text and logo for the Clip so we don't get a multi-coloured logo
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18793 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | bootloader/show_logo.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/bootloader/show_logo.c b/bootloader/show_logo.c index b655e511cf..0dc2b5ba20 100644 --- a/bootloader/show_logo.c +++ b/bootloader/show_logo.c | |||
@@ -26,21 +26,30 @@ | |||
26 | 26 | ||
27 | #include "rockboxlogo.h" | 27 | #include "rockboxlogo.h" |
28 | 28 | ||
29 | int show_logo( void ) | ||
30 | { | ||
31 | char boot_version[32]; | ||
32 | |||
33 | #if LCD_WIDTH <= 128 | 29 | #if LCD_WIDTH <= 128 |
34 | snprintf(boot_version, sizeof(boot_version), "Boot %s", APPSVERSION); | 30 | #define BOOT_VERSION ("Boot " APPSVERSION) |
35 | #else | 31 | #else |
36 | snprintf(boot_version, sizeof(boot_version), "Boot Ver. %s", APPSVERSION); | 32 | #define BOOT_VERSION ("Boot Ver. " APPSVERSION) |
37 | #endif | 33 | #endif |
38 | 34 | ||
35 | /* Ensure TEXT_XPOS is >= 0 */ | ||
36 | #define TEXT_WIDTH ((sizeof(BOOT_VERSION)-1)*SYSFONT_WIDTH) | ||
37 | #define TEXT_XPOS ((TEXT_WIDTH > LCD_WIDTH) ? 0 : ((LCD_WIDTH - TEXT_WIDTH) / 2)) | ||
38 | |||
39 | int show_logo( void ) | ||
40 | { | ||
39 | lcd_clear_display(); | 41 | lcd_clear_display(); |
40 | lcd_bitmap(rockboxlogo, 0, 10, BMPWIDTH_rockboxlogo, BMPHEIGHT_rockboxlogo); | ||
41 | lcd_setfont(FONT_SYSFIXED); | 42 | lcd_setfont(FONT_SYSFIXED); |
42 | lcd_putsxy((LCD_WIDTH/2) - ((strlen(boot_version)*SYSFONT_WIDTH)/2), | 43 | |
43 | LCD_HEIGHT-SYSFONT_HEIGHT, (unsigned char *)boot_version); | 44 | #ifdef SANSA_CLIP |
45 | /* The top 16 lines of the Sansa Clip screen are yellow, and the bottom 48 | ||
46 | are blue, so we reverse the usual positioning */ | ||
47 | lcd_putsxy(TEXT_XPOS, 0, BOOT_VERSION); | ||
48 | lcd_bitmap(rockboxlogo, 0, 16, BMPWIDTH_rockboxlogo, BMPHEIGHT_rockboxlogo); | ||
49 | #else | ||
50 | lcd_bitmap(rockboxlogo, 0, 10, BMPWIDTH_rockboxlogo, BMPHEIGHT_rockboxlogo); | ||
51 | lcd_putsxy(TEXT_XPOS, LCD_HEIGHT-SYSFONT_HEIGHT, BOOT_VERSION); | ||
52 | #endif | ||
44 | 53 | ||
45 | lcd_update(); | 54 | lcd_update(); |
46 | 55 | ||