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 23 matching lines...) Expand all Loading... |
34 bool* done, bool* sortable); | 34 bool* done, bool* sortable); |
35 SkOpAngle* activeAngleInner(SkOpSpanBase* start, SkOpSpanBase** startPtr, | 35 SkOpAngle* activeAngleInner(SkOpSpanBase* start, SkOpSpanBase** startPtr, |
36 SkOpSpanBase** endPtr, bool* done, bool*
sortable); | 36 SkOpSpanBase** endPtr, bool* done, bool*
sortable); |
37 SkOpAngle* activeAngleOther(SkOpSpanBase* start, SkOpSpanBase** startPtr, | 37 SkOpAngle* activeAngleOther(SkOpSpanBase* start, SkOpSpanBase** startPtr, |
38 SkOpSpanBase** endPtr, bool* done, bool*
sortable); | 38 SkOpSpanBase** endPtr, bool* done, bool*
sortable); |
39 bool activeOp(SkOpSpanBase* start, SkOpSpanBase* end, int xorMiMask, int xor
SuMask, | 39 bool activeOp(SkOpSpanBase* start, SkOpSpanBase* end, int xorMiMask, int xor
SuMask, |
40 SkPathOp op); | 40 SkPathOp op); |
41 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, |
42 int* sumMiWinding, int* sumSuWinding); | 42 int* sumMiWinding, int* sumSuWinding); |
43 | 43 |
44 SkPoint activeLeftTop(SkOpSpanBase** firstT); | 44 SkDPoint activeLeftTop(SkOpSpanBase** firstT); |
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); |
51 fBounds.setConicBounds(pts, weight); | 51 SkDCurve curve; |
| 52 curve.fConic.set(pts, weight); |
| 53 curve.setConicBounds(pts, weight, 0, 1, &fBounds); |
52 return this; | 54 return this; |
53 } | 55 } |
54 | 56 |
55 SkOpSegment* addCubic(SkPoint pts[4], SkOpContour* parent) { | 57 SkOpSegment* addCubic(SkPoint pts[4], SkOpContour* parent) { |
56 init(pts, 1, parent, SkPath::kCubic_Verb); | 58 init(pts, 1, parent, SkPath::kCubic_Verb); |
57 fBounds.setCubicBounds(pts, 1); | 59 SkDCurve curve; |
| 60 curve.fCubic.set(pts); |
| 61 curve.setCubicBounds(pts, 1, 0, 1, &fBounds); |
58 return this; | 62 return this; |
59 } | 63 } |
60 | 64 |
61 void addCurveTo(const SkOpSpanBase* start, const SkOpSpanBase* end, SkPathWr
iter* path, | 65 void addCurveTo(const SkOpSpanBase* start, const SkOpSpanBase* end, SkPathWr
iter* path, |
62 bool active) const; | 66 bool active) const; |
63 | 67 |
64 SkOpAngle* addEndSpan(SkChunkAlloc* allocator) { | 68 SkOpAngle* addEndSpan(SkChunkAlloc* allocator) { |
65 SkOpAngle* angle = SkOpTAllocator<SkOpAngle>::Allocate(allocator); | 69 SkOpAngle* angle = SkOpTAllocator<SkOpAngle>::Allocate(allocator); |
66 angle->set(&fTail, fTail.prev()); | 70 angle->set(&fTail, fTail.prev()); |
67 fTail.setFromAngle(angle); | 71 fTail.setFromAngle(angle); |
(...skipping 13 matching lines...) Expand all Loading... |
81 | 85 |
82 SkOpAngle* addStartSpan(SkChunkAlloc* allocator) { | 86 SkOpAngle* addStartSpan(SkChunkAlloc* allocator) { |
83 SkOpAngle* angle = SkOpTAllocator<SkOpAngle>::Allocate(allocator); | 87 SkOpAngle* angle = SkOpTAllocator<SkOpAngle>::Allocate(allocator); |
84 angle->set(&fHead, fHead.next()); | 88 angle->set(&fHead, fHead.next()); |
85 fHead.setToAngle(angle); | 89 fHead.setToAngle(angle); |
86 return angle; | 90 return angle; |
87 } | 91 } |
88 | 92 |
89 SkOpSegment* addQuad(SkPoint pts[3], SkOpContour* parent) { | 93 SkOpSegment* addQuad(SkPoint pts[3], SkOpContour* parent) { |
90 init(pts, 1, parent, SkPath::kQuad_Verb); | 94 init(pts, 1, parent, SkPath::kQuad_Verb); |
91 fBounds.setQuadBounds(pts, 1); | 95 SkDCurve curve; |
| 96 curve.fQuad.set(pts); |
| 97 curve.setQuadBounds(pts, 1, 0, 1, &fBounds); |
92 return this; | 98 return this; |
93 } | 99 } |
94 | 100 |
95 SkOpPtT* addT(double t, AllowAlias , SkChunkAlloc* ); | 101 SkOpPtT* addT(double t, AllowAlias , SkChunkAlloc* ); |
96 | 102 |
97 void align(); | 103 void align(); |
98 static bool BetweenTs(const SkOpSpanBase* lesser, double testT, const SkOpSp
anBase* greater); | 104 static bool BetweenTs(const SkOpSpanBase* lesser, double testT, const SkOpSp
anBase* greater); |
99 | 105 |
100 const SkPathOpsBounds& bounds() const { | 106 const SkPathOpsBounds& bounds() const { |
101 return fBounds; | 107 return fBounds; |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 } | 361 } |
356 | 362 |
357 SkOpSpanBase* tail() { | 363 SkOpSpanBase* tail() { |
358 return &fTail; | 364 return &fTail; |
359 } | 365 } |
360 | 366 |
361 static double TAtMid(const SkOpSpanBase* start, const SkOpSpanBase* end, dou
ble mid) { | 367 static double TAtMid(const SkOpSpanBase* start, const SkOpSpanBase* end, dou
ble mid) { |
362 return start->t() * (1 - mid) + end->t() * mid; | 368 return start->t() * (1 - mid) + end->t() * mid; |
363 } | 369 } |
364 | 370 |
| 371 SkDPoint top(const SkOpSpanBase* start, const SkOpSpanBase* end, double* top
T) const; |
| 372 |
365 void undoneSpan(SkOpSpanBase** start, SkOpSpanBase** end); | 373 void undoneSpan(SkOpSpanBase** start, SkOpSpanBase** end); |
366 int updateOppWinding(const SkOpSpanBase* start, const SkOpSpanBase* end) con
st; | 374 int updateOppWinding(const SkOpSpanBase* start, const SkOpSpanBase* end) con
st; |
367 int updateOppWinding(const SkOpAngle* angle) const; | 375 int updateOppWinding(const SkOpAngle* angle) const; |
368 int updateOppWindingReverse(const SkOpAngle* angle) const; | 376 int updateOppWindingReverse(const SkOpAngle* angle) const; |
369 int updateWinding(const SkOpSpanBase* start, const SkOpSpanBase* end) const; | 377 int updateWinding(const SkOpSpanBase* start, const SkOpSpanBase* end) const; |
370 int updateWinding(const SkOpAngle* angle) const; | 378 int updateWinding(const SkOpAngle* angle) const; |
371 int updateWindingReverse(const SkOpAngle* angle) const; | 379 int updateWindingReverse(const SkOpAngle* angle) const; |
372 | 380 |
373 static bool UseInnerWinding(int outerWinding, int innerWinding); | 381 static bool UseInnerWinding(int outerWinding, int innerWinding); |
374 | 382 |
(...skipping 23 matching lines...) Expand all Loading... |
398 SkScalar fWeight; | 406 SkScalar fWeight; |
399 int fCount; // number of spans (one for a non-intersecting segment) | 407 int fCount; // number of spans (one for a non-intersecting segment) |
400 int fDoneCount; // number of processed spans (zero initially) | 408 int fDoneCount; // number of processed spans (zero initially) |
401 SkPath::Verb fVerb; | 409 SkPath::Verb fVerb; |
402 SkDCubic::CubicType fCubicType; | 410 SkDCubic::CubicType fCubicType; |
403 bool fVisited; // used by missing coincidence check | 411 bool fVisited; // used by missing coincidence check |
404 SkDEBUGCODE(int fID); | 412 SkDEBUGCODE(int fID); |
405 }; | 413 }; |
406 | 414 |
407 #endif | 415 #endif |
OLD | NEW |