Index: src/pathops/SkOpAngle.h |
=================================================================== |
--- src/pathops/SkOpAngle.h (revision 9425) |
+++ src/pathops/SkOpAngle.h (working copy) |
@@ -8,17 +8,19 @@ |
#define SkOpAngle_DEFINED |
#include "SkLineParameters.h" |
-#include "SkOpSpan.h" |
#include "SkPath.h" |
#include "SkPathOpsCubic.h" |
-#include "SkTDArray.h" |
+class SkOpSegment; |
+ |
// sorting angles |
// given angles of {dx dy ddx ddy dddx dddy} sort them |
class SkOpAngle { |
public: |
bool operator<(const SkOpAngle& rh) const; |
+ bool calcSlop(double x, double y, double rx, double ry, bool* result) const; |
+ |
double dx() const { |
return fTangent1.dx(); |
} |
@@ -31,18 +33,10 @@ |
return fEnd; |
} |
- bool isHorizontal() const { |
- return dy() == 0 && fVerb == SkPath::kLine_Verb; |
- } |
+ bool isHorizontal() const; |
- bool lengthen(); |
- bool reverseLengthen(); |
+ void set(const SkOpSegment* segment, int start, int end); |
- void set(const SkPoint* orig, SkPath::Verb verb, const SkOpSegment* segment, |
- int start, int end, const SkTDArray<SkOpSpan>& spans); |
- |
- void setSpans(); |
- |
SkOpSegment* segment() const { |
return const_cast<SkOpSegment*>(fSegment); |
} |
@@ -51,44 +45,47 @@ |
return SkSign32(fStart - fEnd); |
} |
- const SkTDArray<SkOpSpan>* spans() const { |
- return fSpans; |
- } |
- |
int start() const { |
return fStart; |
} |
+ bool unorderable() const { |
+ return fUnorderable; |
+ } |
+ |
bool unsortable() const { |
return fUnsortable; |
} |
#if DEBUG_ANGLE |
- const SkPoint* pts() const { |
- return fPts; |
+ void debugShow(const SkPoint& a) const { |
+ SkDebugf(" d=(%1.9g,%1.9g) side=%1.9g\n", dx(), dy(), fSide); |
} |
- SkPath::Verb verb() const { |
- return fVerb; |
+ void setID(int id) { |
+ fID = id; |
} |
- |
- void debugShow(const SkPoint& a) const { |
- SkDebugf(" d=(%1.9g,%1.9g) side=%1.9g\n", dx(), dy(), fSide); |
- } |
#endif |
private: |
- const SkPoint* fPts; |
+ bool lengthen(const SkOpAngle& ); |
+ void setSpans(); |
+ |
SkDCubic fCurvePart; |
- SkPath::Verb fVerb; |
double fSide; |
SkLineParameters fTangent1; |
- const SkTDArray<SkOpSpan>* fSpans; |
const SkOpSegment* fSegment; |
int fStart; |
int fEnd; |
- bool fReversed; |
+ bool fComputed; // tangent is computed, may contain some error |
+ // if subdividing a quad or cubic causes the tangent to go from the maximum angle to the |
+ // minimum, mark it unorderable. It still can be sorted, which is good enough for find-top |
+ // but can't be ordered, and therefore can't be used to compute winding |
+ bool fUnorderable; |
mutable bool fUnsortable; // this alone is editable by the less than operator |
+#if DEBUG_ANGLE |
+ int fID; |
+#endif |
}; |
#endif |