| 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 "SkPathOpsCurve.h" | 15 #include "SkPathOpsCurve.h" |
| 15 | 16 |
| 16 struct SkDCurve; | 17 struct SkDCurve; |
| 17 class SkOpCoincidence; | 18 class SkOpCoincidence; |
| 18 class SkOpContour; | 19 class SkOpContour; |
| 19 class SkPathWriter; | 20 class SkPathWriter; |
| 20 | 21 |
| 21 class SkOpSegment { | 22 class SkOpSegment { |
| 22 public: | 23 public: |
| 23 enum AllowAlias { | 24 enum AllowAlias { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 38 bool activeOp(SkOpSpanBase* start, SkOpSpanBase* end, int xorMiMask, int xor
SuMask, | 39 bool activeOp(SkOpSpanBase* start, SkOpSpanBase* end, int xorMiMask, int xor
SuMask, |
| 39 SkPathOp op); | 40 SkPathOp op); |
| 40 bool activeOp(int xorMiMask, int xorSuMask, SkOpSpanBase* start, SkOpSpanBas
e* end, SkPathOp op, | 41 bool activeOp(int xorMiMask, int xorSuMask, SkOpSpanBase* start, SkOpSpanBas
e* end, SkPathOp op, |
| 41 int* sumMiWinding, int* sumSuWinding); | 42 int* sumMiWinding, int* sumSuWinding); |
| 42 | 43 |
| 43 SkPoint activeLeftTop(SkOpSpanBase** firstT); | 44 SkPoint activeLeftTop(SkOpSpanBase** firstT); |
| 44 | 45 |
| 45 bool activeWinding(SkOpSpanBase* start, SkOpSpanBase* end); | 46 bool activeWinding(SkOpSpanBase* start, SkOpSpanBase* end); |
| 46 bool activeWinding(SkOpSpanBase* start, SkOpSpanBase* end, int* sumWinding); | 47 bool activeWinding(SkOpSpanBase* start, SkOpSpanBase* end, int* sumWinding); |
| 47 | 48 |
| 48 void addConic(SkPoint pts[3], SkScalar weight, SkOpContour* parent) { | 49 SkOpSegment* addConic(SkPoint pts[3], SkScalar weight, SkOpContour* parent)
{ |
| 49 init(pts, weight, parent, SkPath::kConic_Verb); | 50 init(pts, weight, parent, SkPath::kConic_Verb); |
| 50 fBounds.setConicBounds(pts, weight); | 51 fBounds.setConicBounds(pts, weight); |
| 52 return this; |
| 51 } | 53 } |
| 52 | 54 |
| 53 void addCubic(SkPoint pts[4], SkOpContour* parent) { | 55 SkOpSegment* addCubic(SkPoint pts[4], SkOpContour* parent) { |
| 54 init(pts, 1, parent, SkPath::kCubic_Verb); | 56 init(pts, 1, parent, SkPath::kCubic_Verb); |
| 55 fBounds.setCubicBounds(pts, 1); | 57 fBounds.setCubicBounds(pts, 1); |
| 58 return this; |
| 56 } | 59 } |
| 57 | 60 |
| 58 void addCurveTo(const SkOpSpanBase* start, const SkOpSpanBase* end, SkPathWr
iter* path, | 61 void addCurveTo(const SkOpSpanBase* start, const SkOpSpanBase* end, SkPathWr
iter* path, |
| 59 bool active) const; | 62 bool active) const; |
| 60 | 63 |
| 61 SkOpAngle* addEndSpan(SkChunkAlloc* allocator) { | 64 SkOpAngle* addEndSpan(SkChunkAlloc* allocator) { |
| 62 SkOpAngle* angle = SkOpTAllocator<SkOpAngle>::Allocate(allocator); | 65 SkOpAngle* angle = SkOpTAllocator<SkOpAngle>::Allocate(allocator); |
| 63 angle->set(&fTail, fTail.prev()); | 66 angle->set(&fTail, fTail.prev()); |
| 64 fTail.setFromAngle(angle); | 67 fTail.setFromAngle(angle); |
| 65 return angle; | 68 return angle; |
| 66 } | 69 } |
| 67 | 70 |
| 68 void addLine(SkPoint pts[2], SkOpContour* parent) { | 71 SkOpSegment* addLine(SkPoint pts[2], SkOpContour* parent) { |
| 69 init(pts, 1, parent, SkPath::kLine_Verb); | 72 init(pts, 1, parent, SkPath::kLine_Verb); |
| 70 fBounds.set(pts, 2); | 73 fBounds.set(pts, 2); |
| 74 return this; |
| 71 } | 75 } |
| 72 | 76 |
| 73 SkOpPtT* addMissing(double t, SkOpSegment* opp, SkChunkAlloc* ); | 77 SkOpPtT* addMissing(double t, SkOpSegment* opp, SkChunkAlloc* ); |
| 74 SkOpAngle* addSingletonAngleDown(SkOpSegment** otherPtr, SkOpAngle** , SkChu
nkAlloc* ); | 78 SkOpAngle* addSingletonAngleDown(SkOpSegment** otherPtr, SkOpAngle** , SkChu
nkAlloc* ); |
| 75 SkOpAngle* addSingletonAngles(int step, SkChunkAlloc* ); | 79 SkOpAngle* addSingletonAngles(int step, SkChunkAlloc* ); |
| 76 SkOpAngle* addSingletonAngleUp(SkOpSegment** otherPtr, SkOpAngle** , SkChunk
Alloc* ); | 80 SkOpAngle* addSingletonAngleUp(SkOpSegment** otherPtr, SkOpAngle** , SkChunk
Alloc* ); |
| 77 | 81 |
| 78 SkOpAngle* addStartSpan(SkChunkAlloc* allocator) { | 82 SkOpAngle* addStartSpan(SkChunkAlloc* allocator) { |
| 79 SkOpAngle* angle = SkOpTAllocator<SkOpAngle>::Allocate(allocator); | 83 SkOpAngle* angle = SkOpTAllocator<SkOpAngle>::Allocate(allocator); |
| 80 angle->set(&fHead, fHead.next()); | 84 angle->set(&fHead, fHead.next()); |
| 81 fHead.setToAngle(angle); | 85 fHead.setToAngle(angle); |
| 82 return angle; | 86 return angle; |
| 83 } | 87 } |
| 84 | 88 |
| 85 void addQuad(SkPoint pts[3], SkOpContour* parent) { | 89 SkOpSegment* addQuad(SkPoint pts[3], SkOpContour* parent) { |
| 86 init(pts, 1, parent, SkPath::kQuad_Verb); | 90 init(pts, 1, parent, SkPath::kQuad_Verb); |
| 87 fBounds.setQuadBounds(pts, 1); | 91 fBounds.setQuadBounds(pts, 1); |
| 92 return this; |
| 88 } | 93 } |
| 89 | 94 |
| 90 SkOpPtT* addT(double t, AllowAlias , SkChunkAlloc* ); | 95 SkOpPtT* addT(double t, AllowAlias , SkChunkAlloc* ); |
| 91 | 96 |
| 92 void align(); | 97 void align(); |
| 93 static bool BetweenTs(const SkOpSpanBase* lesser, double testT, const SkOpSp
anBase* greater); | 98 static bool BetweenTs(const SkOpSpanBase* lesser, double testT, const SkOpSp
anBase* greater); |
| 94 | 99 |
| 95 const SkPathOpsBounds& bounds() const { | 100 const SkPathOpsBounds& bounds() const { |
| 96 return fBounds; | 101 return fBounds; |
| 97 } | 102 } |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 bool ptsDisjoint(double t1, const SkPoint& pt1, double t2, const SkPoint& pt
2) const; | 295 bool ptsDisjoint(double t1, const SkPoint& pt1, double t2, const SkPoint& pt
2) const; |
| 291 | 296 |
| 292 void resetVisited() { | 297 void resetVisited() { |
| 293 fVisited = false; | 298 fVisited = false; |
| 294 } | 299 } |
| 295 | 300 |
| 296 void setContour(SkOpContour* contour) { | 301 void setContour(SkOpContour* contour) { |
| 297 fContour = contour; | 302 fContour = contour; |
| 298 } | 303 } |
| 299 | 304 |
| 305 void setCubicType(SkDCubic::CubicType cubicType) { |
| 306 fCubicType = cubicType; |
| 307 } |
| 308 |
| 300 void setNext(SkOpSegment* next) { | 309 void setNext(SkOpSegment* next) { |
| 301 fNext = next; | 310 fNext = next; |
| 302 } | 311 } |
| 303 | 312 |
| 304 void setPrev(SkOpSegment* prev) { | 313 void setPrev(SkOpSegment* prev) { |
| 305 fPrev = prev; | 314 fPrev = prev; |
| 306 } | 315 } |
| 307 | 316 |
| 308 bool setVisited() { | 317 bool setVisited() { |
| 309 if (fVisited) { | 318 if (fVisited) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 SkOpSpanBase fTail; // the tail span always has its t set to one | 391 SkOpSpanBase fTail; // the tail span always has its t set to one |
| 383 SkOpContour* fContour; | 392 SkOpContour* fContour; |
| 384 SkOpSegment* fNext; // forward-only linked list used by contour to walk the
segments | 393 SkOpSegment* fNext; // forward-only linked list used by contour to walk the
segments |
| 385 const SkOpSegment* fPrev; | 394 const SkOpSegment* fPrev; |
| 386 SkPoint* fPts; // pointer into array of points owned by edge builder that m
ay be tweaked | 395 SkPoint* fPts; // pointer into array of points owned by edge builder that m
ay be tweaked |
| 387 SkPathOpsBounds fBounds; // tight bounds | 396 SkPathOpsBounds fBounds; // tight bounds |
| 388 SkScalar fWeight; | 397 SkScalar fWeight; |
| 389 int fCount; // number of spans (one for a non-intersecting segment) | 398 int fCount; // number of spans (one for a non-intersecting segment) |
| 390 int fDoneCount; // number of processed spans (zero initially) | 399 int fDoneCount; // number of processed spans (zero initially) |
| 391 SkPath::Verb fVerb; | 400 SkPath::Verb fVerb; |
| 401 SkDCubic::CubicType fCubicType; |
| 392 bool fVisited; // used by missing coincidence check | 402 bool fVisited; // used by missing coincidence check |
| 393 SkDEBUGCODE(int fID); | 403 SkDEBUGCODE(int fID); |
| 394 }; | 404 }; |
| 395 | 405 |
| 396 #endif | 406 #endif |
| OLD | NEW |