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 "SkOpCoincidence.h" | 7 #include "SkOpCoincidence.h" |
8 #include "SkOpContour.h" | 8 #include "SkOpContour.h" |
9 #include "SkOpSegment.h" | 9 #include "SkOpSegment.h" |
10 #include "SkPathWriter.h" | 10 #include "SkPathWriter.h" |
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 if (swapped) { | 1290 if (swapped) { |
1291 SkTSwap(priorPtT, ptT); | 1291 SkTSwap(priorPtT, ptT); |
1292 } | 1292 } |
1293 } | 1293 } |
1294 } while ((spanBase = spanBase->final() ? nullptr : spanBase->upCast()->next(
))); | 1294 } while ((spanBase = spanBase->final() ? nullptr : spanBase->upCast()->next(
))); |
1295 clear_visited(&fHead); | 1295 clear_visited(&fHead); |
1296 return false; | 1296 return false; |
1297 } | 1297 } |
1298 | 1298 |
1299 // if a span has more than one intersection, merge the other segments' span as n
eeded | 1299 // if a span has more than one intersection, merge the other segments' span as n
eeded |
1300 void SkOpSegment::moveMultiples() { | 1300 bool SkOpSegment::moveMultiples() { |
1301 debugValidate(); | 1301 debugValidate(); |
1302 SkOpSpanBase* test = &fHead; | 1302 SkOpSpanBase* test = &fHead; |
1303 do { | 1303 do { |
1304 int addCount = test->spanAddsCount(); | 1304 int addCount = test->spanAddsCount(); |
1305 SkASSERT(addCount >= 1); | 1305 if (addCount < 1) { |
| 1306 return false; |
| 1307 } |
1306 if (addCount == 1) { | 1308 if (addCount == 1) { |
1307 continue; | 1309 continue; |
1308 } | 1310 } |
1309 SkOpPtT* startPtT = test->ptT(); | 1311 SkOpPtT* startPtT = test->ptT(); |
1310 SkOpPtT* testPtT = startPtT; | 1312 SkOpPtT* testPtT = startPtT; |
1311 do { // iterate through all spans associated with start | 1313 do { // iterate through all spans associated with start |
1312 SkOpSpanBase* oppSpan = testPtT->span(); | 1314 SkOpSpanBase* oppSpan = testPtT->span(); |
1313 if (oppSpan->spanAddsCount() == addCount) { | 1315 if (oppSpan->spanAddsCount() == addCount) { |
1314 continue; | 1316 continue; |
1315 } | 1317 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1386 goto checkNextSpan; | 1388 goto checkNextSpan; |
1387 } | 1389 } |
1388 tryNextSpan: | 1390 tryNextSpan: |
1389 ; | 1391 ; |
1390 } while (oppTest != oppLast && (oppTest = oppTest->upCast()->next())
); | 1392 } while (oppTest != oppLast && (oppTest = oppTest->upCast()->next())
); |
1391 } while ((testPtT = testPtT->next()) != startPtT); | 1393 } while ((testPtT = testPtT->next()) != startPtT); |
1392 checkNextSpan: | 1394 checkNextSpan: |
1393 ; | 1395 ; |
1394 } while ((test = test->final() ? nullptr : test->upCast()->next())); | 1396 } while ((test = test->final() ? nullptr : test->upCast()->next())); |
1395 debugValidate(); | 1397 debugValidate(); |
| 1398 return true; |
1396 } | 1399 } |
1397 | 1400 |
1398 // Move nearby t values and pts so they all hang off the same span. Alignment ha
ppens later. | 1401 // Move nearby t values and pts so they all hang off the same span. Alignment ha
ppens later. |
1399 void SkOpSegment::moveNearby() { | 1402 void SkOpSegment::moveNearby() { |
1400 debugValidate(); | 1403 debugValidate(); |
1401 SkOpSpanBase* spanS = &fHead; | 1404 SkOpSpanBase* spanS = &fHead; |
1402 do { | 1405 do { |
1403 SkOpSpanBase* test = spanS->upCast()->next(); | 1406 SkOpSpanBase* test = spanS->upCast()->next(); |
1404 SkOpSpanBase* next; | 1407 SkOpSpanBase* next; |
1405 if (spanS->contains(test)) { | 1408 if (spanS->contains(test)) { |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1775 int absOut = SkTAbs(outerWinding); | 1778 int absOut = SkTAbs(outerWinding); |
1776 int absIn = SkTAbs(innerWinding); | 1779 int absIn = SkTAbs(innerWinding); |
1777 bool result = absOut == absIn ? outerWinding < 0 : absOut < absIn; | 1780 bool result = absOut == absIn ? outerWinding < 0 : absOut < absIn; |
1778 return result; | 1781 return result; |
1779 } | 1782 } |
1780 | 1783 |
1781 int SkOpSegment::windSum(const SkOpAngle* angle) const { | 1784 int SkOpSegment::windSum(const SkOpAngle* angle) const { |
1782 const SkOpSpan* minSpan = angle->start()->starter(angle->end()); | 1785 const SkOpSpan* minSpan = angle->start()->starter(angle->end()); |
1783 return minSpan->windSum(); | 1786 return minSpan->windSum(); |
1784 } | 1787 } |
OLD | NEW |