OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 SkOpCoincidence_DEFINED | 7 #ifndef SkOpCoincidence_DEFINED |
8 #define SkOpCoincidence_DEFINED | 8 #define SkOpCoincidence_DEFINED |
9 | 9 |
10 #include "SkTDArray.h" | 10 #include "SkTDArray.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 void debugShow() const; | 42 void debugShow() const; |
43 #ifdef SK_DEBUG | 43 #ifdef SK_DEBUG |
44 void debugStartCheck(const SkOpSpanBase* outer, const SkOpSpanBase* over, | 44 void debugStartCheck(const SkOpSpanBase* outer, const SkOpSpanBase* over, |
45 const SkOpGlobalState* debugState) const; | 45 const SkOpGlobalState* debugState) const; |
46 #endif | 46 #endif |
47 void dump() const; | 47 void dump() const; |
48 bool expand(); | 48 bool expand(); |
49 bool extend(const SkOpPtT* coinPtTStart, const SkOpPtT* coinPtTEnd, | 49 bool extend(const SkOpPtT* coinPtTStart, const SkOpPtT* coinPtTEnd, |
50 const SkOpPtT* oppPtTStart, const SkOpPtT* oppPtTEnd); | 50 const SkOpPtT* oppPtTStart, const SkOpPtT* oppPtTEnd); |
51 bool flipped() const { return fOppPtTStart->fT > fOppPtTEnd->fT; } | 51 bool flipped() const { return fOppPtTStart->fT > fOppPtTEnd->fT; } |
52 void init() { sk_bzero(this, sizeof(*this)); } | 52 SkDEBUGCODE(SkOpGlobalState* globalState() { return fGlobalState; }) |
| 53 |
| 54 void init(SkDEBUGCODE(SkOpGlobalState* globalState)) { |
| 55 sk_bzero(this, sizeof(*this)); |
| 56 SkDEBUGCODE(fGlobalState = globalState); |
| 57 } |
| 58 |
53 const SkOpPtT* oppPtTStart() const { return fOppPtTStart; } | 59 const SkOpPtT* oppPtTStart() const { return fOppPtTStart; } |
54 const SkOpPtT* oppPtTEnd() const { return fOppPtTEnd; } | 60 const SkOpPtT* oppPtTEnd() const { return fOppPtTEnd; } |
55 // These return non-const pointers so that, as copies, they can be added | 61 // These return non-const pointers so that, as copies, they can be added |
56 // to a new span pair | 62 // to a new span pair |
57 SkOpPtT* oppPtTStartWritable() const { return const_cast<SkOpPtT*>(fOppPtTSt
art); } | 63 SkOpPtT* oppPtTStartWritable() const { return const_cast<SkOpPtT*>(fOppPtTSt
art); } |
58 SkOpPtT* oppPtTEndWritable() const { return const_cast<SkOpPtT*>(fOppPtTEnd)
; } | 64 SkOpPtT* oppPtTEndWritable() const { return const_cast<SkOpPtT*>(fOppPtTEnd)
; } |
59 SkCoincidentSpans* next() { return fNext; } | 65 SkCoincidentSpans* next() { return fNext; } |
60 const SkCoincidentSpans* next() const { return fNext; } | 66 const SkCoincidentSpans* next() const { return fNext; } |
61 SkCoincidentSpans** nextPtr() { return &fNext; } | 67 SkCoincidentSpans** nextPtr() { return &fNext; } |
62 int spanCount() const; | 68 int spanCount() const; |
63 | 69 |
64 void set(SkCoincidentSpans* next, const SkOpPtT* coinPtTStart, const SkOpPtT
* coinPtTEnd, | 70 void set(SkCoincidentSpans* next, const SkOpPtT* coinPtTStart, const SkOpPtT
* coinPtTEnd, |
65 const SkOpPtT* oppPtTStart, const SkOpPtT* oppPtTEnd | 71 const SkOpPtT* oppPtTStart, const SkOpPtT* oppPtTEnd |
66 SkDEBUGPARAMS(int id)); | 72 SkDEBUGPARAMS(int id)); |
67 | 73 |
68 void setCoinPtTEnd(const SkOpPtT* ptT) { | 74 void setCoinPtTEnd(const SkOpPtT* ptT) { |
69 SkASSERT(ptT == ptT->span()->ptT()) | 75 SkOPASSERT(ptT == ptT->span()->ptT()) |
70 SkASSERT(!fCoinPtTStart || ptT->fT != fCoinPtTStart->fT); | 76 SkASSERT(!fCoinPtTStart || ptT->fT != fCoinPtTStart->fT); |
71 SkASSERT(!fCoinPtTStart || fCoinPtTStart->segment() == ptT->segment()); | 77 SkASSERT(!fCoinPtTStart || fCoinPtTStart->segment() == ptT->segment()); |
72 fCoinPtTEnd = ptT; | 78 fCoinPtTEnd = ptT; |
73 ptT->setCoincident(); | 79 ptT->setCoincident(); |
74 } | 80 } |
75 | 81 |
76 void setCoinPtTStart(const SkOpPtT* ptT) { | 82 void setCoinPtTStart(const SkOpPtT* ptT) { |
77 SkASSERT(ptT == ptT->span()->ptT()) | 83 SkASSERT(ptT == ptT->span()->ptT()) |
78 SkASSERT(!fCoinPtTEnd || ptT->fT != fCoinPtTEnd->fT); | 84 SkASSERT(!fCoinPtTEnd || ptT->fT != fCoinPtTEnd->fT); |
79 SkASSERT(!fCoinPtTEnd || fCoinPtTEnd->segment() == ptT->segment()); | 85 SkASSERT(!fCoinPtTEnd || fCoinPtTEnd->segment() == ptT->segment()); |
80 fCoinPtTStart = ptT; | 86 fCoinPtTStart = ptT; |
81 ptT->setCoincident(); | 87 ptT->setCoincident(); |
82 } | 88 } |
83 | 89 |
84 void setEnds(const SkOpPtT* coinPtTEnd, const SkOpPtT* oppPtTEnd) { | 90 void setEnds(const SkOpPtT* coinPtTEnd, const SkOpPtT* oppPtTEnd) { |
85 this->setCoinPtTEnd(coinPtTEnd); | 91 this->setCoinPtTEnd(coinPtTEnd); |
86 this->setOppPtTEnd(oppPtTEnd); | 92 this->setOppPtTEnd(oppPtTEnd); |
87 } | 93 } |
88 | 94 |
89 void setOppPtTEnd(const SkOpPtT* ptT) { | 95 void setOppPtTEnd(const SkOpPtT* ptT) { |
90 SkASSERT(ptT == ptT->span()->ptT()) | 96 SkOPASSERT(ptT == ptT->span()->ptT()) |
91 SkASSERT(!fOppPtTStart || ptT->fT != fOppPtTStart->fT); | 97 SkASSERT(!fOppPtTStart || ptT->fT != fOppPtTStart->fT); |
92 SkASSERT(!fOppPtTStart || fOppPtTStart->segment() == ptT->segment()); | 98 SkASSERT(!fOppPtTStart || fOppPtTStart->segment() == ptT->segment()); |
93 fOppPtTEnd = ptT; | 99 fOppPtTEnd = ptT; |
94 ptT->setCoincident(); | 100 ptT->setCoincident(); |
95 } | 101 } |
96 | 102 |
97 void setOppPtTStart(const SkOpPtT* ptT) { | 103 void setOppPtTStart(const SkOpPtT* ptT) { |
98 SkASSERT(ptT == ptT->span()->ptT()) | 104 SkASSERT(ptT == ptT->span()->ptT()) |
99 SkASSERT(!fOppPtTEnd || ptT->fT != fOppPtTEnd->fT); | 105 SkASSERT(!fOppPtTEnd || ptT->fT != fOppPtTEnd->fT); |
100 SkASSERT(!fOppPtTEnd || fOppPtTEnd->segment() == ptT->segment()); | 106 SkASSERT(!fOppPtTEnd || fOppPtTEnd->segment() == ptT->segment()); |
(...skipping 10 matching lines...) Expand all Loading... |
111 | 117 |
112 bool startEquals(const SkOpSpanBase* outer, const SkOpSpanBase* over) const
{ | 118 bool startEquals(const SkOpSpanBase* outer, const SkOpSpanBase* over) const
{ |
113 return fCoinPtTStart->span() == over && fOppPtTStart->span() == outer; | 119 return fCoinPtTStart->span() == over && fOppPtTStart->span() == outer; |
114 } | 120 } |
115 private: | 121 private: |
116 SkCoincidentSpans* fNext; | 122 SkCoincidentSpans* fNext; |
117 const SkOpPtT* fCoinPtTStart; | 123 const SkOpPtT* fCoinPtTStart; |
118 const SkOpPtT* fCoinPtTEnd; | 124 const SkOpPtT* fCoinPtTEnd; |
119 const SkOpPtT* fOppPtTStart; | 125 const SkOpPtT* fOppPtTStart; |
120 const SkOpPtT* fOppPtTEnd; | 126 const SkOpPtT* fOppPtTEnd; |
| 127 SkDEBUGCODE(SkOpGlobalState* fGlobalState); |
121 SkDEBUGCODE(int fID); | 128 SkDEBUGCODE(int fID); |
122 }; | 129 }; |
123 | 130 |
124 class SkOpCoincidence { | 131 class SkOpCoincidence { |
125 public: | 132 public: |
126 SkOpCoincidence(SkOpGlobalState* globalState) | 133 SkOpCoincidence(SkOpGlobalState* globalState) |
127 : fHead(nullptr) | 134 : fHead(nullptr) |
128 , fTop(nullptr) | 135 , fTop(nullptr) |
129 , fGlobalState(globalState) | 136 , fGlobalState(globalState) |
130 , fContinue(false) | 137 , fContinue(false) |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 SkCoincidentSpans* fTop; | 304 SkCoincidentSpans* fTop; |
298 SkOpGlobalState* fGlobalState; | 305 SkOpGlobalState* fGlobalState; |
299 bool fContinue; | 306 bool fContinue; |
300 bool fSpanDeleted; | 307 bool fSpanDeleted; |
301 bool fPtAllocated; | 308 bool fPtAllocated; |
302 bool fCoinExtended; | 309 bool fCoinExtended; |
303 bool fSpanMerged; | 310 bool fSpanMerged; |
304 }; | 311 }; |
305 | 312 |
306 #endif | 313 #endif |
OLD | NEW |