summary refs log tree commit diff
path: root/bin/brot.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-04-14 01:20:12 -0400
committerJune McEnroe <june@causal.agency>2018-04-14 01:20:12 -0400
commit877d771b4900f7e36a5302ef7d9d6d518e9f044e (patch)
tree5b1768ae8d69a3b256a62248fc27012892b3cd93 /bin/brot.c
parentApply brot color in a second pass and time frames (diff)
downloadsrc-877d771b4900f7e36a5302ef7d9d6d518e9f044e.tar.gz
src-877d771b4900f7e36a5302ef7d9d6d518e9f044e.zip
Sample at the centre of the pixel in brot
Diffstat (limited to 'bin/brot.c')
-rw-r--r--bin/brot.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/brot.c b/bin/brot.c
index ac54be56..f066414e 100644
--- a/bin/brot.c
+++ b/bin/brot.c
@@ -57,8 +57,8 @@ void draw(uint32_t *buf, size_t width, size_t height) {
     double xRatio = (width > height) ? (double)width / (double)height : 1.0;
     for (size_t y = 0; y < height; ++y) {
         for (size_t x = 0; x < width; ++x) {
-            double zx = ((double)x / (double)width - 0.5) * xRatio;
-            double zy = ((double)y / (double)height - 0.5) * yRatio;
+            double zx = (((double)x + 0.5) / (double)width - 0.5) * xRatio;
+            double zy = (((double)y + 0.5) / (double)height - 0.5) * yRatio;
             buf[y * width + x] = mandelbrot((zx + zy * I) * transform + translate);
         }
     }
@@ -81,7 +81,7 @@ bool input(char in) {
     switch (in) {
         case 'q': return false;
         break; case '.': depth++;
-        break; case ',': if (depth) depth--;
+        break; case ',': if (depth > 1) depth--;
         break; case 'l': translate += translateStep * transform;
         break; case 'h': translate -= translateStep * transform;
         break; case 'j': translate += translateStep * I * transform;