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 void checkEnds() { | 130 bool checkEnds() { |
131 if (!fContainsCurves) { | 131 if (!fContainsCurves) { |
132 return; | 132 return true; |
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 segment->checkEnds(); | 143 if (!segment->checkEnds()) { |
| 144 return false; |
| 145 } |
144 } | 146 } |
| 147 return true; |
145 } | 148 } |
146 | 149 |
147 void checkMultiples() { | 150 void checkMultiples() { |
148 int segmentCount = fSegments.count(); | 151 int segmentCount = fSegments.count(); |
149 for (int sIndex = 0; sIndex < segmentCount; ++sIndex) { | 152 for (int sIndex = 0; sIndex < segmentCount; ++sIndex) { |
150 SkOpSegment& segment = fSegments[sIndex]; | 153 SkOpSegment& segment = fSegments[sIndex]; |
151 if (segment.count() > 2) { | 154 if (segment.count() > 2) { |
152 segment.checkMultiples(); | 155 segment.checkMultiples(); |
153 fMultiples |= segment.hasMultiples(); | 156 fMultiples |= segment.hasMultiples(); |
154 } | 157 } |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 bool fOppXor; | 351 bool fOppXor; |
349 #if defined(SK_DEBUG) || !FORCE_RELEASE | 352 #if defined(SK_DEBUG) || !FORCE_RELEASE |
350 int debugID() const { return fID; } | 353 int debugID() const { return fID; } |
351 int fID; | 354 int fID; |
352 #else | 355 #else |
353 int debugID() const { return -1; } | 356 int debugID() const { return -1; } |
354 #endif | 357 #endif |
355 }; | 358 }; |
356 | 359 |
357 #endif | 360 #endif |
OLD | NEW |