| 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" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 enum AllowAlias { | 26 enum AllowAlias { |
| 27 kAllowAlias, | 27 kAllowAlias, |
| 28 kNoAlias | 28 kNoAlias |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 bool operator<(const SkOpSegment& rh) const { | 31 bool operator<(const SkOpSegment& rh) const { |
| 32 return fBounds.fTop < rh.fBounds.fTop; | 32 return fBounds.fTop < rh.fBounds.fTop; |
| 33 } | 33 } |
| 34 | 34 |
| 35 SkOpAngle* activeAngle(SkOpSpanBase* start, SkOpSpanBase** startPtr, SkOpSpa
nBase** endPtr, | 35 SkOpAngle* activeAngle(SkOpSpanBase* start, SkOpSpanBase** startPtr, SkOpSpa
nBase** endPtr, |
| 36 bool* done, bool* sortable); | 36 bool* done); |
| 37 SkOpAngle* activeAngleInner(SkOpSpanBase* start, SkOpSpanBase** startPtr, | 37 SkOpAngle* activeAngleInner(SkOpSpanBase* start, SkOpSpanBase** startPtr, |
| 38 SkOpSpanBase** endPtr, bool* done, bool*
sortable); | 38 SkOpSpanBase** endPtr, bool* done); |
| 39 SkOpAngle* activeAngleOther(SkOpSpanBase* start, SkOpSpanBase** startPtr, | 39 SkOpAngle* activeAngleOther(SkOpSpanBase* start, SkOpSpanBase** startPtr, |
| 40 SkOpSpanBase** endPtr, bool* done, bool*
sortable); | 40 SkOpSpanBase** endPtr, bool* done); |
| 41 bool activeOp(SkOpSpanBase* start, SkOpSpanBase* end, int xorMiMask, int xor
SuMask, | 41 bool activeOp(SkOpSpanBase* start, SkOpSpanBase* end, int xorMiMask, int xor
SuMask, |
| 42 SkPathOp op); | 42 SkPathOp op); |
| 43 bool activeOp(int xorMiMask, int xorSuMask, SkOpSpanBase* start, SkOpSpanBas
e* end, SkPathOp op, | 43 bool activeOp(int xorMiMask, int xorSuMask, SkOpSpanBase* start, SkOpSpanBas
e* end, SkPathOp op, |
| 44 int* sumMiWinding, int* sumSuWinding); | 44 int* sumMiWinding, int* sumSuWinding); |
| 45 | 45 |
| 46 bool activeWinding(SkOpSpanBase* start, SkOpSpanBase* end); | 46 bool activeWinding(SkOpSpanBase* start, SkOpSpanBase* end); |
| 47 bool activeWinding(SkOpSpanBase* start, SkOpSpanBase* end, int* sumWinding); | 47 bool activeWinding(SkOpSpanBase* start, SkOpSpanBase* end, int* sumWinding); |
| 48 | 48 |
| 49 SkOpSegment* addConic(SkPoint pts[3], SkScalar weight, SkOpContour* parent)
{ | 49 SkOpSegment* addConic(SkPoint pts[3], SkScalar weight, SkOpContour* parent)
{ |
| 50 init(pts, weight, parent, SkPath::kConic_Verb); | 50 init(pts, weight, parent, SkPath::kConic_Verb); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 return fBounds; | 103 return fBounds; |
| 104 } | 104 } |
| 105 | 105 |
| 106 void bumpCount() { | 106 void bumpCount() { |
| 107 ++fCount; | 107 ++fCount; |
| 108 } | 108 } |
| 109 | 109 |
| 110 void calcAngles(SkChunkAlloc*); | 110 void calcAngles(SkChunkAlloc*); |
| 111 void checkAngleCoin(SkOpCoincidence* coincidences, SkChunkAlloc* allocator); | 111 void checkAngleCoin(SkOpCoincidence* coincidences, SkChunkAlloc* allocator); |
| 112 void checkNearCoincidence(SkOpAngle* ); | 112 void checkNearCoincidence(SkOpAngle* ); |
| 113 bool collapsed() const; |
| 113 static void ComputeOneSum(const SkOpAngle* baseAngle, SkOpAngle* nextAngle, | 114 static void ComputeOneSum(const SkOpAngle* baseAngle, SkOpAngle* nextAngle, |
| 114 SkOpAngle::IncludeType ); | 115 SkOpAngle::IncludeType ); |
| 115 static void ComputeOneSumReverse(SkOpAngle* baseAngle, SkOpAngle* nextAngle, | 116 static void ComputeOneSumReverse(SkOpAngle* baseAngle, SkOpAngle* nextAngle, |
| 116 SkOpAngle::IncludeType ); | 117 SkOpAngle::IncludeType ); |
| 117 int computeSum(SkOpSpanBase* start, SkOpSpanBase* end, SkOpAngle::IncludeTyp
e includeType); | 118 int computeSum(SkOpSpanBase* start, SkOpSpanBase* end, SkOpAngle::IncludeTyp
e includeType); |
| 118 | 119 |
| 119 SkOpContour* contour() const { | 120 SkOpContour* contour() const { |
| 120 return fContour; | 121 return fContour; |
| 121 } | 122 } |
| 122 | 123 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 } | 300 } |
| 300 | 301 |
| 301 void setNext(SkOpSegment* next) { | 302 void setNext(SkOpSegment* next) { |
| 302 fNext = next; | 303 fNext = next; |
| 303 } | 304 } |
| 304 | 305 |
| 305 void setPrev(SkOpSegment* prev) { | 306 void setPrev(SkOpSegment* prev) { |
| 306 fPrev = prev; | 307 fPrev = prev; |
| 307 } | 308 } |
| 308 | 309 |
| 309 bool setVisited() { | 310 void setVisited() { |
| 310 if (fVisited) { | 311 fVisited = true; |
| 311 return false; | |
| 312 } | |
| 313 return (fVisited = true); | |
| 314 } | 312 } |
| 315 | 313 |
| 316 void setUpWinding(SkOpSpanBase* start, SkOpSpanBase* end, int* maxWinding, i
nt* sumWinding) { | 314 void setUpWinding(SkOpSpanBase* start, SkOpSpanBase* end, int* maxWinding, i
nt* sumWinding) { |
| 317 int deltaSum = SpanSign(start, end); | 315 int deltaSum = SpanSign(start, end); |
| 318 *maxWinding = *sumWinding; | 316 *maxWinding = *sumWinding; |
| 319 *sumWinding -= deltaSum; | 317 *sumWinding -= deltaSum; |
| 320 } | 318 } |
| 321 | 319 |
| 322 void setUpWindings(SkOpSpanBase* start, SkOpSpanBase* end, int* sumMiWinding
, | 320 void setUpWindings(SkOpSpanBase* start, SkOpSpanBase* end, int* sumMiWinding
, |
| 323 int* maxWinding, int* sumWinding); | 321 int* maxWinding, int* sumWinding); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 354 int updateWinding(SkOpSpanBase* start, SkOpSpanBase* end); | 352 int updateWinding(SkOpSpanBase* start, SkOpSpanBase* end); |
| 355 int updateWinding(SkOpAngle* angle); | 353 int updateWinding(SkOpAngle* angle); |
| 356 int updateWindingReverse(const SkOpAngle* angle); | 354 int updateWindingReverse(const SkOpAngle* angle); |
| 357 | 355 |
| 358 static bool UseInnerWinding(int outerWinding, int innerWinding); | 356 static bool UseInnerWinding(int outerWinding, int innerWinding); |
| 359 | 357 |
| 360 SkPath::Verb verb() const { | 358 SkPath::Verb verb() const { |
| 361 return fVerb; | 359 return fVerb; |
| 362 } | 360 } |
| 363 | 361 |
| 362 // look for two different spans that point to the same opposite segment |
| 363 bool visited() { |
| 364 if (!fVisited) { |
| 365 fVisited = true; |
| 366 return false; |
| 367 } |
| 368 return true; |
| 369 } |
| 370 |
| 364 SkScalar weight() const { | 371 SkScalar weight() const { |
| 365 return fWeight; | 372 return fWeight; |
| 366 } | 373 } |
| 367 | 374 |
| 368 SkOpSpan* windingSpanAtT(double tHit); | 375 SkOpSpan* windingSpanAtT(double tHit); |
| 369 int windSum(const SkOpAngle* angle) const; | 376 int windSum(const SkOpAngle* angle) const; |
| 370 | 377 |
| 371 SkPoint* writablePt(bool end) { | 378 SkPoint* writablePt(bool end) { |
| 372 return &fPts[end ? SkPathOpsVerbToPoints(fVerb) : 0]; | 379 return &fPts[end ? SkPathOpsVerbToPoints(fVerb) : 0]; |
| 373 } | 380 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 384 int fCount; // number of spans (one for a non-intersecting segment) | 391 int fCount; // number of spans (one for a non-intersecting segment) |
| 385 int fDoneCount; // number of processed spans (zero initially) | 392 int fDoneCount; // number of processed spans (zero initially) |
| 386 SkPath::Verb fVerb; | 393 SkPath::Verb fVerb; |
| 387 SkDCubic::CubicType fCubicType; | 394 SkDCubic::CubicType fCubicType; |
| 388 bool fTopsFound; | 395 bool fTopsFound; |
| 389 bool fVisited; // used by missing coincidence check | 396 bool fVisited; // used by missing coincidence check |
| 390 SkDEBUGCODE(int fID); | 397 SkDEBUGCODE(int fID); |
| 391 }; | 398 }; |
| 392 | 399 |
| 393 #endif | 400 #endif |
| OLD | NEW |