Support JPEG album art in sliding_puzzle.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20993 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Andrew Mahone 2009-05-20 09:47:11 +00:00
parent 132176e120
commit 6cae42fcca

View file

@ -229,6 +229,13 @@ PLUGIN_HEADER
#endif #endif
#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" #include "pluginbitmaps/sliding_puzzle.h"
#define IMAGE_WIDTH BMPWIDTH_sliding_puzzle #define IMAGE_WIDTH BMPWIDTH_sliding_puzzle
#define IMAGE_HEIGHT BMPHEIGHT_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_font = FONT_UI;
static int moves_y = 0; static int moves_y = 0;
static unsigned char img_buf static unsigned char *img_buf;
[BM_SCALED_SIZE(IMAGE_WIDTH,IMAGE_HEIGHT,FORMAT_NATIVE,0)] static size_t img_buf_len;
__attribute__ ((aligned(16)));
#ifdef HAVE_ALBUMART #ifdef HAVE_ALBUMART
static char albumart_path[MAX_PATH+1]; static char albumart_path[MAX_PATH+1];
#endif #endif
@ -358,10 +364,10 @@ static bool load_resize_bitmap(void)
main_bitmap.width = IMAGE_WIDTH; main_bitmap.width = IMAGE_WIDTH;
main_bitmap.height = IMAGE_HEIGHT; main_bitmap.height = IMAGE_HEIGHT;
rc = rb->read_bmp_file( filename, &main_bitmap, rc = READ_IMAGE( filename, &main_bitmap,
sizeof(img_buf), img_buf_len,
FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_DITHER, FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_DITHER,
NULL); NULL);
if( rc > 0 ) if( rc > 0 )
{ {
puzzle_bmp_ptr = (const fb_data *)img_buf; puzzle_bmp_ptr = (const fb_data *)img_buf;
@ -637,6 +643,7 @@ enum plugin_status plugin_start(
int i, w, h; int i, w, h;
initial_bmp_path=(const char *)parameter; initial_bmp_path=(const char *)parameter;
img_buf = rb->plugin_get_buffer(&img_buf_len);
picmode = PICMODE_INITIAL_PICTURE; picmode = PICMODE_INITIAL_PICTURE;
img_buf_path[0] = '\0'; img_buf_path[0] = '\0';