summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/mandelbrot.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/apps/plugins/mandelbrot.c b/apps/plugins/mandelbrot.c
index a1a86c8d87..d96f697a19 100644
--- a/apps/plugins/mandelbrot.c
+++ b/apps/plugins/mandelbrot.c
@@ -184,6 +184,7 @@ PLUGIN_HEADER
184#define MYLCD_UPDATE() 184#define MYLCD_UPDATE()
185#define MYXLCD(fn) gray_ub_ ## fn 185#define MYXLCD(fn) gray_ub_ ## fn
186#else 186#else
187#define UPDATE_FREQ (HZ/50)
187#define MYLCD(fn) rb->lcd_ ## fn 188#define MYLCD(fn) rb->lcd_ ## fn
188#define MYLCD_UPDATE() rb->lcd_update(); 189#define MYLCD_UPDATE() rb->lcd_update();
189#define MYXLCD(fn) xlcd_ ## fn 190#define MYXLCD(fn) xlcd_ ## fn
@@ -439,6 +440,10 @@ void init_mandelbrot_set(void)
439void calc_mandelbrot_low_prec(void) 440void calc_mandelbrot_low_prec(void)
440{ 441{
441 long start_tick, last_yield; 442 long start_tick, last_yield;
443#ifndef USEGSLIB
444 long next_update = *rb->current_tick;
445 int last_px = px_min;
446#endif
442 unsigned n_iter; 447 unsigned n_iter;
443 long a32, b32; 448 long a32, b32;
444 short x, x2, y, y2, a, b; 449 short x, x2, y, y2, a, b;
@@ -482,11 +487,17 @@ void calc_mandelbrot_low_prec(void)
482 } 487 }
483#ifdef USEGSLIB 488#ifdef USEGSLIB
484 gray_ub_gray_bitmap_part(imgbuffer, 0, py_min, 1, 489 gray_ub_gray_bitmap_part(imgbuffer, 0, py_min, 1,
485 p_x, py_min, 1, py_max-py_min); 490 p_x, py_min, 1, py_max - py_min);
486#else 491#else
487 rb->lcd_bitmap_part(imgbuffer, 0, py_min, 1, 492 rb->lcd_bitmap_part(imgbuffer, 0, py_min, 1,
488 p_x, py_min, 1, py_max-py_min); 493 p_x, py_min, 1, py_max - py_min);
489 rb->lcd_update_rect(p_x, py_min, 1, py_max-py_min); 494 if ((p_x == px_max - 1) || TIME_AFTER(*rb->current_tick, next_update))
495 {
496 next_update = *rb->current_tick + UPDATE_FREQ;
497 rb->lcd_update_rect(last_px, py_min, p_x - last_px + 1,
498 py_max - py_min);
499 last_px = p_x;
500 }
490#endif 501#endif
491 } 502 }
492} 503}
@@ -494,6 +505,10 @@ void calc_mandelbrot_low_prec(void)
494void calc_mandelbrot_high_prec(void) 505void calc_mandelbrot_high_prec(void)
495{ 506{
496 long start_tick, last_yield; 507 long start_tick, last_yield;
508#ifndef USEGSLIB
509 long next_update = *rb->current_tick;
510 int last_px = px_min;
511#endif
497 unsigned n_iter; 512 unsigned n_iter;
498 long x, x2, y, y2, a, b; 513 long x, x2, y, y2, a, b;
499 int p_x, p_y; 514 int p_x, p_y;
@@ -535,11 +550,17 @@ void calc_mandelbrot_high_prec(void)
535 } 550 }
536#ifdef USEGSLIB 551#ifdef USEGSLIB
537 gray_ub_gray_bitmap_part(imgbuffer, 0, py_min, 1, 552 gray_ub_gray_bitmap_part(imgbuffer, 0, py_min, 1,
538 p_x, py_min, 1, py_max-py_min); 553 p_x, py_min, 1, py_max - py_min);
539#else 554#else
540 rb->lcd_bitmap_part(imgbuffer, 0, py_min, 1, 555 rb->lcd_bitmap_part(imgbuffer, 0, py_min, 1,
541 p_x, py_min, 1, py_max-py_min); 556 p_x, py_min, 1, py_max-py_min);
542 rb->lcd_update_rect(p_x, py_min, 1, py_max-py_min); 557 if ((p_x == px_max - 1) || TIME_AFTER(*rb->current_tick, next_update))
558 {
559 next_update = *rb->current_tick + UPDATE_FREQ;
560 rb->lcd_update_rect(last_px, py_min, p_x - last_px + 1,
561 py_max - py_min);
562 last_px = p_x;
563 }
543#endif 564#endif
544 } 565 }
545} 566}