Bug 1394405 - Relax the assertion in CalculateDistanceToEllipticArc to deal with the floating point precision problem; r=nical

MozReview-Commit-ID: c0kgjG2zUg

--HG--
extra : rebase_source : 431a9afe9de492e05c7b9646282bfafa60389581
This commit is contained in:
Kevin Chen 2017-10-11 11:10:41 +08:00
parent aaa4b6ca26
commit 1ad9fc5044

View File

@ -326,13 +326,16 @@ CalculateDistanceToEllipticArc(const Point& P, const Point& normal,
Float S = sqrt(B * B - A * C);
Float n1 = (- B + S) / A;
Float n2 = (- B - S) / A;
Float n1 = - B + S;
Float n2 = - B - S;
MOZ_ASSERT(n1 >= 0);
MOZ_ASSERT(n2 >= 0);
#ifdef DEBUG
Float epsilon = (Float) 0.001;
MOZ_ASSERT(n1 >= -epsilon);
MOZ_ASSERT(n2 >= -epsilon);
#endif
return n1 < n2 ? n1 : n2;
return std::max((n1 < n2 ? n1 : n2) / A, (Float) 0.0);
}
} // namespace gfx