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

Unified Diff: src/core/SkGeometry.cpp

Issue 2006653006: pin before calling acos (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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 | src/pathops/SkPathOpsCubic.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 7256b9e517ec5e401c6e6838dbc6245392b99f85..760b9b4e1c751543569750277a7fe2c5a6feca88 100644
--- a/src/core/SkGeometry.cpp
+++ b/src/core/SkGeometry.cpp
@@ -743,7 +743,7 @@ static int solve_cubic_poly(const SkScalar coeff[4], SkScalar tValues[3]) {
SkScalar r;
if (R2MinusQ3 < 0) { // we have 3 real roots
- SkScalar theta = SkScalarACos(R / SkScalarSqrt(Q3));
+ SkScalar theta = SkScalarACos(SkScalarPin(R / SkScalarSqrt(Q3), -1, 1)); // bug.skia.org/5222
reed1 2016/05/25 17:12:52 Perhaps ah comment as to why we pin ... 1. the div
SkScalar neg2RootQ = -2 * SkScalarSqrt(Q);
r = neg2RootQ * SkScalarCos(theta/3) - adiv3;
« no previous file with comments | « no previous file | src/pathops/SkPathOpsCubic.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698