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 | |
parent | a2fc6415708d2e0bdc83898eda749515046fad90 (diff) | |
download | rockbox-8ef2248f7c9c6ba41c9a373cb15e5458613a24f3.tar.gz rockbox-8ef2248f7c9c6ba41c9a373cb15e5458613a24f3.zip |
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
-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; | |||
181 | 181 | ||
182 | /* list of the jpeg files */ | 182 | /* list of the jpeg files */ |
183 | static char **file_pt; | 183 | static char **file_pt; |
184 | #if PLUGIN_BUFFER_SIZE >= MIN_MEM | ||
184 | /* are we using the plugin buffer or the audio buffer? */ | 185 | /* are we using the plugin buffer or the audio buffer? */ |
185 | bool plug_buf = false; | 186 | static bool plug_buf = true; |
187 | #endif | ||
186 | 188 | ||
187 | 189 | ||
188 | /************************* Implementation ***************************/ | 190 | /************************* Implementation ***************************/ |
@@ -980,7 +982,7 @@ int load_and_show(char* filename) | |||
980 | rb->lcd_puts(0,2,"Zoom In: Stop playback."); | 982 | rb->lcd_puts(0,2,"Zoom In: Stop playback."); |
981 | if(entries>1) | 983 | if(entries>1) |
982 | rb->lcd_puts(0,3,"Left/Right: Skip File."); | 984 | rb->lcd_puts(0,3,"Left/Right: Skip File."); |
983 | rb->lcd_puts(0,4,"Off: Quit."); | 985 | rb->lcd_puts(0,4,"Show Menu: Quit."); |
984 | rb->lcd_update(); | 986 | rb->lcd_update(); |
985 | rb->lcd_setfont(FONT_UI); | 987 | rb->lcd_setfont(FONT_UI); |
986 | 988 | ||
@@ -1159,10 +1161,11 @@ enum plugin_status plugin_start(const void* parameter) | |||
1159 | if(!entries) return PLUGIN_ERROR; | 1161 | if(!entries) return PLUGIN_ERROR; |
1160 | 1162 | ||
1161 | #if (PLUGIN_BUFFER_SIZE >= MIN_MEM) && !defined(SIMULATOR) | 1163 | #if (PLUGIN_BUFFER_SIZE >= MIN_MEM) && !defined(SIMULATOR) |
1162 | if(rb->audio_status()) | 1164 | if(!rb->audio_status()) |
1163 | plug_buf = true; | 1165 | { |
1164 | else | 1166 | plug_buf = false; |
1165 | buf = rb->plugin_get_audio_buffer((size_t *)&buf_size); | 1167 | buf = rb->plugin_get_audio_buffer((size_t *)&buf_size); |
1168 | } | ||
1166 | #endif | 1169 | #endif |
1167 | 1170 | ||
1168 | #ifdef USEGSLIB | 1171 | #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 | |||
146 | 146 | ||
147 | #define VERSION_STRING "20080927" | 147 | #define VERSION_STRING "20080927" |
148 | 148 | ||
149 | /* Min memory allowing us to use the plugin buffer | ||
150 | * and thus not stopping the music | ||
151 | * *Very* rough estimation: | ||
152 | * Max 10 000 dir entries * 4bytes/entry (char **) = 40000 bytes | ||
153 | * + 30k code size = 70 000 | ||
154 | * + 50k min for png = 130 000 | ||
155 | */ | ||
156 | #define MIN_MEM 130000 | ||
157 | |||
149 | /* Headings */ | 158 | /* Headings */ |
150 | #define DIR_PREV 1 | 159 | #define DIR_PREV 1 |
151 | #define DIR_NEXT -1 | 160 | #define DIR_NEXT -1 |
@@ -165,21 +174,13 @@ static size_t memory_size; | |||
165 | static unsigned char *image; /* where we put the content of the file */ | 174 | static unsigned char *image; /* where we put the content of the file */ |
166 | static size_t image_size; | 175 | static size_t image_size; |
167 | 176 | ||
168 | #if LCD_DEPTH >= 8 | ||
169 | static fb_data *converted_image __attribute__ ((aligned (16))); /* the (color) converted image */ | ||
170 | #else | ||
171 | static fb_data *converted_image; /* the (color) converted image */ | 177 | static fb_data *converted_image; /* the (color) converted image */ |
172 | #endif | ||
173 | static size_t converted_image_size; | 178 | static size_t converted_image_size; |
174 | 179 | ||
175 | static unsigned char *decoded_image; /* the decoded image */ | 180 | static unsigned char *decoded_image; /* the decoded image */ |
176 | static size_t decoded_image_size; | 181 | static size_t decoded_image_size; |
177 | 182 | ||
178 | #if LCD_DEPTH >= 8 | ||
179 | static fb_data *resized_image __attribute__ ((aligned (16))); /* the decoded image */ | ||
180 | #else | ||
181 | static fb_data *resized_image; /* the decoded image */ | 183 | static fb_data *resized_image; /* the decoded image */ |
182 | #endif | ||
183 | 184 | ||
184 | static struct tree_context *tree; | 185 | static struct tree_context *tree; |
185 | 186 | ||
@@ -189,10 +190,12 @@ static int curfile = 0, direction = DIR_NONE, entries = 0; | |||
189 | 190 | ||
190 | static LodePNG_Decoder decoder; | 191 | static LodePNG_Decoder decoder; |
191 | 192 | ||
192 | /* list of the jpeg files */ | 193 | /* list of the png files */ |
193 | static char **file_pt; | 194 | static char **file_pt; |
195 | #if PLUGIN_BUFFER_SIZE >= MIN_MEM | ||
194 | /* are we using the plugin buffer or the audio buffer? */ | 196 | /* are we using the plugin buffer or the audio buffer? */ |
195 | bool plug_buf = false; | 197 | static bool plug_buf = true; |
198 | #endif | ||
196 | 199 | ||
197 | /* Persistent configuration */ | 200 | /* Persistent configuration */ |
198 | #define PNG_CONFIGFILE "png.cfg" | 201 | #define PNG_CONFIGFILE "png.cfg" |
@@ -226,15 +229,6 @@ static struct configdata png_config[] = | |||
226 | static fb_data* old_backdrop; | 229 | static fb_data* old_backdrop; |
227 | #endif | 230 | #endif |
228 | 231 | ||
229 | /* Min memory allowing us to use the plugin buffer | ||
230 | * and thus not stopping the music | ||
231 | * *Very* rough estimation: | ||
232 | * Max 10 000 dir entries * 4bytes/entry (char **) = 40000 bytes | ||
233 | * + 30k code size = 70 000 | ||
234 | * + 50k min for png = 130 000 | ||
235 | */ | ||
236 | #define MIN_MEM 130000 | ||
237 | |||
238 | static int slideshow_enabled = false; /* run slideshow */ | 232 | static int slideshow_enabled = false; /* run slideshow */ |
239 | static int running_slideshow = false; /* loading image because of slideshw */ | 233 | static int running_slideshow = false; /* loading image because of slideshw */ |
240 | #ifndef SIMULATOR | 234 | #ifndef SIMULATOR |
@@ -1823,8 +1817,7 @@ int load_image(char* filename, struct LodePNG_Decoder* decoder) | |||
1823 | fd = rb->open(filename, O_RDONLY); | 1817 | fd = rb->open(filename, O_RDONLY); |
1824 | if (fd < 0) | 1818 | if (fd < 0) |
1825 | { | 1819 | { |
1826 | rb->snprintf(print,sizeof(print),"err opening %s:%d",filename,fd); | 1820 | rb->splashf(HZ, "err opening %s:%d", filename, fd); |
1827 | rb->splash(HZ, print); | ||
1828 | return PLUGIN_ERROR; | 1821 | return PLUGIN_ERROR; |
1829 | } | 1822 | } |
1830 | image_size = rb->filesize(fd); | 1823 | image_size = rb->filesize(fd); |
@@ -1913,9 +1906,11 @@ int load_image(char* filename, struct LodePNG_Decoder* decoder) | |||
1913 | } | 1906 | } |
1914 | 1907 | ||
1915 | if (decoder->error) { | 1908 | if (decoder->error) { |
1916 | if (decoder->error == FILE_TOO_LARGE || decoder->error == OUT_OF_MEMORY | 1909 | #if PLUGIN_BUFFER_SIZE >= MIN_MEM |
1917 | || decoder->error == Z_MEM_ERROR) | 1910 | if (plug_buf && (decoder->error == FILE_TOO_LARGE |
1911 | || decoder->error == OUT_OF_MEMORY || decoder->error == Z_MEM_ERROR)) | ||
1918 | return PLUGIN_OUTOFMEM; | 1912 | return PLUGIN_OUTOFMEM; |
1913 | #endif | ||
1919 | 1914 | ||
1920 | if (decoder->error >= PNG_ERROR_MIN && decoder->error <= PNG_ERROR_MAX | 1915 | if (decoder->error >= PNG_ERROR_MIN && decoder->error <= PNG_ERROR_MAX |
1921 | && png_error_messages[decoder->error-PNG_ERROR_MIN] != NULL) | 1916 | && png_error_messages[decoder->error-PNG_ERROR_MIN] != NULL) |
@@ -2070,7 +2065,7 @@ int load_and_show(char* filename) | |||
2070 | rb->lcd_puts(0,2,"Zoom In: Stop playback."); | 2065 | rb->lcd_puts(0,2,"Zoom In: Stop playback."); |
2071 | if (entries>1) | 2066 | if (entries>1) |
2072 | rb->lcd_puts(0,3,"Left/Right: Skip File."); | 2067 | rb->lcd_puts(0,3,"Left/Right: Skip File."); |
2073 | rb->lcd_puts(0,4,"Off: Quit."); | 2068 | rb->lcd_puts(0,4,"Show Menu: Quit."); |
2074 | rb->lcd_update(); | 2069 | rb->lcd_update(); |
2075 | rb->lcd_setfont(FONT_UI); | 2070 | rb->lcd_setfont(FONT_UI); |
2076 | 2071 | ||
@@ -2144,7 +2139,7 @@ int load_and_show(char* filename) | |||
2144 | ds_max = ds_min; | 2139 | ds_max = ds_min; |
2145 | } | 2140 | } |
2146 | 2141 | ||
2147 | ds = ds_max; /* initials setting */ | 2142 | ds = ds_max; /* initialize setting */ |
2148 | cx = decoder.infoPng.width/ds/2; /* center the view */ | 2143 | cx = decoder.infoPng.width/ds/2; /* center the view */ |
2149 | cy = decoder.infoPng.height/ds/2; | 2144 | cy = decoder.infoPng.height/ds/2; |
2150 | 2145 | ||
@@ -2233,9 +2228,8 @@ enum plugin_status plugin_start(const void* parameter) | |||
2233 | if (!entries) return PLUGIN_ERROR; | 2228 | if (!entries) return PLUGIN_ERROR; |
2234 | 2229 | ||
2235 | #if (PLUGIN_BUFFER_SIZE >= MIN_MEM) && !defined(SIMULATOR) | 2230 | #if (PLUGIN_BUFFER_SIZE >= MIN_MEM) && !defined(SIMULATOR) |
2236 | if (rb->audio_status()) { | 2231 | if (!rb->audio_status()) { |
2237 | plug_buf = true; | 2232 | plug_buf = false; |
2238 | } else { | ||
2239 | memory = rb->plugin_get_audio_buffer((size_t *)&memory_size); | 2233 | memory = rb->plugin_get_audio_buffer((size_t *)&memory_size); |
2240 | } | 2234 | } |
2241 | #endif | 2235 | #endif |