xstep = xlen / (double)screen->w;
ystep = ylen / (double)screen->h;
- for (ys = 0, y0 = y1; ys < screen->h; y0 += ystep, ys++) {
- for (xs = 0, x0 = x1; xs < screen->w; x0 += xstep, xs++) {
+ y0 = y1;
+#pragma omp parallel for private(xs, ys, x0, y0)
+ for (ys = 0; ys < screen->h; ys++) {
+ y0 = y1 + ystep * ys;
+ x0 = x1;
+ for (xs = 0; xs < screen->w; xs++) {
iteration = get_mandelbrot_iterations(x0, y0);
if (iteration == MAX_ITERATION)
putpixel(screen, xs, ys,
iteration * 8, iteration,
iteration / 4);
+ x0 += xstep;
}
-
- SDL_Flip(screen);
}
+ SDL_Flip(screen);
return 0;
}