--- a/mandelbrot.c Fri Jun 06 18:35:46 2008 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-#include <stdlib.h>
-#include <time.h>
-
-#include "render_internal.h"
-#include "mandelbrot.h"
-#include "common.h"
-
-#define DETAIL 255
-
-#define absdelta(a, b) (a>b ? a-b : b-a)
-
-int render_mandelbrot (struct render *ctx) {
- // render algorithm vars
- u_int32_t img_x, img_y;
- double x0, y0, x, y, _x, _y, w_scale, h_scale;
- u_int8_t iter;
- u_int8_t *row;
-
- // calcluate the scale factors
- w_scale = ctx->img_w/absdelta(ctx->x1, ctx->x2);
- h_scale = ctx->img_h/absdelta(ctx->y1, ctx->y2);
-
- // start rendering!
- for (img_y=0; img_y < ctx->img_h; img_y++) {
- // render the current row
- for (img_x=0; img_x < ctx->img_w; img_x++) {
- x = 0;
- y = 0;
- x0 = img_x/w_scale + ctx->x1;
- y0 = img_y/h_scale + ctx->y1;
- iter = DETAIL;
-
- while (x*x + y*y < (2*2) && iter > 0) {
- _x = x*x - y*y + x0;
- _y = 2*x*y + y0;
-
- x = _x;
- y = _y;
-
- iter--;
- }
-
- (*ctx->local_rowbuf_addr)[img_x] = iter;
- }
-
- // row cb
- if (ctx->local_row_fn(ctx->cb_arg, (*ctx->local_rowbuf_addr)))
- ERROR("local_row_fn");
- }
-
- // return succesfully
- return 0;
-
-error:
- return -1;
-}
-
-int render_mandelbrot_timed (struct render *ctx, double *duration) {
- clock_t t1 = clock();
- int ret = render_mandelbrot(ctx);
- clock_t t2 = clock();
-
- *duration = ((double)(t2 - t1))/CLOCKS_PER_SEC;
-
- return ret;
-}
-