diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/sliding_puzzle.c | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/apps/plugins/sliding_puzzle.c b/apps/plugins/sliding_puzzle.c index 755129c9b9..fddb6bebc2 100644 --- a/apps/plugins/sliding_puzzle.c +++ b/apps/plugins/sliding_puzzle.c | |||
@@ -249,11 +249,12 @@ static int num_font = FONT_UI; | |||
249 | static int moves_font = FONT_UI; | 249 | static int moves_font = FONT_UI; |
250 | static int moves_y = 0; | 250 | static int moves_y = 0; |
251 | 251 | ||
252 | #ifdef HAVE_LCD_COLOR | ||
253 | static unsigned char *img_buf; | ||
254 | static size_t buf_len; | ||
255 | #else | ||
252 | static unsigned char img_buf[IMAGE_WIDTH*IMAGE_HEIGHT*sizeof(fb_data)] | 256 | static unsigned char img_buf[IMAGE_WIDTH*IMAGE_HEIGHT*sizeof(fb_data)] |
253 | __attribute__ ((aligned(16))); | 257 | __attribute__ ((aligned(16))); |
254 | #if LCD_DEPTH>1 | ||
255 | static unsigned char temp_img_buf[LCD_WIDTH*LCD_HEIGHT*sizeof(fb_data)] | ||
256 | __attribute__ ((aligned(16))); | ||
257 | #endif | 258 | #endif |
258 | #ifdef HAVE_ALBUMART | 259 | #ifdef HAVE_ALBUMART |
259 | static char albumart_path[MAX_PATH+1]; | 260 | static char albumart_path[MAX_PATH+1]; |
@@ -330,37 +331,22 @@ static bool load_resize_bitmap(void) | |||
330 | rb->memset(&main_bitmap,0,sizeof(struct bitmap)); | 331 | rb->memset(&main_bitmap,0,sizeof(struct bitmap)); |
331 | main_bitmap.data = img_buf; | 332 | main_bitmap.data = img_buf; |
332 | 333 | ||
333 | #if LCD_DEPTH>1 | ||
334 | struct bitmap temp_bitmap; | ||
335 | rb->memset(&temp_bitmap,0,sizeof(struct bitmap)); | ||
336 | temp_bitmap.data = temp_img_buf; | ||
337 | |||
338 | main_bitmap.width = IMAGE_WIDTH; | 334 | main_bitmap.width = IMAGE_WIDTH; |
339 | main_bitmap.height = IMAGE_HEIGHT; | 335 | main_bitmap.height = IMAGE_HEIGHT; |
340 | 336 | ||
341 | rc = rb->read_bmp_file( filename, &temp_bitmap, sizeof(temp_img_buf), | 337 | #ifndef HAVE_LCD_COLOR |
342 | FORMAT_NATIVE ); | 338 | size_t buf_len = sizeof(img_buf); |
343 | if( rc > 0 ) | ||
344 | { | ||
345 | #ifdef HAVE_LCD_COLOR | ||
346 | smooth_resize_bitmap( &temp_bitmap, &main_bitmap ); | ||
347 | #else | ||
348 | simple_resize_bitmap( &temp_bitmap, &main_bitmap ); | ||
349 | #endif | 339 | #endif |
350 | puzzle_bmp_ptr = (const fb_data *)img_buf; | 340 | |
351 | rb->strcpy( img_buf_path, filename ); | 341 | rc = rb->read_bmp_file( filename, &main_bitmap, |
352 | return true; | 342 | buf_len, |
353 | } | 343 | FORMAT_NATIVE|FORMAT_RESIZE ); |
354 | #else | ||
355 | rc = rb->read_bmp_file( filename, &main_bitmap, sizeof(img_buf), | ||
356 | FORMAT_NATIVE ); | ||
357 | if( rc > 0 ) | 344 | if( rc > 0 ) |
358 | { | 345 | { |
359 | puzzle_bmp_ptr = (const fb_data *)img_buf; | 346 | puzzle_bmp_ptr = (const fb_data *)img_buf; |
360 | rb->strcpy( img_buf_path, filename ); | 347 | rb->strcpy( img_buf_path, filename ); |
361 | return true; | 348 | return true; |
362 | } | 349 | } |
363 | #endif | ||
364 | } | 350 | } |
365 | 351 | ||
366 | /* something must have failed. get_albumart_bmp_path could return | 352 | /* something must have failed. get_albumart_bmp_path could return |
@@ -632,6 +618,13 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame | |||
632 | initial_bmp_path=(const char *)parameter; | 618 | initial_bmp_path=(const char *)parameter; |
633 | picmode = PICMODE_INITIAL_PICTURE; | 619 | picmode = PICMODE_INITIAL_PICTURE; |
634 | img_buf_path[0] = '\0'; | 620 | img_buf_path[0] = '\0'; |
621 | #ifdef HAVE_LCD_COLOR | ||
622 | unsigned char *img_buf_end; | ||
623 | img_buf = (unsigned char *)(rb->plugin_get_buffer(&buf_len)); | ||
624 | img_buf_end = img_buf + buf_len; | ||
625 | rb->align_buffer(PUN_PTR(void **,&img_buf), buf_len, 16); | ||
626 | buf_len = img_buf_end - img_buf; | ||
627 | #endif | ||
635 | 628 | ||
636 | /* If launched as a viewer, just go straight to the game without | 629 | /* If launched as a viewer, just go straight to the game without |
637 | bothering with the splash or instructions page */ | 630 | bothering with the splash or instructions page */ |