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
This commit is contained in:
Andrew Mahone 2009-05-23 07:55:14 +00:00
parent 9be554cb6a
commit 802ea462d0
3 changed files with 51 additions and 27 deletions

View file

@ -692,15 +692,6 @@ matrix_bold.bmp
matrix_normal.bmp
#endif
/* pictureflow */
#if defined(HAVE_LCD_BITMAP) && defined(HAVE_TAGCACHE)
#if (LCD_WIDTH < 200)
pictureflow_logo.100x18x16.bmp
#else
pictureflow_logo.193x34x16.bmp
#endif
#endif
/* Sliding puzzle */
#if (LCD_WIDTH != LCD_HEIGHT)
#define SMALLER_DIMENSION ((LCD_WIDTH < LCD_HEIGHT) ? LCD_WIDTH : LCD_HEIGHT)

View file

@ -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();
}

View file

@ -95,6 +95,8 @@ sub gettargetinfo {
#ifdef HAVE_LCD_BITMAP
Bitmap: yes
Depth: LCD_DEPTH
LCD Width: LCD_WIDTH
LCD Height: LCD_HEIGHT
Icon Width: CONFIG_DEFAULT_ICON_WIDTH
Icon Height: CONFIG_DEFAULT_ICON_HEIGHT
#endif
@ -119,7 +121,7 @@ STOP
open(TARGET, "$c|");
my ($bitmap, $depth, $swcodec, $icon_h, $icon_w);
my ($bitmap, $width, $height, $depth, $swcodec, $icon_h, $icon_w);
my ($remote_depth, $remote_icon_h, $remote_icon_w);
my ($recording);
my $icon_count = 1;
@ -131,6 +133,12 @@ STOP
elsif($_ =~ /^Depth: (\d*)/) {
$depth = $1;
}
elsif($_ =~ /^LCD Width: (\d*)/) {
$width = $1;
}
elsif($_ =~ /^LCD Height: (\d*)/) {
$height = $1;
}
elsif($_ =~ /^Icon Width: (\d*)/) {
$icon_w = $1;
}
@ -157,7 +165,7 @@ STOP
close(TARGET);
unlink("gcctemp");
return ($bitmap, $depth, $icon_w, $icon_h, $recording,
return ($bitmap, $depth, $width, $height, $icon_w, $icon_h, $recording,
$swcodec, $remote_depth, $remote_icon_w, $remote_icon_h);
}
@ -174,8 +182,9 @@ sub buildzip {
print "buildzip: image=$image fonts=$fonts\n" if $verbose;
my ($bitmap, $depth, $icon_w, $icon_h, $recording, $swcodec,
$remote_depth, $remote_icon_w, $remote_icon_h) = &gettargetinfo();
my ($bitmap, $depth, $width, $height, $icon_w, $icon_h, $recording,
$swcodec, $remote_depth, $remote_icon_w, $remote_icon_h) =
&gettargetinfo();
# print "Bitmap: $bitmap\nDepth: $depth\nSwcodec: $swcodec\n";
@ -351,7 +360,17 @@ STOP
}
if(-e "$rbdir/rocks/demos/pictureflow.rock") {
copy("$ROOT/apps/plugins/bitmaps/native/pictureflow_emptyslide.100x100x16.bmp", "$rbdir/rocks/demos/pictureflow_emptyslide.bmp");
copy("$ROOT/apps/plugins/bitmaps/native/pictureflow_emptyslide.100x100x16.bmp",
"$rbdir/rocks/demos/pictureflow_emptyslide.bmp");
my ($pf_logo);
if ($width < 200) {
$pf_logo = "pictureflow_logo.100x18x16.bmp";
} else {
$pf_logo = "pictureflow_logo.193x34x16.bmp";
}
copy("$ROOT/apps/plugins/bitmaps/native/$pf_logo",
"$rbdir/rocks/demos/pictureflow_splash.bmp");
}
if($image) {