mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
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:
parent
aaa4b6ca26
commit
1ad9fc5044
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user