]> git.itanic.dy.fi Git - mandelbrot/commitdiff
Fix broken aspect ratio calculation master
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Sun, 8 May 2011 15:53:28 +0000 (18:53 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Sun, 8 May 2011 15:53:28 +0000 (18:53 +0300)
One must use floating point division

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
mandelbrot.c

index a00be93beec714c0b81b177cf3cdaf4a548e2140..9ca242101ae1bad4a2f98aa5e89387dee82f36f0 100644 (file)
@@ -163,7 +163,7 @@ static void loop(struct context *ctx)
        int last_zoom;
 
        do {
-               aspect_ratio = ctx->screen->w / ctx->screen->h;
+               aspect_ratio = ctx->screen->w / (long double)ctx->screen->h;
                ctx->origo_x += ctx->motion_x / ctx->zoom / ctx->screen->w;
                ctx->origo_y += ctx->motion_y / ctx->zoom / ctx->screen->h;
                ctx->motion_x = ctx->motion_y = 0;