From 802ea462d052f191a6fb4c6998c84fda934a522f Mon Sep 17 00:00:00 2001 From: Andrew Mahone Date: Sat, 23 May 2009 07:55:14 +0000 Subject: Load PictureFlow logo from disk, discarding it after splash screen is done and freeing the used space for the slide cache. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21051 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/pictureflow/pictureflow.c | 40 +++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 13 deletions(-) (limited to 'apps/plugins/pictureflow/pictureflow.c') diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index 2bf8c20802..a1ad3d2776 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c @@ -29,8 +29,6 @@ #include "lib/pluginlib_actions.h" #include "lib/helper.h" #include "lib/configfile.h" -#include "lib/picture.h" -#include "pluginbitmaps/pictureflow_logo.h" #include "lib/grey.h" #include "lib/feature_wrappers.h" #include "lib/buflib.h" @@ -222,6 +220,7 @@ typedef fb_data pix_t; #define EMPTY_SLIDE CACHE_PREFIX "/emptyslide.pfraw" #define EMPTY_SLIDE_BMP PLUGIN_DEMOS_DIR "/pictureflow_emptyslide.bmp" +#define SPLASH_BMP PLUGIN_DEMOS_DIR "/pictureflow_splash.bmp" /* Error return values */ #define ERROR_NO_ALBUMS -1 @@ -278,10 +277,6 @@ struct pfraw_header { int32_t height; /* bmap height in pixels */ }; -const struct picture logos[]={ - {pictureflow_logo, BMPWIDTH_pictureflow_logo, BMPHEIGHT_pictureflow_logo}, -}; - enum show_album_name_values { album_name_hide = 0, album_name_bottom, album_name_top }; static char* show_album_name_conf[] = @@ -927,9 +922,24 @@ bool get_albumart_for_index_from_db(const int slide_index, char *buf, */ void draw_splashscreen(void) { + unsigned char * buf_tmp = buf; + size_t buf_tmp_size = buf_size; struct screen* display = rb->screens[0]; - const struct picture* logo = &(logos[display->screen_type]); - +#if FB_DATA_SZ > 1 + ALIGN_BUFFER(buf_tmp, buf_tmp_size, sizeof(fb_data)); +#endif + struct bitmap logo = { +#if LCD_WIDTH < 200 + .width = 100, + .height = 18, +#else + .width = 193, + .height = 34, +#endif + .data = buf_tmp + }; + int ret = rb->read_bmp_file(SPLASH_BMP, &logo, buf_tmp_size, FORMAT_NATIVE, + NULL); #if LCD_DEPTH > 1 rb->lcd_set_background(N_BRIGHT(0)); rb->lcd_set_foreground(N_BRIGHT(255)); @@ -938,13 +948,17 @@ void draw_splashscreen(void) #endif rb->lcd_clear_display(); + if (ret > 0) + { #if LCD_DEPTH == 1 /* Mono LCDs need the logo inverted */ - rb->lcd_set_drawmode(PICTUREFLOW_DRMODE ^ DRMODE_INVERSEVID); - picture_draw(display, logo, (LCD_WIDTH - logo->width) / 2, 10); - rb->lcd_set_drawmode(PICTUREFLOW_DRMODE); -#else - picture_draw(display, logo, (LCD_WIDTH - logo->width) / 2, 10); + rb->lcd_set_drawmode(PICTUREFLOW_DRMODE ^ DRMODE_INVERSEVID); #endif + display->bitmap(logo.data, (LCD_WIDTH - logo.width) / 2, 10, + logo.width, logo.height); +#if LCD_DEPTH == 1 /* Mono LCDs need the logo inverted */ + rb->lcd_set_drawmode(PICTUREFLOW_DRMODE); +#endif + } rb->lcd_update(); } -- cgit v1.2.3