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

Unified Diff: src/pathops/SkPathOpsTypes.h

Issue 1029993002: Revert of pathops version two (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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/SkPathOpsTriangle.cpp ('k') | src/pathops/SkQuarticRoot.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkPathOpsTypes.h
diff --git a/src/pathops/SkPathOpsTypes.h b/src/pathops/SkPathOpsTypes.h
index 0248e7115a6d0066c54af5fb21fd0ab8ecf10e48..01fec0d0b616a7d324dd2e1cd9d0e72cca9d204c 100644
--- a/src/pathops/SkPathOpsTypes.h
+++ b/src/pathops/SkPathOpsTypes.h
@@ -20,111 +20,6 @@
kWinding_PathOpsMask = -1,
kNo_PathOpsMask = 0,
kEvenOdd_PathOpsMask = 1
-};
-
-class SkOpCoincidence;
-class SkOpContour;
-
-class SkOpGlobalState {
-public:
- SkOpGlobalState(SkOpCoincidence* coincidence PATH_OPS_DEBUG_PARAMS(SkOpContour* head))
- : fCoincidence(coincidence)
- , fWindingFailed(false)
- , fAngleCoincidence(false)
-#if DEBUG_VALIDATE
- , fPhase(kIntersecting)
-#endif
- PATH_OPS_DEBUG_PARAMS(fHead(head))
- PATH_OPS_DEBUG_PARAMS(fAngleID(0))
- PATH_OPS_DEBUG_PARAMS(fContourID(0))
- PATH_OPS_DEBUG_PARAMS(fPtTID(0))
- PATH_OPS_DEBUG_PARAMS(fSegmentID(0))
- PATH_OPS_DEBUG_PARAMS(fSpanID(0)) {
- }
-
-#if DEBUG_VALIDATE
- enum Phase {
- kIntersecting,
- kWalking
- };
-#endif
-
- bool angleCoincidence() {
- return fAngleCoincidence;
- }
-
- SkOpCoincidence* coincidence() {
- return fCoincidence;
- }
-
-#ifdef SK_DEBUG
- const struct SkOpAngle* debugAngle(int id) const;
- SkOpContour* debugContour(int id);
- const class SkOpPtT* debugPtT(int id) const;
- const class SkOpSegment* debugSegment(int id) const;
- const class SkOpSpanBase* debugSpan(int id) const;
-
- int nextAngleID() {
- return ++fAngleID;
- }
-
- int nextContourID() {
- return ++fContourID;
- }
- int nextPtTID() {
- return ++fPtTID;
- }
-
- int nextSegmentID() {
- return ++fSegmentID;
- }
-
- int nextSpanID() {
- return ++fSpanID;
- }
-#endif
-
-#if DEBUG_VALIDATE
- Phase phase() const {
- return fPhase;
- }
-#endif
-
- void setAngleCoincidence() {
- fAngleCoincidence = true;
- }
-
-#if DEBUG_VALIDATE
- void setPhase(Phase phase) {
- SkASSERT(fPhase != phase);
- fPhase = phase;
- }
-#endif
-
- // called in very rare cases where angles are sorted incorrectly -- signfies op will fail
- void setWindingFailed() {
- fWindingFailed = true;
- }
-
- bool windingFailed() const {
- return fWindingFailed;
- }
-
-private:
- SkOpCoincidence* fCoincidence;
- bool fWindingFailed;
- bool fAngleCoincidence;
-#if DEBUG_VALIDATE
- Phase fPhase;
-#endif
-#ifdef SK_DEBUG
- SkOpContour* fHead;
- int fAngleID;
- int fContourID;
- int fPtTID;
- int fSegmentID;
- int fSpanID;
-#endif
};
// Use Almost Equal when comparing coordinates. Use epsilon to compare T values.
@@ -197,7 +92,6 @@
const double ROUGH_EPSILON = FLT_EPSILON * 64;
const double MORE_ROUGH_EPSILON = FLT_EPSILON * 256;
const double WAY_ROUGH_EPSILON = FLT_EPSILON * 2048;
-const double BUMP_EPSILON = FLT_EPSILON * 4096;
inline bool zero_or_one(double x) {
return x == 0 || x == 1;
@@ -246,6 +140,12 @@
inline bool roughly_zero(double x) {
return fabs(x) < ROUGH_EPSILON;
}
+
+#if 0 // unused for now
+inline bool way_roughly_zero(double x) {
+ return fabs(x) < WAY_ROUGH_EPSILON;
+}
+#endif
inline bool approximately_zero_inverse(double x) {
return fabs(x) > FLT_EPSILON_INVERSE;
@@ -254,10 +154,6 @@
// OPTIMIZATION: if called multiple times with the same denom, we want to pass 1/y instead
inline bool approximately_zero_when_compared_to(double x, double y) {
return x == 0 || fabs(x) < fabs(y * FLT_EPSILON);
-}
-
-inline bool precisely_zero_when_compared_to(double x, double y) {
- return x == 0 || fabs(x) < fabs(y * DBL_EPSILON);
}
// Use this for comparing Ts in the range of 0 to 1. For general numbers (larger and smaller) use
@@ -408,22 +304,12 @@
// returns true if (a <= b <= c) || (a >= b >= c)
inline bool between(double a, double b, double c) {
- SkASSERT(((a <= b && b <= c) || (a >= b && b >= c)) == ((a - b) * (c - b) <= 0)
- || (precisely_zero(a) && precisely_zero(b) && precisely_zero(c)));
+ SkASSERT(((a <= b && b <= c) || (a >= b && b >= c)) == ((a - b) * (c - b) <= 0));
return (a - b) * (c - b) <= 0;
}
inline bool roughly_equal(double x, double y) {
return fabs(x - y) < ROUGH_EPSILON;
-}
-
-inline bool roughly_negative(double x) {
- return x < ROUGH_EPSILON;
-}
-
-inline bool roughly_between(double a, double b, double c) {
- return a <= c ? roughly_negative(a - b) && roughly_negative(b - c)
- : roughly_negative(b - a) && roughly_negative(c - b);
}
inline bool more_roughly_equal(double x, double y) {
@@ -438,6 +324,7 @@
struct SkDVector;
struct SkDLine;
struct SkDQuad;
+struct SkDTriangle;
struct SkDCubic;
struct SkDRect;
« no previous file with comments | « src/pathops/SkPathOpsTriangle.cpp ('k') | src/pathops/SkQuarticRoot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698