aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pathops/SkPathOpsPoint.h
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2015-04-20 08:31:59 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-20 08:31:59 -0700
commit1049f1246e7be4ccb68001361efceb8933e6f81c (patch)
tree9c71ceb245856cbe2173913eaec3b0ebb490dd74 /src/pathops/SkPathOpsPoint.h
parent5c476fb2776639bdbf0e974dd38d1c5d4c4ff1aa (diff)
Now, path ops natively intersect conics, quads, and cubics in any combination. There are still a class of cubic tests that fail and a handful of undiagnosed failures from skps and fuzz tests, but things are much better overall.
Extended tests (150M+) run to completion in release in about 6 minutes; the standard test suite exceeds 100K and finishes in a few seconds on desktops. TBR=reed BUG=skia:3588 Review URL: https://codereview.chromium.org/1037953004
Diffstat (limited to 'src/pathops/SkPathOpsPoint.h')
-rw-r--r--src/pathops/SkPathOpsPoint.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/pathops/SkPathOpsPoint.h b/src/pathops/SkPathOpsPoint.h
index 2d07427783..35ad80ea4c 100644
--- a/src/pathops/SkPathOpsPoint.h
+++ b/src/pathops/SkPathOpsPoint.h
@@ -193,6 +193,20 @@ struct SkDPoint {
return RoughlyEqualUlps(largest, largest + dist); // is the dist within ULPS tolerance?
}
+ static bool RoughlyEqual(const SkPoint& a, const SkPoint& b) {
+ if (!RoughlyEqualUlps(a.fX, b.fX) || !RoughlyEqualUlps(a.fY, b.fY)) {
+ return false;
+ }
+ SkDPoint dA, dB;
+ dA.set(a);
+ dB.set(b);
+ double dist = dA.distance(dB); // OPTIMIZATION: can we compare against distSq instead ?
+ float tiniest = SkTMin(SkTMin(SkTMin(a.fX, b.fX), a.fY), b.fY);
+ float largest = SkTMax(SkTMax(SkTMax(a.fX, b.fX), a.fY), b.fY);
+ largest = SkTMax(largest, -tiniest);
+ return RoughlyEqualUlps((double) largest, largest + dist); // is dist within ULPS tolerance?
+ }
+
// utilities callable by the user from the debugger when the implementation code is linked in
void dump() const;
static void Dump(const SkPoint& pt);