diff options
author | Teruaki Kawashima <teru@rockbox.org> | 2009-12-21 15:20:33 +0000 |
---|---|---|
committer | Teruaki Kawashima <teru@rockbox.org> | 2009-12-21 15:20:33 +0000 |
commit | 8ef2248f7c9c6ba41c9a373cb15e5458613a24f3 (patch) | |
tree | cbb87d4683b572cbe05e7079492ff0159d79baf1 /apps/plugins | |
parent | a2fc6415708d2e0bdc83898eda749515046fad90 (diff) |
jpeg,png: Change "Off: Quit." to "Show Menu: Quit." so that the message is less confusable.
fix bug plug_buf is always false in simulator even when plugin buffer is used.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24093 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/jpeg/jpeg.c | 13 | ||||
-rw-r--r-- | apps/plugins/png/png.c | 50 |
2 files changed, 30 insertions, 33 deletions
diff --git a/apps/plugins/jpeg/jpeg.c b/apps/plugins/jpeg/jpeg.c index e524b0cffd..4a61f13e51 100644 --- a/apps/plugins/jpeg/jpeg.c +++ b/apps/plugins/jpeg/jpeg.c @@ -181,8 +181,10 @@ static int curfile = 0, direction = DIR_NONE, entries = 0; /* list of the jpeg files */ static char **file_pt; +#if PLUGIN_BUFFER_SIZE >= MIN_MEM /* are we using the plugin buffer or the audio buffer? */ -bool plug_buf = false; +static bool plug_buf = true; +#endif /************************* Implementation ***************************/ @@ -980,7 +982,7 @@ int load_and_show(char* filename) rb->lcd_puts(0,2,"Zoom In: Stop playback."); if(entries>1) rb->lcd_puts(0,3,"Left/Right: Skip File."); - rb->lcd_puts(0,4,"Off: Quit."); + rb->lcd_puts(0,4,"Show Menu: Quit."); rb->lcd_update(); rb->lcd_setfont(FONT_UI); @@ -1159,10 +1161,11 @@ enum plugin_status plugin_start(const void* parameter) if(!entries) return PLUGIN_ERROR; #if (PLUGIN_BUFFER_SIZE >= MIN_MEM) && !defined(SIMULATOR) - if(rb->audio_status()) - plug_buf = true; - else + if(!rb->audio_status()) + { + plug_buf = false; buf = rb->plugin_get_audio_buffer((size_t *)&buf_size); + } #endif #ifdef USEGSLIB diff --git a/apps/plugins/png/png.c b/apps/plugins/png/png.c index 9e3b780907..3f826001c9 100644 --- a/apps/plugins/png/png.c +++ b/apps/plugins/png/png.c @@ -146,6 +146,15 @@ typedef struct LodePNG_Decoder #define VERSION_STRING "20080927" +/* Min memory allowing us to use the plugin buffer + * and thus not stopping the music + * *Very* rough estimation: + * Max 10 000 dir entries * 4bytes/entry (char **) = 40000 bytes + * + 30k code size = 70 000 + * + 50k min for png = 130 000 + */ +#define MIN_MEM 130000 + /* Headings */ #define DIR_PREV 1 #define DIR_NEXT -1 @@ -165,21 +174,13 @@ static size_t memory_size; static unsigned char *image; /* where we put the content of the file */ static size_t image_size; -#if LCD_DEPTH >= 8 -static fb_data *converted_image __attribute__ ((aligned (16))); /* the (color) converted image */ -#else static fb_data *converted_image; /* the (color) converted image */ -#endif static size_t converted_image_size; static unsigned char *decoded_image; /* the decoded image */ static size_t decoded_image_size; -#if LCD_DEPTH >= 8 -static fb_data *resized_image __attribute__ ((aligned (16))); /* the decoded image */ -#else static fb_data *resized_image; /* the decoded image */ -#endif static struct tree_context *tree; @@ -189,10 +190,12 @@ static int curfile = 0, direction = DIR_NONE, entries = 0; static LodePNG_Decoder decoder; -/* list of the jpeg files */ +/* list of the png files */ static char **file_pt; +#if PLUGIN_BUFFER_SIZE >= MIN_MEM /* are we using the plugin buffer or the audio buffer? */ -bool plug_buf = false; +static bool plug_buf = true; +#endif /* Persistent configuration */ #define PNG_CONFIGFILE "png.cfg" @@ -226,15 +229,6 @@ static struct configdata png_config[] = static fb_data* old_backdrop; #endif -/* Min memory allowing us to use the plugin buffer - * and thus not stopping the music - * *Very* rough estimation: - * Max 10 000 dir entries * 4bytes/entry (char **) = 40000 bytes - * + 30k code size = 70 000 - * + 50k min for png = 130 000 - */ -#define MIN_MEM 130000 - static int slideshow_enabled = false; /* run slideshow */ static int running_slideshow = false; /* loading image because of slideshw */ #ifndef SIMULATOR @@ -1823,8 +1817,7 @@ int load_image(char* filename, struct LodePNG_Decoder* decoder) fd = rb->open(filename, O_RDONLY); if (fd < 0) { - rb->snprintf(print,sizeof(print),"err opening %s:%d",filename,fd); - rb->splash(HZ, print); + rb->splashf(HZ, "err opening %s:%d", filename, fd); return PLUGIN_ERROR; } image_size = rb->filesize(fd); @@ -1913,9 +1906,11 @@ int load_image(char* filename, struct LodePNG_Decoder* decoder) } if (decoder->error) { - if (decoder->error == FILE_TOO_LARGE || decoder->error == OUT_OF_MEMORY - || decoder->error == Z_MEM_ERROR) +#if PLUGIN_BUFFER_SIZE >= MIN_MEM + if (plug_buf && (decoder->error == FILE_TOO_LARGE + || decoder->error == OUT_OF_MEMORY || decoder->error == Z_MEM_ERROR)) return PLUGIN_OUTOFMEM; +#endif if (decoder->error >= PNG_ERROR_MIN && decoder->error <= PNG_ERROR_MAX && png_error_messages[decoder->error-PNG_ERROR_MIN] != NULL) @@ -2070,7 +2065,7 @@ int load_and_show(char* filename) rb->lcd_puts(0,2,"Zoom In: Stop playback."); if (entries>1) rb->lcd_puts(0,3,"Left/Right: Skip File."); - rb->lcd_puts(0,4,"Off: Quit."); + rb->lcd_puts(0,4,"Show Menu: Quit."); rb->lcd_update(); rb->lcd_setfont(FONT_UI); @@ -2144,7 +2139,7 @@ int load_and_show(char* filename) ds_max = ds_min; } - ds = ds_max; /* initials setting */ + ds = ds_max; /* initialize setting */ cx = decoder.infoPng.width/ds/2; /* center the view */ cy = decoder.infoPng.height/ds/2; @@ -2233,9 +2228,8 @@ enum plugin_status plugin_start(const void* parameter) if (!entries) return PLUGIN_ERROR; #if (PLUGIN_BUFFER_SIZE >= MIN_MEM) && !defined(SIMULATOR) - if (rb->audio_status()) { - plug_buf = true; - } else { + if (!rb->audio_status()) { + plug_buf = false; memory = rb->plugin_get_audio_buffer((size_t *)&memory_size); } #endif |