summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2007-10-28 14:41:21 +0000
committerJens Arnold <amiconn@rockbox.org>2007-10-28 14:41:21 +0000
commit36cd5f1e4b8cc693111edb415b06888fbcf06d1e (patch)
tree649af3ace41a26c70af1fbfbc96ce6ba9c913070
parentfec406c7a29f015c7fe1ded881e565a73b1e0d09 (diff)
downloadrockbox-36cd5f1e4b8cc693111edb415b06888fbcf06d1e.zip
rockbox-36cd5f1e4b8cc693111edb415b06888fbcf06d1e.tar.gz
rockbox-36cd5f1e4b8cc693111edb415b06888fbcf06d1e.tar.bz2
rockbox-36cd5f1e4b8cc693111edb415b06888fbcf06d1e.tar.xz
Mandelbrot: Don't update the display more often than 50 times per second on colour targets. Significantly increases speed on iPod Video.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15345 a1c6a512-1295-4272-9138-f99709370657
-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 a1a86c8..d96f697 100644
--- a/apps/plugins/mandelbrot.c
+++ b/apps/plugins/mandelbrot.c
@@ -184,6 +184,7 @@ PLUGIN_HEADER
#define MYLCD_UPDATE()
#define MYXLCD(fn) gray_ub_ ## fn
#else
+#define UPDATE_FREQ (HZ/50)
#define MYLCD(fn) rb->lcd_ ## fn
#define MYLCD_UPDATE() rb->lcd_update();
#define MYXLCD(fn) xlcd_ ## fn
@@ -439,6 +440,10 @@ void init_mandelbrot_set(void)
void calc_mandelbrot_low_prec(void)
{
long start_tick, last_yield;
+#ifndef USEGSLIB
+ long next_update = *rb->current_tick;
+ int last_px = px_min;
+#endif
unsigned n_iter;
long a32, b32;
short x, x2, y, y2, a, b;
@@ -482,11 +487,17 @@ void calc_mandelbrot_low_prec(void)
}
#ifdef USEGSLIB
gray_ub_gray_bitmap_part(imgbuffer, 0, py_min, 1,
- p_x, py_min, 1, py_max-py_min);
+ p_x, py_min, 1, py_max - py_min);
#else
rb->lcd_bitmap_part(imgbuffer, 0, py_min, 1,
- p_x, py_min, 1, py_max-py_min);
- rb->lcd_update_rect(p_x, py_min, 1, py_max-py_min);
+ p_x, py_min, 1, py_max - py_min);
+ if ((p_x == px_max - 1) || TIME_AFTER(*rb->current_tick, next_update))
+ {
+ next_update = *rb->current_tick + UPDATE_FREQ;
+ rb->lcd_update_rect(last_px, py_min, p_x - last_px + 1,
+ py_max - py_min);
+ last_px = p_x;
+ }
#endif
}
}
@@ -494,6 +505,10 @@ void calc_mandelbrot_low_prec(void)
void calc_mandelbrot_high_prec(void)
{
long start_tick, last_yield;
+#ifndef USEGSLIB
+ long next_update = *rb->current_tick;
+ int last_px = px_min;
+#endif
unsigned n_iter;
long x, x2, y, y2, a, b;
int p_x, p_y;
@@ -535,11 +550,17 @@ void calc_mandelbrot_high_prec(void)
}
#ifdef USEGSLIB
gray_ub_gray_bitmap_part(imgbuffer, 0, py_min, 1,
- p_x, py_min, 1, py_max-py_min);
+ p_x, py_min, 1, py_max - py_min);
#else
rb->lcd_bitmap_part(imgbuffer, 0, py_min, 1,
p_x, py_min, 1, py_max-py_min);
- rb->lcd_update_rect(p_x, py_min, 1, py_max-py_min);
+ if ((p_x == px_max - 1) || TIME_AFTER(*rb->current_tick, next_update))
+ {
+ next_update = *rb->current_tick + UPDATE_FREQ;
+ rb->lcd_update_rect(last_px, py_min, p_x - last_px + 1,
+ py_max - py_min);
+ last_px = p_x;
+ }
#endif
}
}