summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorAndrew Mahone <andrew.mahone@gmail.com>2008-12-09 23:07:59 +0000
committerAndrew Mahone <andrew.mahone@gmail.com>2008-12-09 23:07:59 +0000
commit781421afa2085b841b52f876d80f484f565c0755 (patch)
treee952fe4857a1ee3edb91642bfbb96c93947748b4 /apps/plugins
parenta2c71fde1bdb1a62cf66ae0e3b9a864824930dd0 (diff)
downloadrockbox-781421afa2085b841b52f876d80f484f565c0755.tar.gz
rockbox-781421afa2085b841b52f876d80f484f565c0755.zip
resize-on-load for bitmap files on 2bpp and color targets
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19374 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/sliding_puzzle.c41
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;
249static int moves_font = FONT_UI; 249static int moves_font = FONT_UI;
250static int moves_y = 0; 250static int moves_y = 0;
251 251
252#ifdef HAVE_LCD_COLOR
253static unsigned char *img_buf;
254static size_t buf_len;
255#else
252static unsigned char img_buf[IMAGE_WIDTH*IMAGE_HEIGHT*sizeof(fb_data)] 256static unsigned char img_buf[IMAGE_WIDTH*IMAGE_HEIGHT*sizeof(fb_data)]
253__attribute__ ((aligned(16))); 257__attribute__ ((aligned(16)));
254#if LCD_DEPTH>1
255static 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
259static char albumart_path[MAX_PATH+1]; 260static 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 */