| 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 #include "SkIntersections.h" | 7 #include "SkIntersections.h" |
| 8 #include "SkOpContour.h" | 8 #include "SkOpContour.h" |
| 9 #include "SkPathWriter.h" | 9 #include "SkPathWriter.h" |
| 10 #include "SkTSort.h" | 10 #include "SkTSort.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 coincidence.fSegments[1] = otherIndex; | 141 coincidence.fSegments[1] = otherIndex; |
| 142 coincidence.fTs[swap][0] = ts[0][ptIndex]; | 142 coincidence.fTs[swap][0] = ts[0][ptIndex]; |
| 143 coincidence.fTs[swap][1] = ts[0][ptIndex + 1]; | 143 coincidence.fTs[swap][1] = ts[0][ptIndex + 1]; |
| 144 coincidence.fTs[!swap][0] = ts[1][ptIndex]; | 144 coincidence.fTs[!swap][0] = ts[1][ptIndex]; |
| 145 coincidence.fTs[!swap][1] = ts[1][ptIndex + 1]; | 145 coincidence.fTs[!swap][1] = ts[1][ptIndex + 1]; |
| 146 coincidence.fPts[0] = pt0; | 146 coincidence.fPts[0] = pt0; |
| 147 coincidence.fPts[1] = pt1; | 147 coincidence.fPts[1] = pt1; |
| 148 return true; | 148 return true; |
| 149 } | 149 } |
| 150 | 150 |
| 151 bool SkOpContour::calcAngles() { |
| 152 int segmentCount = fSegments.count(); |
| 153 for (int test = 0; test < segmentCount; ++test) { |
| 154 if (!fSegments[test].calcAngles()) { |
| 155 return false; |
| 156 } |
| 157 } |
| 158 return true; |
| 159 } |
| 160 |
| 151 void SkOpContour::calcCoincidentWinding() { | 161 void SkOpContour::calcCoincidentWinding() { |
| 152 int count = fCoincidences.count(); | 162 int count = fCoincidences.count(); |
| 153 #if DEBUG_CONCIDENT | 163 #if DEBUG_CONCIDENT |
| 154 if (count > 0) { | 164 if (count > 0) { |
| 155 SkDebugf("%s count=%d\n", __FUNCTION__, count); | 165 SkDebugf("%s count=%d\n", __FUNCTION__, count); |
| 156 } | 166 } |
| 157 #endif | 167 #endif |
| 158 for (int index = 0; index < count; ++index) { | 168 for (int index = 0; index < count; ++index) { |
| 159 SkCoincidence& coincidence = fCoincidences[index]; | 169 SkCoincidence& coincidence = fCoincidences[index]; |
| 160 calcCommonCoincidentWinding(coincidence); | 170 calcCommonCoincidentWinding(coincidence); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 thisOne.addTCancel(*startPt, *endPt, &other); | 280 thisOne.addTCancel(*startPt, *endPt, &other); |
| 271 } else { | 281 } else { |
| 272 thisOne.addTCoincident(*startPt, *endPt, endT, &other); | 282 thisOne.addTCoincident(*startPt, *endPt, endT, &other); |
| 273 } | 283 } |
| 274 #if DEBUG_CONCIDENT | 284 #if DEBUG_CONCIDENT |
| 275 thisOne.debugShowTs("p"); | 285 thisOne.debugShowTs("p"); |
| 276 other.debugShowTs("o"); | 286 other.debugShowTs("o"); |
| 277 #endif | 287 #endif |
| 278 } | 288 } |
| 279 | 289 |
| 290 void SkOpContour::sortAngles() { |
| 291 int segmentCount = fSegments.count(); |
| 292 for (int test = 0; test < segmentCount; ++test) { |
| 293 fSegments[test].sortAngles(); |
| 294 } |
| 295 } |
| 296 |
| 280 void SkOpContour::sortSegments() { | 297 void SkOpContour::sortSegments() { |
| 281 int segmentCount = fSegments.count(); | 298 int segmentCount = fSegments.count(); |
| 282 fSortedSegments.push_back_n(segmentCount); | 299 fSortedSegments.push_back_n(segmentCount); |
| 283 for (int test = 0; test < segmentCount; ++test) { | 300 for (int test = 0; test < segmentCount; ++test) { |
| 284 fSortedSegments[test] = &fSegments[test]; | 301 fSortedSegments[test] = &fSegments[test]; |
| 285 } | 302 } |
| 286 SkTQSort<SkOpSegment>(fSortedSegments.begin(), fSortedSegments.end() - 1); | 303 SkTQSort<SkOpSegment>(fSortedSegments.begin(), fSortedSegments.end() - 1); |
| 287 fFirstSorted = 0; | 304 fFirstSorted = 0; |
| 288 } | 305 } |
| 289 | 306 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 SkDebugf("%s empty contour\n", __FUNCTION__); | 396 SkDebugf("%s empty contour\n", __FUNCTION__); |
| 380 SkASSERT(0); | 397 SkASSERT(0); |
| 381 // FIXME: delete empty contour? | 398 // FIXME: delete empty contour? |
| 382 return; | 399 return; |
| 383 } | 400 } |
| 384 fBounds = fSegments.front().bounds(); | 401 fBounds = fSegments.front().bounds(); |
| 385 for (int index = 1; index < count; ++index) { | 402 for (int index = 1; index < count; ++index) { |
| 386 fBounds.add(fSegments[index].bounds()); | 403 fBounds.add(fSegments[index].bounds()); |
| 387 } | 404 } |
| 388 } | 405 } |
| OLD | NEW |