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

Unified Diff: src/pathops/SkOpAngle.h

Issue 15338003: path ops -- rewrite angle sort (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 6 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/SkLineParameters.h ('k') | src/pathops/SkOpAngle.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/pathops/SkLineParameters.h ('k') | src/pathops/SkOpAngle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698