| Index: src/pathops/SkOpAngle.h
|
| diff --git a/src/pathops/SkOpAngle.h b/src/pathops/SkOpAngle.h
|
| index 1dc425061352f43188d88abea5a6d84512b7827b..84b37010c94ecf11f98a004c67c7b5cfe89e731b 100644
|
| --- a/src/pathops/SkOpAngle.h
|
| +++ b/src/pathops/SkOpAngle.h
|
| @@ -7,17 +7,18 @@
|
| #ifndef SkOpAngle_DEFINED
|
| #define SkOpAngle_DEFINED
|
|
|
| -#include "SkChunkAlloc.h"
|
| #include "SkLineParameters.h"
|
| +#if DEBUG_ANGLE
|
| +#include "SkString.h"
|
| +#endif
|
|
|
| +class SkOpContour;
|
| +class SkOpPtT;
|
| class SkOpSegment;
|
| -struct SkOpSpan;
|
| +class SkOpSpanBase;
|
| +class SkOpSpan;
|
|
|
| -// sorting angles
|
| -// given angles of {dx dy ddx ddy dddx dddy} sort them
|
| -class SkOpAngle {
|
| -public:
|
| - enum { kStackBasedCount = 8 }; // FIXME: determine what this should be
|
| +struct SkOpAngle {
|
| enum IncludeType {
|
| kUnaryWinding,
|
| kUnaryXor,
|
| @@ -25,29 +26,66 @@ public:
|
| kBinaryOpp,
|
| };
|
|
|
| + bool after(SkOpAngle* test);
|
| + int allOnOneSide(const SkOpAngle* test);
|
| + bool checkCrossesZero() const;
|
| + void checkNearCoincidence();
|
| + bool checkParallel(SkOpAngle* );
|
| + bool computeSector();
|
| + int convexHullOverlaps(const SkOpAngle* ) const;
|
| +
|
| + const SkOpAngle* debugAngle(int id) const;
|
| + SkOpContour* debugContour(int id);
|
|
|
| - int end() const {
|
| - return fEnd;
|
| + int debugID() const {
|
| + return PATH_OPS_DEBUG_RELEASE(fID, -1);
|
| }
|
|
|
| - const SkOpAngle* findFirst() const;
|
| +#if DEBUG_SORT
|
| + void debugLoop() const;
|
| +#endif
|
|
|
| - bool inLoop() const {
|
| - return !!fNext;
|
| +#if DEBUG_ANGLE
|
| + SkString debugPart() const;
|
| +#endif
|
| + const SkOpPtT* debugPtT(int id) const;
|
| + const SkOpSegment* debugSegment(int id) const;
|
| + const SkOpSpanBase* debugSpan(int id) const;
|
| + void debugValidate() const;
|
| + void debugValidateNext() const; // in debug builds, verify that angle loop is uncorrupted
|
| + double distEndRatio(double dist) const;
|
| + // available to testing only
|
| + void dump() const;
|
| + void dumpCurves() const;
|
| + void dumpLoop() const;
|
| + void dumpOne(bool functionHeader) const;
|
| + void dumpTo(const SkOpSegment* fromSeg, const SkOpAngle* ) const;
|
| + void dumpTest() const;
|
| +
|
| + SkOpSpanBase* end() const {
|
| + return fEnd;
|
| }
|
|
|
| + bool endsIntersect(SkOpAngle* );
|
| + bool endToSide(const SkOpAngle* rh, bool* inside) const;
|
| + SkOpAngle* findFirst();
|
| + int findSector(SkPath::Verb verb, double x, double y) const;
|
| + SkOpGlobalState* globalState() const;
|
| void insert(SkOpAngle* );
|
| - bool isHorizontal() const;
|
| - SkOpSpan* lastMarked() const;
|
| - bool loopContains(const SkOpAngle& ) const;
|
| + SkOpSpanBase* lastMarked() const;
|
| + bool loopContains(const SkOpAngle* ) const;
|
| int loopCount() const;
|
| void markStops();
|
| bool merge(SkOpAngle* );
|
| + double midT() const;
|
| + bool midToSide(const SkOpAngle* rh, bool* inside) const;
|
|
|
| SkOpAngle* next() const {
|
| return fNext;
|
| }
|
|
|
| + bool oppositePlanes(const SkOpAngle* rh) const;
|
| + bool orderable(SkOpAngle* rh); // false == this < rh ; true == this > rh
|
| SkOpAngle* previous() const;
|
|
|
| int sectorEnd() const {
|
| @@ -58,120 +96,57 @@ public:
|
| return fSectorStart;
|
| }
|
|
|
| - void set(const SkOpSegment* segment, int start, int end);
|
| + SkOpSegment* segment() const;
|
|
|
| - void setLastMarked(SkOpSpan* marked) {
|
| - fLastMarked = marked;
|
| - }
|
| + void set(SkOpSpanBase* start, SkOpSpanBase* end);
|
| + void setCurveHullSweep();
|
|
|
| - SkOpSegment* segment() const {
|
| - return const_cast<SkOpSegment*>(fSegment);
|
| + void setID(int id) {
|
| + PATH_OPS_DEBUG_CODE(fID = id);
|
| }
|
|
|
| - int sign() const {
|
| - return SkSign32(fStart - fEnd);
|
| + void setLastMarked(SkOpSpanBase* marked) {
|
| + fLastMarked = marked;
|
| }
|
|
|
| - bool small() const;
|
| + void setSector();
|
| + void setSpans();
|
| + int sign() const;
|
|
|
| - int start() const {
|
| + SkOpSpanBase* start() const {
|
| return fStart;
|
| }
|
|
|
| + SkOpSpan* starter();
|
| + bool tangentsDiverge(const SkOpAngle* rh, double s0xt0) const;
|
| +
|
| bool unorderable() const {
|
| return fUnorderable;
|
| }
|
|
|
| - // available to testing only
|
| -#if DEBUG_SORT
|
| - void debugLoop() const; // called by code during run
|
| -#endif
|
| -#if DEBUG_ANGLE
|
| - void debugSameAs(const SkOpAngle* compare) const;
|
| -#endif
|
| - void dump() const;
|
| - void dumpLoop() const;
|
| - void dumpTo(const SkOpSegment* fromSeg, const SkOpAngle* ) const;
|
| -
|
| -#if DEBUG_ANGLE
|
| - int debugID() const { return fID; }
|
| -
|
| - void setID(int id) {
|
| - fID = id;
|
| - }
|
| -#else
|
| - int debugID() const { return 0; }
|
| -#endif
|
| -
|
| -#if DEBUG_VALIDATE
|
| - void debugValidateLoop() const;
|
| -#endif
|
| -
|
| -private:
|
| - bool after(const SkOpAngle* test) const;
|
| - int allOnOneSide(const SkOpAngle& test) const;
|
| - bool calcSlop(double x, double y, double rx, double ry, bool* result) const;
|
| - bool checkCrossesZero() const;
|
| - bool checkParallel(const SkOpAngle& ) const;
|
| - bool computeSector();
|
| - int convexHullOverlaps(const SkOpAngle& ) const;
|
| - double distEndRatio(double dist) const;
|
| - int findSector(SkPath::Verb verb, double x, double y) const;
|
| - bool endsIntersect(const SkOpAngle& ) const;
|
| - double midT() const;
|
| - bool oppositePlanes(const SkOpAngle& rh) const;
|
| - bool orderable(const SkOpAngle& rh) const; // false == this < rh ; true == this > rh
|
| - bool overlap(const SkOpAngle& test) const;
|
| - void setCurveHullSweep();
|
| - void setSector();
|
| - void setSpans();
|
| - bool tangentsDiverge(const SkOpAngle& rh, double s0xt0) const;
|
| -
|
| - SkDCubic fCurvePart; // the curve from start to end
|
| + SkDCubic fCurvePart; // the curve from start to end
|
| double fSide;
|
| SkLineParameters fTangentHalf; // used only to sort a pair of lines or line-like sections
|
| - const SkOpSegment* fSegment;
|
| SkOpAngle* fNext;
|
| - SkOpSpan* fLastMarked;
|
| + SkOpSpanBase* fLastMarked;
|
| SkDVector fSweep[2];
|
| - int fStart;
|
| - int fEnd;
|
| - int fComputedEnd;
|
| + SkOpSpanBase* fStart;
|
| + SkOpSpanBase* fEnd;
|
| + SkOpSpanBase* fComputedEnd;
|
| int fSectorMask;
|
| int8_t fSectorStart; // in 32nds of a circle
|
| int8_t fSectorEnd;
|
| bool fIsCurve;
|
| - bool fStop; // set if ordered angle is greater than the previous
|
| - mutable bool fUnorderable; // this is editable by orderable()
|
| + bool fStop; // set if ordered angle is greater than the previous
|
| + bool fUnorderable;
|
| bool fUnorderedSweep; // set when a cubic's first control point between the sweep vectors
|
| bool fComputeSector;
|
| bool fComputedSector;
|
| + bool fCheckCoincidence;
|
| + PATH_OPS_DEBUG_CODE(int fID);
|
|
|
| -#if DEBUG_ANGLE
|
| - int fID;
|
| -#endif
|
| -#if DEBUG_VALIDATE
|
| - void debugValidateNext() const; // in debug builds, verify that angle loop is uncorrupted
|
| -#else
|
| - void debugValidateNext() const {}
|
| -#endif
|
| - void dumpOne(bool showFunc) const; // available to testing only
|
| - void dumpPartials() const; // utility to be called by user from debugger
|
| - friend class PathOpsAngleTester;
|
| };
|
|
|
| -class SkOpAngleSet {
|
| -public:
|
| - SkOpAngleSet();
|
| - ~SkOpAngleSet();
|
| - SkOpAngle& push_back();
|
| - void reset();
|
| -private:
|
| - void dump() const; // utility to be called by user from debugger
|
| - SkChunkAlloc* fAngles;
|
| -#if DEBUG_ANGLE
|
| - int fCount;
|
| -#endif
|
| -};
|
| +
|
|
|
| #endif
|
|
|