summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeruaki Kawashima <teru@rockbox.org>2010-11-13 14:06:55 +0000
committerTeruaki Kawashima <teru@rockbox.org>2010-11-13 14:06:55 +0000
commit47bbd6a4662d122b00a95bbb7a2e3d80cc45648e (patch)
tree152bc438f75726ee0095320fa4fe5eb3a26f06a8
parentca494b737e5a1cab03034d262841b774804106a8 (diff)
downloadrockbox-47bbd6a4662d122b00a95bbb7a2e3d80cc45648e.tar.gz
rockbox-47bbd6a4662d122b00a95bbb7a2e3d80cc45648e.zip
rockpaint: disable playback control if the buffer is taken from the audio buffer.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28575 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/rockpaint.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c
index 4e4791c659..ab1eb5e3db 100644
--- a/apps/plugins/rockpaint.c
+++ b/apps/plugins/rockpaint.c
@@ -418,7 +418,7 @@ struct incdec_ctx incdec_y = { ROWS, { 1, 4}, true };
418/* Maximum string size allowed for the text tool */ 418/* Maximum string size allowed for the text tool */
419#define MAX_TEXT 256 419#define MAX_TEXT 256
420 420
421typedef union 421union buf
422{ 422{
423 /* Used by fill and gradient algorithms */ 423 /* Used by fill and gradient algorithms */
424 struct 424 struct
@@ -452,9 +452,10 @@ typedef union
452 int fw_buf[30]; 452 int fw_buf[30];
453 char fontname_buf[30][MAX_PATH]; 453 char fontname_buf[30][MAX_PATH];
454 } text; 454 } text;
455} buf; 455};
456 456
457static buf *buffer; 457static union buf *buffer;
458static bool audio_buf = false;
458 459
459/* Current filename */ 460/* Current filename */
460static char filename[MAX_PATH]; 461static char filename[MAX_PATH];
@@ -2530,7 +2531,10 @@ static void goto_menu(void)
2530 break; 2531 break;
2531 2532
2532 case MAIN_MENU_PLAYBACK_CONTROL: 2533 case MAIN_MENU_PLAYBACK_CONTROL:
2533 playback_control( NULL ); 2534 if (!audio_buf)
2535 playback_control( NULL );
2536 else
2537 rb->splash(HZ, "Cannot restart playback");
2534 break; 2538 break;
2535 2539
2536 case MAIN_MENU_EXIT: 2540 case MAIN_MENU_EXIT:
@@ -2957,19 +2961,20 @@ static int save_bitmap( char *file )
2957enum plugin_status plugin_start(const void* parameter) 2961enum plugin_status plugin_start(const void* parameter)
2958{ 2962{
2959 size_t buffer_size; 2963 size_t buffer_size;
2960 buffer = (buf*) (((uintptr_t)rb->plugin_get_buffer(&buffer_size) + 3) & ~3); 2964 unsigned char *temp;
2965 temp = rb->plugin_get_buffer(&buffer_size);
2961 if (buffer_size < sizeof(*buffer) + 3) 2966 if (buffer_size < sizeof(*buffer) + 3)
2962 { 2967 {
2963 /* steal from audiobuffer if plugin buffer is too small */ 2968 /* steal from audiobuffer if plugin buffer is too small */
2964 buffer = (buf*) 2969 temp = rb->plugin_get_audio_buffer(&buffer_size);
2965 (((uintptr_t)rb->plugin_get_audio_buffer(&buffer_size) + 3) & ~3);
2966
2967 if (buffer_size < sizeof(*buffer) + 3) 2970 if (buffer_size < sizeof(*buffer) + 3)
2968 { 2971 {
2969 rb->splash(HZ, "Not enough memory"); 2972 rb->splash(HZ, "Not enough memory");
2970 return PLUGIN_ERROR; 2973 return PLUGIN_ERROR;
2971 } 2974 }
2975 audio_buf = true;
2972 } 2976 }
2977 buffer = (union buf*) (((uintptr_t)temp + 3) & ~3);
2973 2978
2974 rb->lcd_set_foreground(COLOR_WHITE); 2979 rb->lcd_set_foreground(COLOR_WHITE);
2975 rb->lcd_set_backdrop(NULL); 2980 rb->lcd_set_backdrop(NULL);