| 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 SkOpSegment_DEFINE | 7 #ifndef SkOpSegment_DEFINE |
| 8 #define SkOpSegment_DEFINE | 8 #define SkOpSegment_DEFINE |
| 9 | 9 |
| 10 #include "SkOpAngle.h" | 10 #include "SkOpAngle.h" |
| 11 #include "SkOpSpan.h" | 11 #include "SkOpSpan.h" |
| 12 #include "SkOpTAllocator.h" | 12 #include "SkOpTAllocator.h" |
| 13 #include "SkPathOpsBounds.h" | 13 #include "SkPathOpsBounds.h" |
| 14 #include "SkPathOpsCubic.h" | 14 #include "SkPathOpsCubic.h" |
| 15 #include "SkPathOpsCurve.h" | 15 #include "SkPathOpsCurve.h" |
| 16 | 16 |
| 17 struct SkDCurve; | 17 struct SkDCurve; |
| 18 class SkOpCoincidence; | 18 class SkOpCoincidence; |
| 19 class SkOpContour; | 19 class SkOpContour; |
| 20 enum class SkOpRayDir; | 20 enum class SkOpRayDir; |
| 21 struct SkOpRayHit; | 21 struct SkOpRayHit; |
| 22 class SkPathWriter; | 22 class SkPathWriter; |
| 23 | 23 |
| 24 class SkOpSegment { | 24 class SkOpSegment { |
| 25 public: | 25 public: |
| 26 enum AliasMatch { | |
| 27 kNoAliasMatch, | |
| 28 kAllowAliasMatch, | |
| 29 }; | |
| 30 | |
| 31 bool operator<(const SkOpSegment& rh) const { | 26 bool operator<(const SkOpSegment& rh) const { |
| 32 return fBounds.fTop < rh.fBounds.fTop; | 27 return fBounds.fTop < rh.fBounds.fTop; |
| 33 } | 28 } |
| 34 | 29 |
| 35 SkOpAngle* activeAngle(SkOpSpanBase* start, SkOpSpanBase** startPtr, SkOpSpa
nBase** endPtr, | 30 SkOpAngle* activeAngle(SkOpSpanBase* start, SkOpSpanBase** startPtr, SkOpSpa
nBase** endPtr, |
| 36 bool* done); | 31 bool* done); |
| 37 SkOpAngle* activeAngleInner(SkOpSpanBase* start, SkOpSpanBase** startPtr, | 32 SkOpAngle* activeAngleInner(SkOpSpanBase* start, SkOpSpanBase** startPtr, |
| 38 SkOpSpanBase** endPtr, bool* done); | 33 SkOpSpanBase** endPtr, bool* done); |
| 39 SkOpAngle* activeAngleOther(SkOpSpanBase* start, SkOpSpanBase** startPtr, | 34 SkOpAngle* activeAngleOther(SkOpSpanBase* start, SkOpSpanBase** startPtr, |
| 40 SkOpSpanBase** endPtr, bool* done); | 35 SkOpSpanBase** endPtr, bool* done); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 85 } |
| 91 | 86 |
| 92 SkOpSegment* addQuad(SkPoint pts[3], SkOpContour* parent) { | 87 SkOpSegment* addQuad(SkPoint pts[3], SkOpContour* parent) { |
| 93 init(pts, 1, parent, SkPath::kQuad_Verb); | 88 init(pts, 1, parent, SkPath::kQuad_Verb); |
| 94 SkDCurve curve; | 89 SkDCurve curve; |
| 95 curve.fQuad.set(pts); | 90 curve.fQuad.set(pts); |
| 96 curve.setQuadBounds(pts, 1, 0, 1, &fBounds); | 91 curve.setQuadBounds(pts, 1, 0, 1, &fBounds); |
| 97 return this; | 92 return this; |
| 98 } | 93 } |
| 99 | 94 |
| 100 SkOpPtT* addT(double t, AliasMatch, bool* allocated); | 95 SkOpPtT* addT(double t, bool* allocated); |
| 101 | 96 |
| 102 template<typename T> T* allocateArray(int count) { | 97 template<typename T> T* allocateArray(int count) { |
| 103 return SkOpTAllocator<T>::AllocateArray(this->globalState()->allocator()
, count); | 98 return SkOpTAllocator<T>::AllocateArray(this->globalState()->allocator()
, count); |
| 104 } | 99 } |
| 105 | 100 |
| 106 const SkPathOpsBounds& bounds() const { | 101 const SkPathOpsBounds& bounds() const { |
| 107 return fBounds; | 102 return fBounds; |
| 108 } | 103 } |
| 109 | 104 |
| 110 void bumpCount() { | 105 void bumpCount() { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 126 | 121 |
| 127 SkOpContour* contour() const { | 122 SkOpContour* contour() const { |
| 128 return fContour; | 123 return fContour; |
| 129 } | 124 } |
| 130 | 125 |
| 131 int count() const { | 126 int count() const { |
| 132 return fCount; | 127 return fCount; |
| 133 } | 128 } |
| 134 | 129 |
| 135 void debugAddAngle(double startT, double endT); | 130 void debugAddAngle(double startT, double endT); |
| 136 const SkOpPtT* debugAddT(double t, AliasMatch , bool* allocated) const; | 131 const SkOpPtT* debugAddT(double t, bool* allocated) const; |
| 137 const SkOpAngle* debugAngle(int id) const; | 132 const SkOpAngle* debugAngle(int id) const; |
| 138 #if DEBUG_ANGLE | 133 #if DEBUG_ANGLE |
| 139 void debugCheckAngleCoin() const; | 134 void debugCheckAngleCoin() const; |
| 140 #endif | 135 #endif |
| 141 #if DEBUG_COINCIDENCE_VERBOSE | 136 #if DEBUG_COINCIDENCE_VERBOSE |
| 142 void debugCheckHealth(const char* id, SkPathOpsDebug::GlitchLog* ) const; | 137 void debugCheckHealth(const char* id, SkPathOpsDebug::GlitchLog* ) const; |
| 143 void debugClearAll(const char* id, SkPathOpsDebug::GlitchLog* glitches) cons
t; | 138 void debugClearAll(const char* id, SkPathOpsDebug::GlitchLog* glitches) cons
t; |
| 144 void debugClearOne(const SkOpSpan* span, const char* id, SkPathOpsDebug::Gli
tchLog* glitches) const; | 139 void debugClearOne(const SkOpSpan* span, const char* id, SkPathOpsDebug::Gli
tchLog* glitches) const; |
| 145 #endif | 140 #endif |
| 146 const SkOpCoincidence* debugCoincidence() const; | 141 const SkOpCoincidence* debugCoincidence() const; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 bool markAndChaseWinding(SkOpSpanBase* start, SkOpSpanBase* end, int winding
, | 267 bool markAndChaseWinding(SkOpSpanBase* start, SkOpSpanBase* end, int winding
, |
| 273 SkOpSpanBase** lastPtr); | 268 SkOpSpanBase** lastPtr); |
| 274 bool markAndChaseWinding(SkOpSpanBase* start, SkOpSpanBase* end, int winding
, | 269 bool markAndChaseWinding(SkOpSpanBase* start, SkOpSpanBase* end, int winding
, |
| 275 int oppWinding, SkOpSpanBase** lastPtr); | 270 int oppWinding, SkOpSpanBase** lastPtr); |
| 276 SkOpSpanBase* markAngle(int maxWinding, int sumWinding, const SkOpAngle* ang
le); | 271 SkOpSpanBase* markAngle(int maxWinding, int sumWinding, const SkOpAngle* ang
le); |
| 277 SkOpSpanBase* markAngle(int maxWinding, int sumWinding, int oppMaxWinding, i
nt oppSumWinding, | 272 SkOpSpanBase* markAngle(int maxWinding, int sumWinding, int oppMaxWinding, i
nt oppSumWinding, |
| 278 const SkOpAngle* angle); | 273 const SkOpAngle* angle); |
| 279 void markDone(SkOpSpan* ); | 274 void markDone(SkOpSpan* ); |
| 280 bool markWinding(SkOpSpan* , int winding); | 275 bool markWinding(SkOpSpan* , int winding); |
| 281 bool markWinding(SkOpSpan* , int winding, int oppWinding); | 276 bool markWinding(SkOpSpan* , int winding, int oppWinding); |
| 282 bool match(const SkOpPtT* span, const SkOpSegment* parent, double t, const S
kPoint& pt, | 277 bool match(const SkOpPtT* span, const SkOpSegment* parent, double t, const S
kPoint& pt) const; |
| 283 AliasMatch ) const; | |
| 284 bool missingCoincidence(); | 278 bool missingCoincidence(); |
| 285 bool moveMultiples(); | 279 bool moveMultiples(); |
| 286 void moveNearby(); | 280 void moveNearby(); |
| 287 | 281 |
| 288 SkOpSegment* next() const { | 282 SkOpSegment* next() const { |
| 289 return fNext; | 283 return fNext; |
| 290 } | 284 } |
| 291 | 285 |
| 292 SkOpSegment* nextChase(SkOpSpanBase** , int* step, SkOpSpan** , SkOpSpanBase
** last) const; | 286 SkOpSegment* nextChase(SkOpSpanBase** , int* step, SkOpSpan** , SkOpSpanBase
** last) const; |
| 293 bool operand() const; | 287 bool operand() const; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 } | 384 } |
| 391 | 385 |
| 392 SkOpSpanBase* tail() { | 386 SkOpSpanBase* tail() { |
| 393 return &fTail; | 387 return &fTail; |
| 394 } | 388 } |
| 395 | 389 |
| 396 bool testForCoincidence(const SkOpPtT* priorPtT, const SkOpPtT* ptT, const S
kOpSpanBase* prior, | 390 bool testForCoincidence(const SkOpPtT* priorPtT, const SkOpPtT* ptT, const S
kOpSpanBase* prior, |
| 397 const SkOpSpanBase* spanBase, const SkOpSegment* opp) const; | 391 const SkOpSpanBase* spanBase, const SkOpSegment* opp) const; |
| 398 | 392 |
| 399 void undoneSpan(SkOpSpanBase** start, SkOpSpanBase** end); | 393 void undoneSpan(SkOpSpanBase** start, SkOpSpanBase** end); |
| 400 bool uniqueT(double t, AliasMatch allowAlias) const; | |
| 401 int updateOppWinding(const SkOpSpanBase* start, const SkOpSpanBase* end) con
st; | 394 int updateOppWinding(const SkOpSpanBase* start, const SkOpSpanBase* end) con
st; |
| 402 int updateOppWinding(const SkOpAngle* angle) const; | 395 int updateOppWinding(const SkOpAngle* angle) const; |
| 403 int updateOppWindingReverse(const SkOpAngle* angle) const; | 396 int updateOppWindingReverse(const SkOpAngle* angle) const; |
| 404 int updateWinding(SkOpSpanBase* start, SkOpSpanBase* end); | 397 int updateWinding(SkOpSpanBase* start, SkOpSpanBase* end); |
| 405 int updateWinding(SkOpAngle* angle); | 398 int updateWinding(SkOpAngle* angle); |
| 406 int updateWindingReverse(const SkOpAngle* angle); | 399 int updateWindingReverse(const SkOpAngle* angle); |
| 407 | 400 |
| 408 static bool UseInnerWinding(int outerWinding, int innerWinding); | 401 static bool UseInnerWinding(int outerWinding, int innerWinding); |
| 409 | 402 |
| 410 SkPath::Verb verb() const { | 403 SkPath::Verb verb() const { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 440 int fDoneCount; // number of processed spans (zero initially) | 433 int fDoneCount; // number of processed spans (zero initially) |
| 441 SkPath::Verb fVerb; | 434 SkPath::Verb fVerb; |
| 442 bool fVisited; // used by missing coincidence check | 435 bool fVisited; // used by missing coincidence check |
| 443 #if DEBUG_COINCIDENCE | 436 #if DEBUG_COINCIDENCE |
| 444 mutable bool fDebugVisited; // used by debug missing coincidence check | 437 mutable bool fDebugVisited; // used by debug missing coincidence check |
| 445 #endif | 438 #endif |
| 446 SkDEBUGCODE(int fID); | 439 SkDEBUGCODE(int fID); |
| 447 }; | 440 }; |
| 448 | 441 |
| 449 #endif | 442 #endif |
| OLD | NEW |