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

Unified Diff: src/pathops/SkQuarticRoot.cpp

Issue 131103009: update pathops to circle sort (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: disable old test that still fails on linux 32 release Created 6 years, 8 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 | « src/pathops/SkPathWriter.h ('k') | tests/PathOpsAngleIdeas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkQuarticRoot.cpp
diff --git a/src/pathops/SkQuarticRoot.cpp b/src/pathops/SkQuarticRoot.cpp
index e5b486c76c057b99553e1f9a822702fe8870b55e..f9a7bf517990bc8cd9fdb72b3b8db1be9daa5fdf 100644
--- a/src/pathops/SkQuarticRoot.cpp
+++ b/src/pathops/SkQuarticRoot.cpp
@@ -71,7 +71,9 @@ int SkReducedQuarticRoots(const double t4, const double t3, const double t2, con
return num;
}
if (oneHint) {
- SkASSERT(approximately_zero_double(t4 + t3 + t2 + t1 + t0)); // 1 is one root
+ SkASSERT(approximately_zero_double(t4 + t3 + t2 + t1 + t0) ||
+ approximately_zero_when_compared_to(t4 + t3 + t2 + t1 + t0, // 1 is one root
+ SkTMax(fabs(t4), SkTMax(fabs(t3), SkTMax(fabs(t2), SkTMax(fabs(t1), fabs(t0)))))));
// note that -C == A + B + D + E
int num = SkDCubic::RootsReal(t4, t4 + t3, -(t1 + t0), -t0, roots);
for (int i = 0; i < num; ++i) {
@@ -101,7 +103,8 @@ int SkQuarticRootsReal(int firstCubicRoot, const double A, const double B, const
const double q = a2 * a / 8 - a * b / 2 + c;
const double r = -3 * a2 * a2 / 256 + a2 * b / 16 - a * c / 4 + d;
int num;
- if (approximately_zero(r)) {
+ double largest = SkTMax(fabs(p), fabs(q));
+ if (approximately_zero_when_compared_to(r, largest)) {
/* no absolute term: y(y^3 + py + q) = 0 */
num = SkDCubic::RootsReal(1, 0, p, q, s);
s[num++] = 0;
« no previous file with comments | « src/pathops/SkPathWriter.h ('k') | tests/PathOpsAngleIdeas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698