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 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1123 SkOpSpanBase* foundSpan; | 1123 SkOpSpanBase* foundSpan; |
1124 SkOpSpanBase* otherEnd; | 1124 SkOpSpanBase* otherEnd; |
1125 SkOpSegment* other; | 1125 SkOpSegment* other; |
1126 if (angle == nullptr) { | 1126 if (angle == nullptr) { |
1127 if (endSpan->t() != 0 && endSpan->t() != 1) { | 1127 if (endSpan->t() != 0 && endSpan->t() != 1) { |
1128 return nullptr; | 1128 return nullptr; |
1129 } | 1129 } |
1130 SkOpPtT* otherPtT = endSpan->ptT()->next(); | 1130 SkOpPtT* otherPtT = endSpan->ptT()->next(); |
1131 other = otherPtT->segment(); | 1131 other = otherPtT->segment(); |
1132 foundSpan = otherPtT->span(); | 1132 foundSpan = otherPtT->span(); |
1133 otherEnd = step > 0 ? foundSpan->upCast()->next() : foundSpan->prev(); | 1133 otherEnd = step > 0 |
1134 ? foundSpan->upCastable() ? foundSpan->upCast()->next() : nullpt r | |
mmoroz
2016/06/29 14:52:35
Not sure if it is a good idea to use a nested tern
| |
1135 : foundSpan->prev(); | |
1134 } else { | 1136 } else { |
1135 int loopCount = angle->loopCount(); | 1137 int loopCount = angle->loopCount(); |
1136 if (loopCount > 2) { | 1138 if (loopCount > 2) { |
1137 return set_last(last, endSpan); | 1139 return set_last(last, endSpan); |
1138 } | 1140 } |
1139 const SkOpAngle* next = angle->next(); | 1141 const SkOpAngle* next = angle->next(); |
1140 if (nullptr == next) { | 1142 if (nullptr == next) { |
1141 return nullptr; | 1143 return nullptr; |
1142 } | 1144 } |
1143 #if DEBUG_WINDING | 1145 #if DEBUG_WINDING |
1144 if (angle->debugSign() != next->debugSign() && !angle->segment()->contou r()->isXor() | 1146 if (angle->debugSign() != next->debugSign() && !angle->segment()->contou r()->isXor() |
1145 && !next->segment()->contour()->isXor()) { | 1147 && !next->segment()->contour()->isXor()) { |
1146 SkDebugf("%s mismatched signs\n", __FUNCTION__); | 1148 SkDebugf("%s mismatched signs\n", __FUNCTION__); |
1147 } | 1149 } |
1148 #endif | 1150 #endif |
1149 other = next->segment(); | 1151 other = next->segment(); |
1150 foundSpan = endSpan = next->start(); | 1152 foundSpan = endSpan = next->start(); |
1151 otherEnd = next->end(); | 1153 otherEnd = next->end(); |
1152 } | 1154 } |
1155 if (!otherEnd) { | |
1156 return nullptr; | |
1157 } | |
1153 int foundStep = foundSpan->step(otherEnd); | 1158 int foundStep = foundSpan->step(otherEnd); |
1154 if (*stepPtr != foundStep) { | 1159 if (*stepPtr != foundStep) { |
1155 return set_last(last, endSpan); | 1160 return set_last(last, endSpan); |
1156 } | 1161 } |
1157 SkASSERT(*startPtr); | 1162 SkASSERT(*startPtr); |
1158 if (!otherEnd) { | 1163 if (!otherEnd) { |
1159 return nullptr; | 1164 return nullptr; |
1160 } | 1165 } |
1161 // SkASSERT(otherEnd >= 0); | 1166 // SkASSERT(otherEnd >= 0); |
1162 SkOpSpan* origMin = step < 0 ? origStart->prev() : origStart->upCast(); | 1167 SkOpSpan* origMin = step < 0 ? origStart->prev() : origStart->upCast(); |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1778 int absOut = SkTAbs(outerWinding); | 1783 int absOut = SkTAbs(outerWinding); |
1779 int absIn = SkTAbs(innerWinding); | 1784 int absIn = SkTAbs(innerWinding); |
1780 bool result = absOut == absIn ? outerWinding < 0 : absOut < absIn; | 1785 bool result = absOut == absIn ? outerWinding < 0 : absOut < absIn; |
1781 return result; | 1786 return result; |
1782 } | 1787 } |
1783 | 1788 |
1784 int SkOpSegment::windSum(const SkOpAngle* angle) const { | 1789 int SkOpSegment::windSum(const SkOpAngle* angle) const { |
1785 const SkOpSpan* minSpan = angle->start()->starter(angle->end()); | 1790 const SkOpSpan* minSpan = angle->start()->starter(angle->end()); |
1786 return minSpan->windSum(); | 1791 return minSpan->windSum(); |
1787 } | 1792 } |
OLD | NEW |