caryclark | 45fa447 | 2015-01-16 07:04:10 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2013 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | #ifndef SkOpCoincidence_DEFINED |
| 8 | #define SkOpCoincidence_DEFINED |
| 9 | |
Herb Derby | ecc364c | 2017-04-19 15:09:48 -0400 | [diff] [blame] | 10 | #include "SkArenaAlloc.h" |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 11 | #include "SkTDArray.h" |
caryclark | 45fa447 | 2015-01-16 07:04:10 -0800 | [diff] [blame] | 12 | #include "SkOpSpan.h" |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 13 | #include "SkPathOpsTypes.h" |
caryclark | 45fa447 | 2015-01-16 07:04:10 -0800 | [diff] [blame] | 14 | |
| 15 | class SkOpPtT; |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 16 | class SkOpSpanBase; |
caryclark | 45fa447 | 2015-01-16 07:04:10 -0800 | [diff] [blame] | 17 | |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 18 | class SkCoincidentSpans { |
| 19 | public: |
Cary Clark | db8f44f | 2016-12-15 09:17:31 -0500 | [diff] [blame] | 20 | const SkOpPtT* coinPtTEnd() const; |
| 21 | const SkOpPtT* coinPtTStart() const; |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 22 | |
| 23 | // These return non-const pointers so that, as copies, they can be added |
| 24 | // to a new span pair |
| 25 | SkOpPtT* coinPtTEndWritable() const { return const_cast<SkOpPtT*>(fCoinPtTEnd); } |
| 26 | SkOpPtT* coinPtTStartWritable() const { return const_cast<SkOpPtT*>(fCoinPtTStart); } |
| 27 | |
| 28 | bool collapsed(const SkOpPtT* ) const; |
| 29 | bool contains(const SkOpPtT* s, const SkOpPtT* e) const; |
| 30 | void correctEnds(); |
| 31 | void correctOneEnd(const SkOpPtT* (SkCoincidentSpans::* getEnd)() const, |
| 32 | void (SkCoincidentSpans::* setEnd)(const SkOpPtT* ptT) ); |
| 33 | |
Cary Clark | ab87d7a | 2016-10-04 10:01:04 -0400 | [diff] [blame] | 34 | #if DEBUG_COIN |
| 35 | void debugCorrectEnds(SkPathOpsDebug::GlitchLog* log) const; |
| 36 | void debugCorrectOneEnd(SkPathOpsDebug::GlitchLog* log, |
| 37 | const SkOpPtT* (SkCoincidentSpans::* getEnd)() const, |
| 38 | void (SkCoincidentSpans::* setEnd)(const SkOpPtT* ptT) const) const; |
| 39 | bool debugExpand(SkPathOpsDebug::GlitchLog* log) const; |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 40 | #endif |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 41 | |
Cary Clark | ab87d7a | 2016-10-04 10:01:04 -0400 | [diff] [blame] | 42 | const char* debugID() const { |
| 43 | #if DEBUG_COIN |
| 44 | return fGlobalState->debugCoinDictEntry().fFunctionName; |
| 45 | #else |
| 46 | return nullptr; |
| 47 | #endif |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 48 | } |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 49 | |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 50 | void debugShow() const; |
| 51 | #ifdef SK_DEBUG |
| 52 | void debugStartCheck(const SkOpSpanBase* outer, const SkOpSpanBase* over, |
| 53 | const SkOpGlobalState* debugState) const; |
| 54 | #endif |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 55 | void dump() const; |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 56 | bool expand(); |
| 57 | bool extend(const SkOpPtT* coinPtTStart, const SkOpPtT* coinPtTEnd, |
| 58 | const SkOpPtT* oppPtTStart, const SkOpPtT* oppPtTEnd); |
| 59 | bool flipped() const { return fOppPtTStart->fT > fOppPtTEnd->fT; } |
caryclark | fc560e0 | 2016-07-27 08:46:10 -0700 | [diff] [blame] | 60 | SkDEBUGCODE(SkOpGlobalState* globalState() { return fGlobalState; }) |
| 61 | |
| 62 | void init(SkDEBUGCODE(SkOpGlobalState* globalState)) { |
Herb Derby | ecc364c | 2017-04-19 15:09:48 -0400 | [diff] [blame] | 63 | sk_bzero(this, sizeof(*this)); |
caryclark | fc560e0 | 2016-07-27 08:46:10 -0700 | [diff] [blame] | 64 | SkDEBUGCODE(fGlobalState = globalState); |
| 65 | } |
| 66 | |
caryclark | 81a478c | 2016-09-09 09:37:57 -0700 | [diff] [blame] | 67 | SkCoincidentSpans* next() { return fNext; } |
| 68 | const SkCoincidentSpans* next() const { return fNext; } |
| 69 | SkCoincidentSpans** nextPtr() { return &fNext; } |
Cary Clark | db8f44f | 2016-12-15 09:17:31 -0500 | [diff] [blame] | 70 | const SkOpPtT* oppPtTStart() const; |
| 71 | const SkOpPtT* oppPtTEnd() const; |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 72 | // These return non-const pointers so that, as copies, they can be added |
| 73 | // to a new span pair |
| 74 | SkOpPtT* oppPtTStartWritable() const { return const_cast<SkOpPtT*>(fOppPtTStart); } |
| 75 | SkOpPtT* oppPtTEndWritable() const { return const_cast<SkOpPtT*>(fOppPtTEnd); } |
caryclark | a35ab3e | 2016-10-20 08:32:18 -0700 | [diff] [blame] | 76 | bool ordered(bool* result) const; |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 77 | |
| 78 | void set(SkCoincidentSpans* next, const SkOpPtT* coinPtTStart, const SkOpPtT* coinPtTEnd, |
Cary Clark | ab87d7a | 2016-10-04 10:01:04 -0400 | [diff] [blame] | 79 | const SkOpPtT* oppPtTStart, const SkOpPtT* oppPtTEnd); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 80 | |
| 81 | void setCoinPtTEnd(const SkOpPtT* ptT) { |
caryclark | d656200 | 2016-07-27 12:02:07 -0700 | [diff] [blame] | 82 | SkOPASSERT(ptT == ptT->span()->ptT()); |
caryclark | 96dc1c9 | 2016-10-20 11:34:10 -0700 | [diff] [blame] | 83 | SkOPASSERT(!fCoinPtTStart || ptT->fT != fCoinPtTStart->fT); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 84 | SkASSERT(!fCoinPtTStart || fCoinPtTStart->segment() == ptT->segment()); |
| 85 | fCoinPtTEnd = ptT; |
| 86 | ptT->setCoincident(); |
| 87 | } |
| 88 | |
| 89 | void setCoinPtTStart(const SkOpPtT* ptT) { |
Cary Clark | 4c76c41 | 2017-01-20 08:14:33 -0500 | [diff] [blame] | 90 | SkOPASSERT(ptT == ptT->span()->ptT()); |
caryclark | 4294286 | 2016-08-19 07:01:33 -0700 | [diff] [blame] | 91 | SkOPASSERT(!fCoinPtTEnd || ptT->fT != fCoinPtTEnd->fT); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 92 | SkASSERT(!fCoinPtTEnd || fCoinPtTEnd->segment() == ptT->segment()); |
| 93 | fCoinPtTStart = ptT; |
| 94 | ptT->setCoincident(); |
| 95 | } |
| 96 | |
| 97 | void setEnds(const SkOpPtT* coinPtTEnd, const SkOpPtT* oppPtTEnd) { |
| 98 | this->setCoinPtTEnd(coinPtTEnd); |
| 99 | this->setOppPtTEnd(oppPtTEnd); |
| 100 | } |
| 101 | |
| 102 | void setOppPtTEnd(const SkOpPtT* ptT) { |
caryclark | d656200 | 2016-07-27 12:02:07 -0700 | [diff] [blame] | 103 | SkOPASSERT(ptT == ptT->span()->ptT()); |
caryclark | e7bb5b2 | 2016-09-22 05:20:07 -0700 | [diff] [blame] | 104 | SkOPASSERT(!fOppPtTStart || ptT->fT != fOppPtTStart->fT); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 105 | SkASSERT(!fOppPtTStart || fOppPtTStart->segment() == ptT->segment()); |
| 106 | fOppPtTEnd = ptT; |
| 107 | ptT->setCoincident(); |
| 108 | } |
| 109 | |
| 110 | void setOppPtTStart(const SkOpPtT* ptT) { |
caryclark | a35ab3e | 2016-10-20 08:32:18 -0700 | [diff] [blame] | 111 | SkOPASSERT(ptT == ptT->span()->ptT()); |
caryclark | 0871401 | 2016-10-07 12:57:47 -0700 | [diff] [blame] | 112 | SkOPASSERT(!fOppPtTEnd || ptT->fT != fOppPtTEnd->fT); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 113 | SkASSERT(!fOppPtTEnd || fOppPtTEnd->segment() == ptT->segment()); |
| 114 | fOppPtTStart = ptT; |
| 115 | ptT->setCoincident(); |
| 116 | } |
| 117 | |
| 118 | void setStarts(const SkOpPtT* coinPtTStart, const SkOpPtT* oppPtTStart) { |
| 119 | this->setCoinPtTStart(coinPtTStart); |
| 120 | this->setOppPtTStart(oppPtTStart); |
| 121 | } |
| 122 | |
| 123 | void setNext(SkCoincidentSpans* next) { fNext = next; } |
| 124 | |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 125 | private: |
| 126 | SkCoincidentSpans* fNext; |
| 127 | const SkOpPtT* fCoinPtTStart; |
| 128 | const SkOpPtT* fCoinPtTEnd; |
| 129 | const SkOpPtT* fOppPtTStart; |
| 130 | const SkOpPtT* fOppPtTEnd; |
caryclark | fc560e0 | 2016-07-27 08:46:10 -0700 | [diff] [blame] | 131 | SkDEBUGCODE(SkOpGlobalState* fGlobalState); |
caryclark | 45fa447 | 2015-01-16 07:04:10 -0800 | [diff] [blame] | 132 | }; |
| 133 | |
| 134 | class SkOpCoincidence { |
| 135 | public: |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 136 | SkOpCoincidence(SkOpGlobalState* globalState) |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 137 | : fHead(nullptr) |
| 138 | , fTop(nullptr) |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 139 | , fGlobalState(globalState) |
| 140 | , fContinue(false) |
| 141 | , fSpanDeleted(false) |
| 142 | , fPtAllocated(false) |
| 143 | , fCoinExtended(false) |
| 144 | , fSpanMerged(false) { |
| 145 | globalState->setCoincidence(this); |
caryclark | 45fa447 | 2015-01-16 07:04:10 -0800 | [diff] [blame] | 146 | } |
| 147 | |
| 148 | void add(SkOpPtT* coinPtTStart, SkOpPtT* coinPtTEnd, SkOpPtT* oppPtTStart, |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 149 | SkOpPtT* oppPtTEnd); |
Cary Clark | ab87d7a | 2016-10-04 10:01:04 -0400 | [diff] [blame] | 150 | bool addEndMovedSpans(DEBUG_COIN_DECLARE_ONLY_PARAMS()); |
| 151 | bool addExpanded(DEBUG_COIN_DECLARE_ONLY_PARAMS()); |
| 152 | bool addMissing(bool* added DEBUG_COIN_DECLARE_PARAMS()); |
caryclark | a35ab3e | 2016-10-20 08:32:18 -0700 | [diff] [blame] | 153 | bool apply(DEBUG_COIN_DECLARE_ONLY_PARAMS()); |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 154 | bool contains(const SkOpPtT* coinPtTStart, const SkOpPtT* coinPtTEnd, |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 155 | const SkOpPtT* oppPtTStart, const SkOpPtT* oppPtTEnd) const; |
Cary Clark | ab87d7a | 2016-10-04 10:01:04 -0400 | [diff] [blame] | 156 | void correctEnds(DEBUG_COIN_DECLARE_ONLY_PARAMS()); |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 157 | |
Cary Clark | ab87d7a | 2016-10-04 10:01:04 -0400 | [diff] [blame] | 158 | #if DEBUG_COIN |
| 159 | void debugAddEndMovedSpans(SkPathOpsDebug::GlitchLog* log) const; |
| 160 | void debugAddExpanded(SkPathOpsDebug::GlitchLog* ) const; |
| 161 | void debugAddMissing(SkPathOpsDebug::GlitchLog* , bool* added) const; |
| 162 | void debugAddOrOverlap(SkPathOpsDebug::GlitchLog* log, |
caryclark | 30b9fdd | 2016-08-31 14:36:29 -0700 | [diff] [blame] | 163 | const SkOpSegment* coinSeg, const SkOpSegment* oppSeg, |
caryclark | 81a478c | 2016-09-09 09:37:57 -0700 | [diff] [blame] | 164 | double coinTs, double coinTe, double oppTs, double oppTe, |
| 165 | bool* added) const; |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 166 | #endif |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 167 | |
| 168 | const SkOpAngle* debugAngle(int id) const { |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 169 | return SkDEBUGRELEASE(fGlobalState->debugAngle(id), nullptr); |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 170 | } |
| 171 | |
caryclark | 6c3b9cd | 2016-09-26 05:36:58 -0700 | [diff] [blame] | 172 | void debugCheckBetween() const; |
| 173 | |
Cary Clark | ab87d7a | 2016-10-04 10:01:04 -0400 | [diff] [blame] | 174 | #if DEBUG_COIN |
| 175 | void debugCheckValid(SkPathOpsDebug::GlitchLog* log) const; |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 176 | #endif |
| 177 | |
caryclark | 30b9fdd | 2016-08-31 14:36:29 -0700 | [diff] [blame] | 178 | SkOpContour* debugContour(int id) const { |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 179 | return SkDEBUGRELEASE(fGlobalState->debugContour(id), nullptr); |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 180 | } |
| 181 | |
Cary Clark | ab87d7a | 2016-10-04 10:01:04 -0400 | [diff] [blame] | 182 | #if DEBUG_COIN |
| 183 | void debugCorrectEnds(SkPathOpsDebug::GlitchLog* log) const; |
| 184 | bool debugExpand(SkPathOpsDebug::GlitchLog* ) const; |
| 185 | void debugMark(SkPathOpsDebug::GlitchLog* ) const; |
| 186 | void debugMarkCollapsed(SkPathOpsDebug::GlitchLog* , |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 187 | const SkCoincidentSpans* coin, const SkOpPtT* test) const; |
Cary Clark | ab87d7a | 2016-10-04 10:01:04 -0400 | [diff] [blame] | 188 | void debugMarkCollapsed(SkPathOpsDebug::GlitchLog* , const SkOpPtT* test) const; |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 189 | #endif |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 190 | |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 191 | const SkOpPtT* debugPtT(int id) const { |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 192 | return SkDEBUGRELEASE(fGlobalState->debugPtT(id), nullptr); |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 193 | } |
| 194 | |
| 195 | const SkOpSegment* debugSegment(int id) const { |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 196 | return SkDEBUGRELEASE(fGlobalState->debugSegment(id), nullptr); |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 197 | } |
| 198 | |
Cary Clark | ab87d7a | 2016-10-04 10:01:04 -0400 | [diff] [blame] | 199 | #if DEBUG_COIN |
Cary Clark | ab87d7a | 2016-10-04 10:01:04 -0400 | [diff] [blame] | 200 | void debugRelease(SkPathOpsDebug::GlitchLog* , const SkCoincidentSpans* , |
caryclark | 30b9fdd | 2016-08-31 14:36:29 -0700 | [diff] [blame] | 201 | const SkCoincidentSpans* ) const; |
Cary Clark | ab87d7a | 2016-10-04 10:01:04 -0400 | [diff] [blame] | 202 | void debugRelease(SkPathOpsDebug::GlitchLog* , const SkOpSegment* ) const; |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 203 | #endif |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 204 | void debugShowCoincidence() const; |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 205 | |
| 206 | const SkOpSpanBase* debugSpan(int id) const { |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 207 | return SkDEBUGRELEASE(fGlobalState->debugSpan(id), nullptr); |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 208 | } |
| 209 | |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 210 | void debugValidate() const; |
caryclark | 45fa447 | 2015-01-16 07:04:10 -0800 | [diff] [blame] | 211 | void dump() const; |
Cary Clark | ab87d7a | 2016-10-04 10:01:04 -0400 | [diff] [blame] | 212 | bool expand(DEBUG_COIN_DECLARE_ONLY_PARAMS()); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 213 | bool extend(const SkOpPtT* coinPtTStart, const SkOpPtT* coinPtTEnd, const SkOpPtT* oppPtTStart, |
| 214 | const SkOpPtT* oppPtTEnd); |
Cary Clark | 40f2378 | 2016-10-06 12:04:16 -0400 | [diff] [blame] | 215 | bool findOverlaps(SkOpCoincidence* DEBUG_COIN_DECLARE_PARAMS()) const; |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 216 | void fixUp(SkOpPtT* deleted, const SkOpPtT* kept); |
| 217 | |
| 218 | SkOpGlobalState* globalState() { |
| 219 | return fGlobalState; |
| 220 | } |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 221 | |
caryclark | 81a478c | 2016-09-09 09:37:57 -0700 | [diff] [blame] | 222 | const SkOpGlobalState* globalState() const { |
| 223 | return fGlobalState; |
| 224 | } |
| 225 | |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 226 | bool isEmpty() const { |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 227 | return !fHead && !fTop; |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 228 | } |
| 229 | |
caryclark | e6522ea | 2016-10-17 07:54:33 -0700 | [diff] [blame] | 230 | bool mark(DEBUG_COIN_DECLARE_ONLY_PARAMS()); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 231 | void markCollapsed(SkOpPtT* ); |
| 232 | |
| 233 | static bool Ordered(const SkOpPtT* coinPtTStart, const SkOpPtT* oppPtTStart) { |
| 234 | return Ordered(coinPtTStart->segment(), oppPtTStart->segment()); |
| 235 | } |
| 236 | |
| 237 | static bool Ordered(const SkOpSegment* coin, const SkOpSegment* opp); |
| 238 | void release(const SkOpSegment* ); |
caryclark | 30b9fdd | 2016-08-31 14:36:29 -0700 | [diff] [blame] | 239 | void releaseDeleted(); |
caryclark | 45fa447 | 2015-01-16 07:04:10 -0800 | [diff] [blame] | 240 | |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 241 | private: |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 242 | void add(const SkOpPtT* coinPtTStart, const SkOpPtT* coinPtTEnd, const SkOpPtT* oppPtTStart, |
| 243 | const SkOpPtT* oppPtTEnd) { |
| 244 | this->add(const_cast<SkOpPtT*>(coinPtTStart), const_cast<SkOpPtT*>(coinPtTEnd), |
| 245 | const_cast<SkOpPtT*>(oppPtTStart), const_cast<SkOpPtT*>(oppPtTEnd)); |
| 246 | } |
| 247 | |
caryclark | 1597628 | 2016-07-21 05:48:43 -0700 | [diff] [blame] | 248 | bool addEndMovedSpans(const SkOpSpan* base, const SkOpSpanBase* testSpan); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 249 | bool addEndMovedSpans(const SkOpPtT* ptT); |
| 250 | |
caryclark | 8016b26 | 2016-09-06 05:59:47 -0700 | [diff] [blame] | 251 | bool addIfMissing(const SkOpPtT* over1s, const SkOpPtT* over2s, |
caryclark | 81a478c | 2016-09-09 09:37:57 -0700 | [diff] [blame] | 252 | double tStart, double tEnd, SkOpSegment* coinSeg, SkOpSegment* oppSeg, |
| 253 | bool* added |
caryclark | 8016b26 | 2016-09-06 05:59:47 -0700 | [diff] [blame] | 254 | SkDEBUGPARAMS(const SkOpPtT* over1e) SkDEBUGPARAMS(const SkOpPtT* over2e)); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 255 | bool addOrOverlap(SkOpSegment* coinSeg, SkOpSegment* oppSeg, |
caryclark | 81a478c | 2016-09-09 09:37:57 -0700 | [diff] [blame] | 256 | double coinTs, double coinTe, double oppTs, double oppTe, bool* added); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 257 | bool addOverlap(const SkOpSegment* seg1, const SkOpSegment* seg1o, |
| 258 | const SkOpSegment* seg2, const SkOpSegment* seg2o, |
| 259 | const SkOpPtT* overS, const SkOpPtT* overE); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 260 | bool checkOverlap(SkCoincidentSpans* check, |
| 261 | const SkOpSegment* coinSeg, const SkOpSegment* oppSeg, |
| 262 | double coinTs, double coinTe, double oppTs, double oppTe, |
| 263 | SkTDArray<SkCoincidentSpans*>* overlaps) const; |
| 264 | bool contains(const SkOpSegment* seg, const SkOpSegment* opp, double oppT) const; |
| 265 | bool contains(const SkCoincidentSpans* coin, const SkOpSegment* seg, |
| 266 | const SkOpSegment* opp, double oppT) const; |
Cary Clark | ab87d7a | 2016-10-04 10:01:04 -0400 | [diff] [blame] | 267 | #if DEBUG_COIN |
| 268 | void debugAddIfMissing(SkPathOpsDebug::GlitchLog* , |
caryclark | 8016b26 | 2016-09-06 05:59:47 -0700 | [diff] [blame] | 269 | const SkCoincidentSpans* outer, const SkOpPtT* over1s, |
| 270 | const SkOpPtT* over1e) const; |
Cary Clark | ab87d7a | 2016-10-04 10:01:04 -0400 | [diff] [blame] | 271 | void debugAddIfMissing(SkPathOpsDebug::GlitchLog* , |
caryclark | 8016b26 | 2016-09-06 05:59:47 -0700 | [diff] [blame] | 272 | const SkOpPtT* over1s, const SkOpPtT* over2s, |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 273 | double tStart, double tEnd, |
caryclark | 81a478c | 2016-09-09 09:37:57 -0700 | [diff] [blame] | 274 | const SkOpSegment* coinSeg, const SkOpSegment* oppSeg, bool* added, |
caryclark | 8016b26 | 2016-09-06 05:59:47 -0700 | [diff] [blame] | 275 | const SkOpPtT* over1e, const SkOpPtT* over2e) const; |
Cary Clark | ab87d7a | 2016-10-04 10:01:04 -0400 | [diff] [blame] | 276 | void debugAddEndMovedSpans(SkPathOpsDebug::GlitchLog* , |
| 277 | const SkOpSpan* base, const SkOpSpanBase* testSpan) const; |
| 278 | void debugAddEndMovedSpans(SkPathOpsDebug::GlitchLog* , |
| 279 | const SkOpPtT* ptT) const; |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 280 | #endif |
| 281 | void fixUp(SkCoincidentSpans* coin, SkOpPtT* deleted, const SkOpPtT* kept); |
| 282 | void markCollapsed(SkCoincidentSpans* head, SkOpPtT* test); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 283 | bool overlap(const SkOpPtT* coinStart1, const SkOpPtT* coinEnd1, |
| 284 | const SkOpPtT* coinStart2, const SkOpPtT* coinEnd2, |
| 285 | double* overS, double* overE) const; |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 286 | bool release(SkCoincidentSpans* coin, SkCoincidentSpans* ); |
caryclark | 30b9fdd | 2016-08-31 14:36:29 -0700 | [diff] [blame] | 287 | void releaseDeleted(SkCoincidentSpans* ); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 288 | void restoreHead(); |
caryclark | 8016b26 | 2016-09-06 05:59:47 -0700 | [diff] [blame] | 289 | // return coinPtT->segment()->t mapped from overS->fT <= t <= overE->fT |
| 290 | static double TRange(const SkOpPtT* overS, double t, const SkOpSegment* coinPtT |
| 291 | SkDEBUGPARAMS(const SkOpPtT* overE)); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 292 | |
caryclark | 45fa447 | 2015-01-16 07:04:10 -0800 | [diff] [blame] | 293 | SkCoincidentSpans* fHead; |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 294 | SkCoincidentSpans* fTop; |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 295 | SkOpGlobalState* fGlobalState; |
| 296 | bool fContinue; |
| 297 | bool fSpanDeleted; |
| 298 | bool fPtAllocated; |
| 299 | bool fCoinExtended; |
| 300 | bool fSpanMerged; |
caryclark | 45fa447 | 2015-01-16 07:04:10 -0800 | [diff] [blame] | 301 | }; |
| 302 | |
| 303 | #endif |