summary refs log tree commit diff
path: root/bin
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
commitd868c96aa700a5b3adc303a06aaceed6bd0b04dd (patch)
tree3bf4ab2fdebc9b505c8aefef36e3f07c7bb0207c /bin
parentApply brot color in a second pass and time frames (diff)
downloadsrc-d868c96aa700a5b3adc303a06aaceed6bd0b04dd.tar.gz
src-d868c96aa700a5b3adc303a06aaceed6bd0b04dd.zip
Sample at the centre of the pixel in brot
Diffstat (limited to 'bin')
-rw-r--r--bin/brot.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/brot.c b/bin/brot.c
index 1f76fd08..253167ae 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;