aboutsummaryrefslogtreecommitdiff
path: root/helper.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-09-20 16:01:46 +0200
committerCharles <sircharlesaze@gmail.com>2019-09-20 16:01:46 +0200
commit5efde1e3e65af769cb629d55f0a4dd4f87caebe9 (patch)
tree88c685fad561e39fac869a36a93e98866e2ccb62 /helper.c
parent95b209426dd7a9f844cf1aa093a2b1c4301f049b (diff)
downloadmandelbrot-5efde1e3e65af769cb629d55f0a4dd4f87caebe9.tar.gz
mandelbrot-5efde1e3e65af769cb629d55f0a4dd4f87caebe9.tar.bz2
mandelbrot-5efde1e3e65af769cb629d55f0a4dd4f87caebe9.zip
Parallel computation, pixel array
- All the pixels are stored in an array, put in a surface then a texture so we don't draw each pixel one by one. - The computation of this array is done in parallel (one thread by line) - Use sscanf instead of atoi hack to parse options
Diffstat (limited to 'helper.c')
-rw-r--r--helper.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/helper.c b/helper.c
index 9920c5d..0290563 100644
--- a/helper.c
+++ b/helper.c
@@ -8,3 +8,15 @@ double map_range(double x, double src_lo, double src_hi, double dest_lo, double
return (x - src_lo) / src_len * dest_len + dest_lo;
}
+
+int *inclusive_range(int start, int end)
+{
+ if (end < start)
+ return NULL;
+ int *range = malloc(sizeof(int) * (end - start + 1));
+ if (range == NULL)
+ return NULL;
+ for (int i = 0; start < end; i++)
+ range[i] = start++;
+ return range;
+}