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 #include "SkOpContour.h" | 7 #include "SkOpContour.h" |
8 #include "SkOpSegment.h" | 8 #include "SkOpSegment.h" |
9 #include "SkPath.h" | 9 #include "SkPath.h" |
10 | 10 |
11 #ifdef SK_DEBUG | 11 #ifdef SK_DEBUG |
12 #include "SkPathOpsPoint.h" | 12 #include "SkPathOpsPoint.h" |
13 #endif | 13 #endif |
14 | 14 |
15 class SkIntersectionHelper { | 15 class SkIntersectionHelper { |
16 public: | 16 public: |
17 enum SegmentType { | 17 enum SegmentType { |
18 kHorizontalLine_Segment = -1, | 18 kHorizontalLine_Segment = -1, |
19 kVerticalLine_Segment = 0, | 19 kVerticalLine_Segment = 0, |
20 kLine_Segment = SkPath::kLine_Verb, | 20 kLine_Segment = SkPath::kLine_Verb, |
21 kQuad_Segment = SkPath::kQuad_Verb, | 21 kQuad_Segment = SkPath::kQuad_Verb, |
| 22 kConic_Segment = SkPath::kConic_Verb, |
22 kCubic_Segment = SkPath::kCubic_Verb, | 23 kCubic_Segment = SkPath::kCubic_Verb, |
23 }; | 24 }; |
24 | 25 |
25 bool advance() { | 26 bool advance() { |
26 fSegment = fSegment->next(); | 27 fSegment = fSegment->next(); |
27 return fSegment != NULL; | 28 return fSegment != NULL; |
28 } | 29 } |
29 | 30 |
30 SkScalar bottom() const { | 31 SkScalar bottom() const { |
31 return bounds().fBottom; | 32 return bounds().fBottom; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 76 |
76 bool startAfter(const SkIntersectionHelper& after) { | 77 bool startAfter(const SkIntersectionHelper& after) { |
77 fSegment = after.fSegment->next(); | 78 fSegment = after.fSegment->next(); |
78 return fSegment != NULL; | 79 return fSegment != NULL; |
79 } | 80 } |
80 | 81 |
81 SkScalar top() const { | 82 SkScalar top() const { |
82 return bounds().fTop; | 83 return bounds().fTop; |
83 } | 84 } |
84 | 85 |
| 86 SkScalar weight() const { |
| 87 return fSegment->weight(); |
| 88 } |
| 89 |
85 SkScalar x() const { | 90 SkScalar x() const { |
86 return bounds().fLeft; | 91 return bounds().fLeft; |
87 } | 92 } |
88 | 93 |
89 bool xFlipped() const { | 94 bool xFlipped() const { |
90 return x() != pts()[0].fX; | 95 return x() != pts()[0].fX; |
91 } | 96 } |
92 | 97 |
93 SkScalar y() const { | 98 SkScalar y() const { |
94 return bounds().fTop; | 99 return bounds().fTop; |
95 } | 100 } |
96 | 101 |
97 bool yFlipped() const { | 102 bool yFlipped() const { |
98 return y() != pts()[0].fY; | 103 return y() != pts()[0].fY; |
99 } | 104 } |
100 | 105 |
101 private: | 106 private: |
102 SkOpSegment* fSegment; | 107 SkOpSegment* fSegment; |
103 }; | 108 }; |
OLD | NEW |