| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 #ifndef SkOpAngle_DEFINED | 7 #ifndef SkOpAngle_DEFINED |
| 8 #define SkOpAngle_DEFINED | 8 #define SkOpAngle_DEFINED |
| 9 | 9 |
| 10 #include "SkLineParameters.h" | 10 #include "SkLineParameters.h" |
| 11 | 11 |
| 12 class SkOpSegment; | 12 class SkOpSegment; |
| 13 struct SkOpSpan; | 13 struct SkOpSpan; |
| 14 | 14 |
| 15 // sorting angles | 15 // sorting angles |
| 16 // given angles of {dx dy ddx ddy dddx dddy} sort them | 16 // given angles of {dx dy ddx ddy dddx dddy} sort them |
| 17 class SkOpAngle { | 17 class SkOpAngle { |
| 18 public: | 18 public: |
| 19 enum { kStackBasedCount = 8 }; // FIXME: determine what this should be | 19 enum { kStackBasedCount = 8 }; // FIXME: determine what this should be |
| 20 enum IncludeType { | 20 enum IncludeType { |
| 21 kUnaryWinding, | 21 kUnaryWinding, |
| 22 kUnaryXor, | 22 kUnaryXor, |
| 23 kBinarySingle, | 23 kBinarySingle, |
| 24 kBinaryOpp, | 24 kBinaryOpp, |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 |
| 27 int end() const { | 28 int end() const { |
| 28 return fEnd; | 29 return fEnd; |
| 29 } | 30 } |
| 30 | 31 |
| 31 const SkOpAngle* findFirst() const; | 32 const SkOpAngle* findFirst() const; |
| 32 | 33 |
| 33 bool inLoop() const { | 34 bool inLoop() const { |
| 34 return !!fNext; | 35 return !!fNext; |
| 35 } | 36 } |
| 36 | 37 |
| 37 void insert(SkOpAngle* ); | 38 void insert(SkOpAngle* ); |
| 38 bool isHorizontal() const; | 39 bool isHorizontal() const; |
| 39 SkOpSpan* lastMarked() const; | 40 SkOpSpan* lastMarked() const; |
| 41 bool loopContains(const SkOpAngle& ) const; |
| 40 int loopCount() const; | 42 int loopCount() const; |
| 41 void markStops(); | 43 void markStops(); |
| 42 bool merge(SkOpAngle* ); | 44 bool merge(SkOpAngle* ); |
| 43 | 45 |
| 44 SkOpAngle* next() const { | 46 SkOpAngle* next() const { |
| 45 return fNext; | 47 return fNext; |
| 46 } | 48 } |
| 47 | 49 |
| 48 SkOpAngle* previous() const; | 50 SkOpAngle* previous() const; |
| 49 | 51 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 bool checkCrossesZero() const; | 99 bool checkCrossesZero() const; |
| 98 bool checkParallel(const SkOpAngle& ) const; | 100 bool checkParallel(const SkOpAngle& ) const; |
| 99 bool computeSector(); | 101 bool computeSector(); |
| 100 int convexHullOverlaps(const SkOpAngle& ) const; | 102 int convexHullOverlaps(const SkOpAngle& ) const; |
| 101 double distEndRatio(double dist) const; | 103 double distEndRatio(double dist) const; |
| 102 int findSector(SkPath::Verb verb, double x, double y) const; | 104 int findSector(SkPath::Verb verb, double x, double y) const; |
| 103 bool endsIntersect(const SkOpAngle& ) const; | 105 bool endsIntersect(const SkOpAngle& ) const; |
| 104 double midT() const; | 106 double midT() const; |
| 105 bool oppositePlanes(const SkOpAngle& rh) const; | 107 bool oppositePlanes(const SkOpAngle& rh) const; |
| 106 bool orderable(const SkOpAngle& rh) const; // false == this < rh ; true ==
this > rh | 108 bool orderable(const SkOpAngle& rh) const; // false == this < rh ; true ==
this > rh |
| 109 bool overlap(const SkOpAngle& test) const; |
| 107 void setCurveHullSweep(); | 110 void setCurveHullSweep(); |
| 108 void setSector(); | 111 void setSector(); |
| 109 void setSpans(); | 112 void setSpans(); |
| 110 bool tangentsDiverge(const SkOpAngle& rh, double s0xt0) const; | 113 bool tangentsDiverge(const SkOpAngle& rh, double s0xt0) const; |
| 111 | 114 |
| 112 SkDCubic fCurvePart; // the curve from start to end | 115 SkDCubic fCurvePart; // the curve from start to end |
| 113 double fSide; | 116 double fSide; |
| 114 SkLineParameters fTangentHalf; // used only to sort a pair of lines or line
-like sections | 117 SkLineParameters fTangentHalf; // used only to sort a pair of lines or line
-like sections |
| 115 const SkOpSegment* fSegment; | 118 const SkOpSegment* fSegment; |
| 116 SkOpAngle* fNext; | 119 SkOpAngle* fNext; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 139 void debugValidateNext() const; // in debug builds, verify that angle loop
is uncorrupted | 142 void debugValidateNext() const; // in debug builds, verify that angle loop
is uncorrupted |
| 140 #else | 143 #else |
| 141 void debugValidateNext() const {} | 144 void debugValidateNext() const {} |
| 142 #endif | 145 #endif |
| 143 void dumpLoop() const; // utility to be called by user from debugger | 146 void dumpLoop() const; // utility to be called by user from debugger |
| 144 void dumpPartials() const; // utility to be called by user from debugger | 147 void dumpPartials() const; // utility to be called by user from debugger |
| 145 friend class PathOpsAngleTester; | 148 friend class PathOpsAngleTester; |
| 146 }; | 149 }; |
| 147 | 150 |
| 148 #endif | 151 #endif |
| OLD | NEW |