diff options
Diffstat (limited to 'apps/plugins/mandelbrot.c')
-rw-r--r-- | apps/plugins/mandelbrot.c | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/apps/plugins/mandelbrot.c b/apps/plugins/mandelbrot.c index d96f697a19..df1c2030e5 100644 --- a/apps/plugins/mandelbrot.c +++ b/apps/plugins/mandelbrot.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | 22 | ||
23 | #ifdef HAVE_LCD_BITMAP | 23 | #ifdef HAVE_LCD_BITMAP |
24 | #include "gray.h" | 24 | #include "grey.h" |
25 | #include "xlcd.h" | 25 | #include "xlcd.h" |
26 | 26 | ||
27 | PLUGIN_HEADER | 27 | PLUGIN_HEADER |
@@ -180,9 +180,9 @@ PLUGIN_HEADER | |||
180 | 180 | ||
181 | #if LCD_DEPTH < 8 | 181 | #if LCD_DEPTH < 8 |
182 | #define USEGSLIB | 182 | #define USEGSLIB |
183 | #define MYLCD(fn) gray_ub_ ## fn | 183 | #define MYLCD(fn) grey_ub_ ## fn |
184 | #define MYLCD_UPDATE() | 184 | #define MYLCD_UPDATE() |
185 | #define MYXLCD(fn) gray_ub_ ## fn | 185 | #define MYXLCD(fn) grey_ub_ ## fn |
186 | #else | 186 | #else |
187 | #define UPDATE_FREQ (HZ/50) | 187 | #define UPDATE_FREQ (HZ/50) |
188 | #define MYLCD(fn) rb->lcd_ ## fn | 188 | #define MYLCD(fn) rb->lcd_ ## fn |
@@ -486,7 +486,7 @@ void calc_mandelbrot_low_prec(void) | |||
486 | } | 486 | } |
487 | } | 487 | } |
488 | #ifdef USEGSLIB | 488 | #ifdef USEGSLIB |
489 | gray_ub_gray_bitmap_part(imgbuffer, 0, py_min, 1, | 489 | grey_ub_gray_bitmap_part(imgbuffer, 0, py_min, 1, |
490 | p_x, py_min, 1, py_max - py_min); | 490 | p_x, py_min, 1, py_max - py_min); |
491 | #else | 491 | #else |
492 | rb->lcd_bitmap_part(imgbuffer, 0, py_min, 1, | 492 | rb->lcd_bitmap_part(imgbuffer, 0, py_min, 1, |
@@ -549,7 +549,7 @@ void calc_mandelbrot_high_prec(void) | |||
549 | } | 549 | } |
550 | } | 550 | } |
551 | #ifdef USEGSLIB | 551 | #ifdef USEGSLIB |
552 | gray_ub_gray_bitmap_part(imgbuffer, 0, py_min, 1, | 552 | grey_ub_gray_bitmap_part(imgbuffer, 0, py_min, 1, |
553 | p_x, py_min, 1, py_max - py_min); | 553 | p_x, py_min, 1, py_max - py_min); |
554 | #else | 554 | #else |
555 | rb->lcd_bitmap_part(imgbuffer, 0, py_min, 1, | 555 | rb->lcd_bitmap_part(imgbuffer, 0, py_min, 1, |
@@ -569,7 +569,7 @@ void cleanup(void *parameter) | |||
569 | { | 569 | { |
570 | (void)parameter; | 570 | (void)parameter; |
571 | #ifdef USEGSLIB | 571 | #ifdef USEGSLIB |
572 | gray_release(); | 572 | grey_release(); |
573 | #endif | 573 | #endif |
574 | } | 574 | } |
575 | 575 | ||
@@ -582,10 +582,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
582 | int button; | 582 | int button; |
583 | int lastbutton = BUTTON_NONE; | 583 | int lastbutton = BUTTON_NONE; |
584 | int redraw = REDRAW_FULL; | 584 | int redraw = REDRAW_FULL; |
585 | #ifdef USEGSLIB | ||
586 | int grayscales; | ||
587 | char buff[32]; | ||
588 | #endif | ||
589 | 585 | ||
590 | rb = api; | 586 | rb = api; |
591 | (void)parameter; | 587 | (void)parameter; |
@@ -594,19 +590,13 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
594 | /* get the remainder of the plugin buffer */ | 590 | /* get the remainder of the plugin buffer */ |
595 | gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size); | 591 | gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size); |
596 | 592 | ||
597 | /* initialize the grayscale buffer: | 593 | /* initialize the greyscale buffer.*/ |
598 | * 8 bitplanes for 9 shades of gray.*/ | 594 | if (!grey_init(rb, gbuf, gbuf_size, false, LCD_WIDTH, LCD_HEIGHT, NULL)) |
599 | grayscales = gray_init(rb, gbuf, gbuf_size, false, LCD_WIDTH, LCD_HEIGHT, | 595 | { |
600 | 8, 0, NULL) + 1; | 596 | rb->splash(HZ, "Couldn't init greyscale display"); |
601 | if (grayscales != 9) { | 597 | return 0; |
602 | rb->snprintf(buff, sizeof(buff), "%d", grayscales); | ||
603 | rb->lcd_puts(0, 1, buff); | ||
604 | rb->lcd_update(); | ||
605 | rb->sleep(HZ*2); | ||
606 | return(0); | ||
607 | } | 598 | } |
608 | 599 | grey_show(true); /* switch on greyscale overlay */ | |
609 | gray_show(true); /* switch on grayscale overlay */ | ||
610 | #else | 600 | #else |
611 | xlcd_init(rb); | 601 | xlcd_init(rb); |
612 | #endif | 602 | #endif |
@@ -650,7 +640,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
650 | #endif | 640 | #endif |
651 | case MANDELBROT_QUIT: | 641 | case MANDELBROT_QUIT: |
652 | #ifdef USEGSLIB | 642 | #ifdef USEGSLIB |
653 | gray_release(); | 643 | grey_release(); |
654 | #endif | 644 | #endif |
655 | return PLUGIN_OK; | 645 | return PLUGIN_OK; |
656 | 646 | ||
@@ -755,7 +745,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
755 | lastbutton = button; | 745 | lastbutton = button; |
756 | } | 746 | } |
757 | #ifdef USEGSLIB | 747 | #ifdef USEGSLIB |
758 | gray_release(); | 748 | grey_release(); |
759 | #endif | 749 | #endif |
760 | return PLUGIN_OK; | 750 | return PLUGIN_OK; |
761 | } | 751 | } |