summaryrefslogtreecommitdiffstats
path: root/apps/plugins/sliding_puzzle.c
diff options
context:
space:
mode:
authorAndrew Mahone <andrew.mahone@gmail.com>2009-05-20 09:47:11 +0000
committerAndrew Mahone <andrew.mahone@gmail.com>2009-05-20 09:47:11 +0000
commit6cae42fccae3202834dcfcb9ac430f7f432edaca (patch)
tree89612dd94f9febb67688d7987b8d5acf0fb90872 /apps/plugins/sliding_puzzle.c
parent132176e120a72dae053dc5d56c67a1a50485053c (diff)
downloadrockbox-6cae42fccae3202834dcfcb9ac430f7f432edaca.tar.gz
rockbox-6cae42fccae3202834dcfcb9ac430f7f432edaca.tar.bz2
rockbox-6cae42fccae3202834dcfcb9ac430f7f432edaca.zip
Support JPEG album art in sliding_puzzle.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20993 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/sliding_puzzle.c')
-rw-r--r--apps/plugins/sliding_puzzle.c21
1 files 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';