Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Unified Diff: src/core/SkGeometry.cpp

Issue 1556353002: give up on quad root if infinite (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add comment Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/PathTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkGeometry.cpp
diff --git a/src/core/SkGeometry.cpp b/src/core/SkGeometry.cpp
index f7c8f5736e64d0dc87fb83a749bd191b95909bf4..c25e18641a43bc0c766e1469a9c16d595e955282 100644
--- a/src/core/SkGeometry.cpp
+++ b/src/core/SkGeometry.cpp
@@ -90,7 +90,13 @@ int SkFindUnitQuadRoots(SkScalar A, SkScalar B, SkScalar C, SkScalar roots[2]) {
SkScalar* r = roots;
SkScalar R = B*B - 4*A*C;
- if (R < 0 || SkScalarIsNaN(R)) { // complex roots
+ if (R < 0 || !SkScalarIsFinite(R)) { // complex roots
+ // if R is infinite, it's possible that it may still produce
+ // useful results if the operation was repeated in doubles
+ // the flipside is determining if the more precise answer
+ // isn't useful because surrounding machinery (e.g., subtracting
+ // the axis offset from C) already discards the extra precision
+ // more investigation and unit tests required...
return 0;
}
R = SkScalarSqrt(R);
« no previous file with comments | « no previous file | tests/PathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698