From c38bb5d3b202d783d094891015debdd3fc5e485c Mon Sep 17 00:00:00 2001 From: Louis Pearson Date: Thu, 1 Sep 2022 18:25:10 -0600 Subject: [PATCH] Add 2 to b1 instead of 1 I'm not sure why exactly this works, but it makes the ellipses slightly less boxy and makes rendering ovals more consistent. --- runtimes/native/src/framebuffer.c | 2 +- runtimes/web/src/framebuffer.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runtimes/native/src/framebuffer.c b/runtimes/native/src/framebuffer.c index 67bf4fcc..05e62fa6 100644 --- a/runtimes/native/src/framebuffer.c +++ b/runtimes/native/src/framebuffer.c @@ -415,7 +415,7 @@ void w4_framebufferOval (int x, int y, int width, int height) { // Error increments. Also known as the decision parameters int dx = 4 * (1 - a) * b * b; - int dy = 4 * (b1 + 1) * a * a; + int dy = 4 * (b1 + 2) * a * a; // Error of 1 step int err = dx + dy + b1 * a * a; diff --git a/runtimes/web/src/framebuffer.ts b/runtimes/web/src/framebuffer.ts index 9991f514..89342c25 100644 --- a/runtimes/web/src/framebuffer.ts +++ b/runtimes/web/src/framebuffer.ts @@ -170,7 +170,7 @@ export class Framebuffer { const fillColor = (dc0 - 1) & 0x3; let a = width; - let b = height; + const b = height; let b1 = (height + 1) % 2; // Compensates for precision loss when dividing let north = y; @@ -182,7 +182,7 @@ export class Framebuffer { // Error increments. Also known as the decision parameters let dx = 4 * (1 - a) * b * b; - let dy = 4 * (b1 + 1) * a * a; + let dy = 4 * (b1 + 2) * a * a; // Error of 1 step let err = dx + dy + b1 * a * a;