OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 SkOpContour_DEFINED | 7 #ifndef SkOpContour_DEFINED |
8 #define SkOpContour_DEFINED | 8 #define SkOpContour_DEFINED |
9 | 9 |
10 #include "SkOpSegment.h" | 10 #include "SkOpSegment.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 void checkDuplicates() { | 120 void checkDuplicates() { |
121 int segmentCount = fSegments.count(); | 121 int segmentCount = fSegments.count(); |
122 for (int sIndex = 0; sIndex < segmentCount; ++sIndex) { | 122 for (int sIndex = 0; sIndex < segmentCount; ++sIndex) { |
123 SkOpSegment& segment = fSegments[sIndex]; | 123 SkOpSegment& segment = fSegments[sIndex]; |
124 if (segment.count() > 2) { | 124 if (segment.count() > 2) { |
125 segment.checkDuplicates(); | 125 segment.checkDuplicates(); |
126 } | 126 } |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 bool checkEnds() { | 130 void checkEnds() { |
131 if (!fContainsCurves) { | 131 if (!fContainsCurves) { |
132 return true; | 132 return; |
133 } | 133 } |
134 int segmentCount = fSegments.count(); | 134 int segmentCount = fSegments.count(); |
135 for (int sIndex = 0; sIndex < segmentCount; ++sIndex) { | 135 for (int sIndex = 0; sIndex < segmentCount; ++sIndex) { |
136 SkOpSegment* segment = &fSegments[sIndex]; | 136 SkOpSegment* segment = &fSegments[sIndex]; |
137 if (segment->verb() == SkPath::kLine_Verb) { | 137 if (segment->verb() == SkPath::kLine_Verb) { |
138 continue; | 138 continue; |
139 } | 139 } |
140 if (segment->done()) { | 140 if (segment->done()) { |
141 continue; // likely coincident, nothing to do | 141 continue; // likely coincident, nothing to do |
142 } | 142 } |
143 if (!segment->checkEnds()) { | 143 segment->checkEnds(); |
144 return false; | |
145 } | |
146 } | 144 } |
147 return true; | |
148 } | 145 } |
149 | 146 |
150 void checkMultiples() { | 147 void checkMultiples() { |
151 int segmentCount = fSegments.count(); | 148 int segmentCount = fSegments.count(); |
152 for (int sIndex = 0; sIndex < segmentCount; ++sIndex) { | 149 for (int sIndex = 0; sIndex < segmentCount; ++sIndex) { |
153 SkOpSegment& segment = fSegments[sIndex]; | 150 SkOpSegment& segment = fSegments[sIndex]; |
154 if (segment.count() > 2) { | 151 if (segment.count() > 2) { |
155 segment.checkMultiples(); | 152 segment.checkMultiples(); |
156 fMultiples |= segment.hasMultiples(); | 153 fMultiples |= segment.hasMultiples(); |
157 } | 154 } |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 bool fOppXor; | 348 bool fOppXor; |
352 #if defined(SK_DEBUG) || !FORCE_RELEASE | 349 #if defined(SK_DEBUG) || !FORCE_RELEASE |
353 int debugID() const { return fID; } | 350 int debugID() const { return fID; } |
354 int fID; | 351 int fID; |
355 #else | 352 #else |
356 int debugID() const { return -1; } | 353 int debugID() const { return -1; } |
357 #endif | 354 #endif |
358 }; | 355 }; |
359 | 356 |
360 #endif | 357 #endif |
OLD | NEW |