| 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 SkOpContour_DEFINED | 7 #ifndef SkOpContour_DEFINED |
| 8 #define SkOpContour_DEFINED | 8 #define SkOpContour_DEFINED |
| 9 | 9 |
| 10 #include "SkOpSegment.h" | 10 #include "SkOpSegment.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 fNext->~SkOpContour(); | 25 fNext->~SkOpContour(); |
| 26 } | 26 } |
| 27 } | 27 } |
| 28 | 28 |
| 29 bool operator<(const SkOpContour& rh) const { | 29 bool operator<(const SkOpContour& rh) const { |
| 30 return fBounds.fTop == rh.fBounds.fTop | 30 return fBounds.fTop == rh.fBounds.fTop |
| 31 ? fBounds.fLeft < rh.fBounds.fLeft | 31 ? fBounds.fLeft < rh.fBounds.fLeft |
| 32 : fBounds.fTop < rh.fBounds.fTop; | 32 : fBounds.fTop < rh.fBounds.fTop; |
| 33 } | 33 } |
| 34 | 34 |
| 35 void addConic(SkPoint pts[3], SkScalar weight, SkChunkAlloc* allocator) { |
| 36 appendSegment(allocator).addConic(pts, weight, this); |
| 37 } |
| 38 |
| 35 void addCubic(SkPoint pts[4], SkChunkAlloc* allocator) { | 39 void addCubic(SkPoint pts[4], SkChunkAlloc* allocator) { |
| 36 appendSegment(allocator).addCubic(pts, this); | 40 appendSegment(allocator).addCubic(pts, this); |
| 37 } | 41 } |
| 38 | 42 |
| 39 void addCurve(SkPath::Verb verb, const SkPoint pts[4], SkChunkAlloc* allocat
or); | 43 void addCurve(SkPath::Verb verb, const SkPoint pts[4], SkChunkAlloc* allocat
or); |
| 40 | 44 |
| 41 void addLine(SkPoint pts[2], SkChunkAlloc* allocator) { | 45 void addLine(SkPoint pts[2], SkChunkAlloc* allocator) { |
| 42 appendSegment(allocator).addLine(pts, this); | 46 appendSegment(allocator).addLine(pts, this); |
| 43 } | 47 } |
| 44 | 48 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 95 |
| 92 void complete() { | 96 void complete() { |
| 93 setBounds(); | 97 setBounds(); |
| 94 } | 98 } |
| 95 | 99 |
| 96 int count() const { | 100 int count() const { |
| 97 return fCount; | 101 return fCount; |
| 98 } | 102 } |
| 99 | 103 |
| 100 int debugID() const { | 104 int debugID() const { |
| 101 return PATH_OPS_DEBUG_RELEASE(fID, -1); | 105 return SkDEBUGRELEASE(fID, -1); |
| 102 } | 106 } |
| 103 | 107 |
| 104 int debugIndent() const { | 108 int debugIndent() const { |
| 105 return PATH_OPS_DEBUG_RELEASE(fIndent, 0); | 109 return SkDEBUGRELEASE(fIndent, 0); |
| 106 } | 110 } |
| 107 | 111 |
| 108 #if DEBUG_ACTIVE_SPANS | 112 #if DEBUG_ACTIVE_SPANS |
| 109 void debugShowActiveSpans() { | 113 void debugShowActiveSpans() { |
| 110 SkOpSegment* segment = &fHead; | 114 SkOpSegment* segment = &fHead; |
| 111 do { | 115 do { |
| 112 segment->debugShowActiveSpans(); | 116 segment->debugShowActiveSpans(); |
| 113 } while ((segment = segment->next())); | 117 } while ((segment = segment->next())); |
| 114 } | 118 } |
| 115 #endif | 119 #endif |
| 116 | 120 |
| 117 const SkOpAngle* debugAngle(int id) const { | 121 const SkOpAngle* debugAngle(int id) const { |
| 118 return PATH_OPS_DEBUG_RELEASE(globalState()->debugAngle(id), NULL); | 122 return SkDEBUGRELEASE(globalState()->debugAngle(id), NULL); |
| 119 } | 123 } |
| 120 | 124 |
| 121 SkOpContour* debugContour(int id) { | 125 SkOpContour* debugContour(int id) { |
| 122 return PATH_OPS_DEBUG_RELEASE(globalState()->debugContour(id), NULL); | 126 return SkDEBUGRELEASE(globalState()->debugContour(id), NULL); |
| 123 } | 127 } |
| 124 | 128 |
| 125 const SkOpPtT* debugPtT(int id) const { | 129 const SkOpPtT* debugPtT(int id) const { |
| 126 return PATH_OPS_DEBUG_RELEASE(globalState()->debugPtT(id), NULL); | 130 return SkDEBUGRELEASE(globalState()->debugPtT(id), NULL); |
| 127 } | 131 } |
| 128 | 132 |
| 129 const SkOpSegment* debugSegment(int id) const { | 133 const SkOpSegment* debugSegment(int id) const { |
| 130 return PATH_OPS_DEBUG_RELEASE(globalState()->debugSegment(id), NULL); | 134 return SkDEBUGRELEASE(globalState()->debugSegment(id), NULL); |
| 131 } | 135 } |
| 132 | 136 |
| 133 const SkOpSpanBase* debugSpan(int id) const { | 137 const SkOpSpanBase* debugSpan(int id) const { |
| 134 return PATH_OPS_DEBUG_RELEASE(globalState()->debugSpan(id), NULL); | 138 return SkDEBUGRELEASE(globalState()->debugSpan(id), NULL); |
| 135 } | 139 } |
| 136 | 140 |
| 137 SkOpGlobalState* globalState() const { | 141 SkOpGlobalState* globalState() const { |
| 138 return fState; | 142 return fState; |
| 139 } | 143 } |
| 140 | 144 |
| 141 void debugValidate() const { | 145 void debugValidate() const { |
| 142 #if DEBUG_VALIDATE | 146 #if DEBUG_VALIDATE |
| 143 const SkOpSegment* segment = &fHead; | 147 const SkOpSegment* segment = &fHead; |
| 144 const SkOpSegment* prior = NULL; | 148 const SkOpSegment* prior = NULL; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 174 SkASSERT(fCount > 0); | 178 SkASSERT(fCount > 0); |
| 175 return &fHead; | 179 return &fHead; |
| 176 } | 180 } |
| 177 | 181 |
| 178 const SkOpSegment* first() const { | 182 const SkOpSegment* first() const { |
| 179 SkASSERT(fCount > 0); | 183 SkASSERT(fCount > 0); |
| 180 return &fHead; | 184 return &fHead; |
| 181 } | 185 } |
| 182 | 186 |
| 183 void indentDump() { | 187 void indentDump() { |
| 184 PATH_OPS_DEBUG_CODE(fIndent += 2); | 188 SkDEBUGCODE(fIndent += 2); |
| 185 } | 189 } |
| 186 | 190 |
| 187 void init(SkOpGlobalState* globalState, bool operand, bool isXor) { | 191 void init(SkOpGlobalState* globalState, bool operand, bool isXor) { |
| 188 fState = globalState; | 192 fState = globalState; |
| 189 fOperand = operand; | 193 fOperand = operand; |
| 190 fXor = isXor; | 194 fXor = isXor; |
| 191 } | 195 } |
| 192 | 196 |
| 193 bool isXor() const { | 197 bool isXor() const { |
| 194 return fXor; | 198 return fXor; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 233 |
| 230 bool operand() const { | 234 bool operand() const { |
| 231 return fOperand; | 235 return fOperand; |
| 232 } | 236 } |
| 233 | 237 |
| 234 bool oppXor() const { | 238 bool oppXor() const { |
| 235 return fOppXor; | 239 return fOppXor; |
| 236 } | 240 } |
| 237 | 241 |
| 238 void outdentDump() { | 242 void outdentDump() { |
| 239 PATH_OPS_DEBUG_CODE(fIndent -= 2); | 243 SkDEBUGCODE(fIndent -= 2); |
| 240 } | 244 } |
| 241 | 245 |
| 242 void remove(SkOpContour* contour) { | 246 void remove(SkOpContour* contour) { |
| 243 if (contour == this) { | 247 if (contour == this) { |
| 244 SkASSERT(fCount == 0); | 248 SkASSERT(fCount == 0); |
| 245 return; | 249 return; |
| 246 } | 250 } |
| 247 SkASSERT(contour->fNext == NULL); | 251 SkASSERT(contour->fNext == NULL); |
| 248 SkOpContour* prev = this; | 252 SkOpContour* prev = this; |
| 249 SkOpContour* next; | 253 SkOpContour* next; |
| 250 while ((next = prev->next()) != contour) { | 254 while ((next = prev->next()) != contour) { |
| 251 SkASSERT(next); | 255 SkASSERT(next); |
| 252 prev = next; | 256 prev = next; |
| 253 } | 257 } |
| 254 SkASSERT(prev); | 258 SkASSERT(prev); |
| 255 prev->setNext(NULL); | 259 prev->setNext(NULL); |
| 256 } | 260 } |
| 257 | 261 |
| 258 void reset() { | 262 void reset() { |
| 259 fTail = NULL; | 263 fTail = NULL; |
| 260 fNext = NULL; | 264 fNext = NULL; |
| 261 fCount = 0; | 265 fCount = 0; |
| 262 fDone = false; | 266 fDone = false; |
| 263 SkDEBUGCODE(fBounds.set(SK_ScalarMax, SK_ScalarMax, SK_ScalarMin, SK_Sca
larMin)); | 267 SkDEBUGCODE(fBounds.set(SK_ScalarMax, SK_ScalarMax, SK_ScalarMin, SK_Sca
larMin)); |
| 264 SkDEBUGCODE(fFirstSorted = -1); | 268 SkDEBUGCODE(fFirstSorted = -1); |
| 265 PATH_OPS_DEBUG_CODE(fIndent = 0); | 269 SkDEBUGCODE(fIndent = 0); |
| 266 } | 270 } |
| 267 | 271 |
| 268 void setBounds() { | 272 void setBounds() { |
| 269 SkASSERT(fCount > 0); | 273 SkASSERT(fCount > 0); |
| 270 const SkOpSegment* segment = &fHead; | 274 const SkOpSegment* segment = &fHead; |
| 271 fBounds = segment->bounds(); | 275 fBounds = segment->bounds(); |
| 272 while ((segment = segment->next())) { | 276 while ((segment = segment->next())) { |
| 273 fBounds.add(segment->bounds()); | 277 fBounds.add(segment->bounds()); |
| 274 } | 278 } |
| 275 } | 279 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 SkOpSegment* fTail; | 346 SkOpSegment* fTail; |
| 343 SkOpContour* fNext; | 347 SkOpContour* fNext; |
| 344 SkTDArray<SkOpSegment*> fSortedSegments; // set by find top segment | 348 SkTDArray<SkOpSegment*> fSortedSegments; // set by find top segment |
| 345 SkPathOpsBounds fBounds; | 349 SkPathOpsBounds fBounds; |
| 346 int fCount; | 350 int fCount; |
| 347 int fFirstSorted; | 351 int fFirstSorted; |
| 348 bool fDone; // set by find top segment | 352 bool fDone; // set by find top segment |
| 349 bool fOperand; // true for the second argument to a binary operator | 353 bool fOperand; // true for the second argument to a binary operator |
| 350 bool fXor; // set if original path had even-odd fill | 354 bool fXor; // set if original path had even-odd fill |
| 351 bool fOppXor; // set if opposite path had even-odd fill | 355 bool fOppXor; // set if opposite path had even-odd fill |
| 352 PATH_OPS_DEBUG_CODE(int fID); | 356 SkDEBUGCODE(int fID); |
| 353 PATH_OPS_DEBUG_CODE(int fIndent); | 357 SkDEBUGCODE(int fIndent); |
| 354 }; | 358 }; |
| 355 | 359 |
| 356 #endif | 360 #endif |
| OLD | NEW |