Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 9f87b73

Browse files
committed
[[ Canvas ]] Fix a bug where small rounding errors could lead to an infinite loop
1 parent 64f4d64 commit 9f87b73

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libgraphics/src/path.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ static void _MCGPathArcTo(MCGPathRef self, MCGPathArcBeginStyle p_begin, const M
371371
if (p_sweep > 0)
372372
while (p_sweep > 0)
373373
{
374-
t_delta = MCMin( M_PI_2 - fmodf(p_start_angle, M_PI_2), p_sweep);
374+
t_delta = MCMin(p_sweep, M_PI_2);
375375
p_sweep -= t_delta;
376376

377377
_MCGPathAcuteArcTo(self, p_begin, p_center, p_radii, p_start_angle, t_delta, p_x_angle);
@@ -381,7 +381,7 @@ static void _MCGPathArcTo(MCGPathRef self, MCGPathArcBeginStyle p_begin, const M
381381
else
382382
while (p_sweep < 0)
383383
{
384-
t_delta = MCMin( M_PI_2 - fmodf(2 * M_PI - p_start_angle, M_PI_2), -p_sweep);
384+
t_delta = MCMin(-p_sweep, M_PI_2);
385385
p_sweep += t_delta;
386386

387387
_MCGPathAcuteArcTo(self, p_begin, p_center, p_radii, p_start_angle, -t_delta, p_x_angle);

0 commit comments

Comments
 (0)