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 kConic_Segment = SkPath::kConic_Verb, |
23 kCubic_Segment = SkPath::kCubic_Verb, | 23 kCubic_Segment = SkPath::kCubic_Verb, |
24 }; | 24 }; |
25 | 25 |
26 bool advance() { | 26 bool advance() { |
27 fSegment = fSegment->next(); | 27 fSegment = fSegment->next(); |
28 return fSegment != NULL; | 28 return fSegment != nullptr; |
29 } | 29 } |
30 | 30 |
31 SkScalar bottom() const { | 31 SkScalar bottom() const { |
32 return bounds().fBottom; | 32 return bounds().fBottom; |
33 } | 33 } |
34 | 34 |
35 const SkPathOpsBounds& bounds() const { | 35 const SkPathOpsBounds& bounds() const { |
36 return fSegment->bounds(); | 36 return fSegment->bounds(); |
37 } | 37 } |
38 | 38 |
(...skipping 30 matching lines...) Expand all Loading... |
69 return kHorizontalLine_Segment; | 69 return kHorizontalLine_Segment; |
70 } | 70 } |
71 if (fSegment->isVertical()) { | 71 if (fSegment->isVertical()) { |
72 return kVerticalLine_Segment; | 72 return kVerticalLine_Segment; |
73 } | 73 } |
74 return kLine_Segment; | 74 return kLine_Segment; |
75 } | 75 } |
76 | 76 |
77 bool startAfter(const SkIntersectionHelper& after) { | 77 bool startAfter(const SkIntersectionHelper& after) { |
78 fSegment = after.fSegment->next(); | 78 fSegment = after.fSegment->next(); |
79 return fSegment != NULL; | 79 return fSegment != nullptr; |
80 } | 80 } |
81 | 81 |
82 SkScalar top() const { | 82 SkScalar top() const { |
83 return bounds().fTop; | 83 return bounds().fTop; |
84 } | 84 } |
85 | 85 |
86 SkScalar weight() const { | 86 SkScalar weight() const { |
87 return fSegment->weight(); | 87 return fSegment->weight(); |
88 } | 88 } |
89 | 89 |
90 SkScalar x() const { | 90 SkScalar x() const { |
91 return bounds().fLeft; | 91 return bounds().fLeft; |
92 } | 92 } |
93 | 93 |
94 bool xFlipped() const { | 94 bool xFlipped() const { |
95 return x() != pts()[0].fX; | 95 return x() != pts()[0].fX; |
96 } | 96 } |
97 | 97 |
98 SkScalar y() const { | 98 SkScalar y() const { |
99 return bounds().fTop; | 99 return bounds().fTop; |
100 } | 100 } |
101 | 101 |
102 bool yFlipped() const { | 102 bool yFlipped() const { |
103 return y() != pts()[0].fY; | 103 return y() != pts()[0].fY; |
104 } | 104 } |
105 | 105 |
106 private: | 106 private: |
107 SkOpSegment* fSegment; | 107 SkOpSegment* fSegment; |
108 }; | 108 }; |
OLD | NEW |