diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/sliding_puzzle.c | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/apps/plugins/sliding_puzzle.c b/apps/plugins/sliding_puzzle.c index 85f4d32f68..fa9e093c3c 100644 --- a/apps/plugins/sliding_puzzle.c +++ b/apps/plugins/sliding_puzzle.c | |||
@@ -19,7 +19,6 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | #include "lib/bmp.h" | ||
23 | 22 | ||
24 | #ifdef HAVE_LCD_BITMAP | 23 | #ifdef HAVE_LCD_BITMAP |
25 | PLUGIN_HEADER | 24 | PLUGIN_HEADER |
@@ -258,13 +257,9 @@ static int num_font = FONT_UI; | |||
258 | static int moves_font = FONT_UI; | 257 | static int moves_font = FONT_UI; |
259 | static int moves_y = 0; | 258 | static int moves_y = 0; |
260 | 259 | ||
261 | #ifdef HAVE_LCD_COLOR | 260 | static unsigned char img_buf |
262 | static unsigned char *img_buf; | 261 | [BM_SCALED_SIZE(IMAGE_WIDTH,IMAGE_HEIGHT,FORMAT_NATIVE,0)] |
263 | static size_t buf_len; | 262 | __attribute__ ((aligned(16))); |
264 | #else | ||
265 | static unsigned char img_buf[IMAGE_WIDTH*IMAGE_HEIGHT*sizeof(fb_data)] | ||
266 | __attribute__ ((aligned(16))); | ||
267 | #endif | ||
268 | #ifdef HAVE_ALBUMART | 263 | #ifdef HAVE_ALBUMART |
269 | static char albumart_path[MAX_PATH+1]; | 264 | static char albumart_path[MAX_PATH+1]; |
270 | #endif | 265 | #endif |
@@ -343,13 +338,9 @@ static bool load_resize_bitmap(void) | |||
343 | main_bitmap.width = IMAGE_WIDTH; | 338 | main_bitmap.width = IMAGE_WIDTH; |
344 | main_bitmap.height = IMAGE_HEIGHT; | 339 | main_bitmap.height = IMAGE_HEIGHT; |
345 | 340 | ||
346 | #ifndef HAVE_LCD_COLOR | ||
347 | size_t buf_len = sizeof(img_buf); | ||
348 | #endif | ||
349 | |||
350 | rc = rb->read_bmp_file( filename, &main_bitmap, | 341 | rc = rb->read_bmp_file( filename, &main_bitmap, |
351 | buf_len, | 342 | sizeof(img_buf), |
352 | FORMAT_NATIVE|FORMAT_RESIZE ); | 343 | FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_DITHER); |
353 | if( rc > 0 ) | 344 | if( rc > 0 ) |
354 | { | 345 | { |
355 | puzzle_bmp_ptr = (const fb_data *)img_buf; | 346 | puzzle_bmp_ptr = (const fb_data *)img_buf; |
@@ -574,7 +565,8 @@ static int puzzle_loop(void) | |||
574 | /* change picture */ | 565 | /* change picture */ |
575 | picmode = (picmode+1)%PICMODE_LAST_XXX; | 566 | picmode = (picmode+1)%PICMODE_LAST_XXX; |
576 | 567 | ||
577 | /* if load_resize_bitmap fails to load bitmap, try next picmode */ | 568 | /* if load_resize_bitmap fails to load bitmap, try next picmode |
569 | */ | ||
578 | do | 570 | do |
579 | { | 571 | { |
580 | load_success = load_resize_bitmap(); | 572 | load_success = load_resize_bitmap(); |
@@ -618,7 +610,8 @@ static int puzzle_loop(void) | |||
618 | } | 610 | } |
619 | } | 611 | } |
620 | 612 | ||
621 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) | 613 | enum plugin_status plugin_start(const struct plugin_api* api, |
614 | const void* parameter) | ||
622 | { | 615 | { |
623 | int i, w, h; | 616 | int i, w, h; |
624 | 617 | ||
@@ -627,13 +620,6 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame | |||
627 | initial_bmp_path=(const char *)parameter; | 620 | initial_bmp_path=(const char *)parameter; |
628 | picmode = PICMODE_INITIAL_PICTURE; | 621 | picmode = PICMODE_INITIAL_PICTURE; |
629 | img_buf_path[0] = '\0'; | 622 | img_buf_path[0] = '\0'; |
630 | #ifdef HAVE_LCD_COLOR | ||
631 | unsigned char *img_buf_end; | ||
632 | img_buf = (unsigned char *)(rb->plugin_get_buffer(&buf_len)); | ||
633 | img_buf_end = img_buf + buf_len; | ||
634 | rb->align_buffer(PUN_PTR(void **,&img_buf), buf_len, 16); | ||
635 | buf_len = img_buf_end - img_buf; | ||
636 | #endif | ||
637 | 623 | ||
638 | /* If launched as a viewer, just go straight to the game without | 624 | /* If launched as a viewer, just go straight to the game without |
639 | bothering with the splash or instructions page */ | 625 | bothering with the splash or instructions page */ |