From 6cae42fccae3202834dcfcb9ac430f7f432edaca Mon Sep 17 00:00:00 2001 From: Andrew Mahone Date: Wed, 20 May 2009 09:47:11 +0000 Subject: [PATCH] Support JPEG album art in sliding_puzzle. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20993 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/sliding_puzzle.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/apps/plugins/sliding_puzzle.c b/apps/plugins/sliding_puzzle.c index 7df303df2d..7087fd64a5 100644 --- a/apps/plugins/sliding_puzzle.c +++ b/apps/plugins/sliding_puzzle.c @@ -229,6 +229,13 @@ PLUGIN_HEADER #endif #endif +#ifdef HAVE_ALBUMART +#include "lib/read_image.h" +#define READ_IMAGE read_image_file +#else +#define READ_IMAGE rb->read_bmp_file +#endif + #include "pluginbitmaps/sliding_puzzle.h" #define IMAGE_WIDTH BMPWIDTH_sliding_puzzle #define IMAGE_HEIGHT BMPHEIGHT_sliding_puzzle @@ -277,9 +284,8 @@ static int num_font = FONT_UI; static int moves_font = FONT_UI; static int moves_y = 0; -static unsigned char img_buf - [BM_SCALED_SIZE(IMAGE_WIDTH,IMAGE_HEIGHT,FORMAT_NATIVE,0)] - __attribute__ ((aligned(16))); +static unsigned char *img_buf; +static size_t img_buf_len; #ifdef HAVE_ALBUMART static char albumart_path[MAX_PATH+1]; #endif @@ -358,10 +364,10 @@ static bool load_resize_bitmap(void) main_bitmap.width = IMAGE_WIDTH; main_bitmap.height = IMAGE_HEIGHT; - rc = rb->read_bmp_file( filename, &main_bitmap, - sizeof(img_buf), - FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_DITHER, - NULL); + rc = READ_IMAGE( filename, &main_bitmap, + img_buf_len, + FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_DITHER, + NULL); if( rc > 0 ) { puzzle_bmp_ptr = (const fb_data *)img_buf; @@ -637,6 +643,7 @@ enum plugin_status plugin_start( int i, w, h; initial_bmp_path=(const char *)parameter; + img_buf = rb->plugin_get_buffer(&img_buf_len); picmode = PICMODE_INITIAL_PICTURE; img_buf_path[0] = '\0';