diff options
| author | Andrew Mahone <andrew.mahone@gmail.com> | 2008-12-09 23:07:59 +0000 |
|---|---|---|
| committer | Andrew Mahone <andrew.mahone@gmail.com> | 2008-12-09 23:07:59 +0000 |
| commit | 781421afa2085b841b52f876d80f484f565c0755 (patch) | |
| tree | e952fe4857a1ee3edb91642bfbb96c93947748b4 /apps/plugins | |
| parent | a2c71fde1bdb1a62cf66ae0e3b9a864824930dd0 (diff) | |
| download | rockbox-781421afa2085b841b52f876d80f484f565c0755.zip rockbox-781421afa2085b841b52f876d80f484f565c0755.tar.gz rockbox-781421afa2085b841b52f876d80f484f565c0755.tar.bz2 rockbox-781421afa2085b841b52f876d80f484f565c0755.tar.xz | |
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.c | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/apps/plugins/sliding_puzzle.c b/apps/plugins/sliding_puzzle.c index 755129c..fddb6be 100644 --- a/apps/plugins/sliding_puzzle.c +++ b/apps/plugins/sliding_puzzle.c @@ -249,11 +249,12 @@ static int num_font = FONT_UI; static int moves_font = FONT_UI; static int moves_y = 0; +#ifdef HAVE_LCD_COLOR +static unsigned char *img_buf; +static size_t buf_len; +#else static unsigned char img_buf[IMAGE_WIDTH*IMAGE_HEIGHT*sizeof(fb_data)] __attribute__ ((aligned(16))); -#if LCD_DEPTH>1 -static unsigned char temp_img_buf[LCD_WIDTH*LCD_HEIGHT*sizeof(fb_data)] -__attribute__ ((aligned(16))); #endif #ifdef HAVE_ALBUMART static char albumart_path[MAX_PATH+1]; @@ -330,37 +331,22 @@ static bool load_resize_bitmap(void) rb->memset(&main_bitmap,0,sizeof(struct bitmap)); main_bitmap.data = img_buf; -#if LCD_DEPTH>1 - struct bitmap temp_bitmap; - rb->memset(&temp_bitmap,0,sizeof(struct bitmap)); - temp_bitmap.data = temp_img_buf; - main_bitmap.width = IMAGE_WIDTH; main_bitmap.height = IMAGE_HEIGHT; - rc = rb->read_bmp_file( filename, &temp_bitmap, sizeof(temp_img_buf), - FORMAT_NATIVE ); - if( rc > 0 ) - { -#ifdef HAVE_LCD_COLOR - smooth_resize_bitmap( &temp_bitmap, &main_bitmap ); -#else - simple_resize_bitmap( &temp_bitmap, &main_bitmap ); +#ifndef HAVE_LCD_COLOR + size_t buf_len = sizeof(img_buf); #endif - puzzle_bmp_ptr = (const fb_data *)img_buf; - rb->strcpy( img_buf_path, filename ); - return true; - } -#else - rc = rb->read_bmp_file( filename, &main_bitmap, sizeof(img_buf), - FORMAT_NATIVE ); + + rc = rb->read_bmp_file( filename, &main_bitmap, + buf_len, + FORMAT_NATIVE|FORMAT_RESIZE ); if( rc > 0 ) { puzzle_bmp_ptr = (const fb_data *)img_buf; rb->strcpy( img_buf_path, filename ); return true; } -#endif } /* 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 initial_bmp_path=(const char *)parameter; picmode = PICMODE_INITIAL_PICTURE; img_buf_path[0] = '\0'; +#ifdef HAVE_LCD_COLOR + unsigned char *img_buf_end; + img_buf = (unsigned char *)(rb->plugin_get_buffer(&buf_len)); + img_buf_end = img_buf + buf_len; + rb->align_buffer(PUN_PTR(void **,&img_buf), buf_len, 16); + buf_len = img_buf_end - img_buf; +#endif /* If launched as a viewer, just go straight to the game without bothering with the splash or instructions page */ |