09-01-2024, 02:23 AM
Ok. So, I did some research and figured out that the FC_Gold (a.k.a. FC0) performs well because it avoids the branching (ELSE part) inside the main loop. I made some modifications to optimize it even further. It avoids some unnecessary things keeping in mind not to overdraw pixels and hence not screwing up alpha blending.
Code: (Select All)
SUB DrawFilledCircle (cx AS LONG, cy AS LONG, r AS LONG, c AS _UNSIGNED LONG)
$CHECKING:OFF
IF r <= 0 THEN
PSET (cx, cy), c
EXIT SUB
END IF
DIM e AS LONG: e = -r
DIM x AS LONG: x = r
DIM y AS LONG
LINE (cx - x, cy)-(cx + x, cy), c, BF
DO WHILE x > y
y = y + 1
e = e + y * 2
IF e >= 0 THEN
IF x <> y THEN
LINE (cx - y, cy - x)-(cx + y, cy - x), c, BF
LINE (cx - y, cy + x)-(cx + y, cy + x), c, BF
END IF
x = x - 1
e = e - x * 2
END IF
LINE (cx - x, cy - y)-(cx + x, cy - y), c, BF
LINE (cx - x, cy + y)-(cx + x, cy + y), c, BF
LOOP
$CHECKING:ON
END SUB