1
0
Fork 0
forked from len0rd/rockbox

Mandelbrot didn't yield() at all, leading to playback problems when heavily calculating mandelbrots

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4759 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2004-06-16 20:51:05 +00:00
parent c05b7d722a
commit 58f17cd082

View file

@ -48,14 +48,14 @@ void init_mandelbrot_set(void){
void calc_mandelbrot_set(void){ void calc_mandelbrot_set(void){
unsigned int start_tick; unsigned int start_tick, last_yield;
int n_iter; int n_iter;
int x_pixel, y_pixel; int x_pixel, y_pixel;
int x, x2, y, y2, a, b; int x, x2, y, y2, a, b;
int x_fact, y_fact; int x_fact, y_fact;
int brightness; int brightness;
start_tick = *rb->current_tick; start_tick = last_yield = *rb->current_tick;
gray_clear_display(); gray_clear_display();
@ -90,6 +90,12 @@ void calc_mandelbrot_set(void){
brightness = 255 - (31 * (n_iter & 7)); brightness = 255 - (31 * (n_iter & 7));
} }
graybuffer[y_pixel]=brightness; graybuffer[y_pixel]=brightness;
/* be nice to other threads:
* if at least one tick has passed, yield */
if (*rb->current_tick > last_yield){
rb->yield();
last_yield = *rb->current_tick;
}
} }
gray_drawgraymap(graybuffer, x_pixel, 0, 1, LCD_HEIGHT, 1); gray_drawgraymap(graybuffer, x_pixel, 0, 1, LCD_HEIGHT, 1);
} }