| 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 "SkIntersections.h" | 7 #include "SkIntersections.h" |
| 8 #include "SkOpSegment.h" | 8 #include "SkOpSegment.h" |
| 9 #include "SkPathWriter.h" | 9 #include "SkPathWriter.h" |
| 10 #include "SkTSort.h" | 10 #include "SkTSort.h" |
| (...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 int SkOpSegment::computeSum(int startIndex, int endIndex, bool binary) { | 854 int SkOpSegment::computeSum(int startIndex, int endIndex, bool binary) { |
| 855 SkSTArray<SkOpAngle::kStackBasedCount, SkOpAngle, true> angles; | 855 SkSTArray<SkOpAngle::kStackBasedCount, SkOpAngle, true> angles; |
| 856 addTwoAngles(startIndex, endIndex, &angles); | 856 addTwoAngles(startIndex, endIndex, &angles); |
| 857 buildAngles(endIndex, &angles, false); | 857 buildAngles(endIndex, &angles, false); |
| 858 // OPTIMIZATION: check all angles to see if any have computed wind sum | 858 // OPTIMIZATION: check all angles to see if any have computed wind sum |
| 859 // before sorting (early exit if none) | 859 // before sorting (early exit if none) |
| 860 SkSTArray<SkOpAngle::kStackBasedCount, SkOpAngle*, true> sorted; | 860 SkSTArray<SkOpAngle::kStackBasedCount, SkOpAngle*, true> sorted; |
| 861 // FIXME?: Not sure if this sort must be ordered or if the relaxed ordering
is OK ... | 861 // FIXME?: Not sure if this sort must be ordered or if the relaxed ordering
is OK ... |
| 862 bool sortable = SortAngles(angles, &sorted, SkOpSegment::kMustBeOrdered_Sort
AngleKind); | 862 bool sortable = SortAngles(angles, &sorted, SkOpSegment::kMustBeOrdered_Sort
AngleKind); |
| 863 #if DEBUG_SORT | 863 #if DEBUG_SORT |
| 864 sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0, 0); | 864 sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0, 0, sortable)
; |
| 865 #endif | 865 #endif |
| 866 if (!sortable) { | 866 if (!sortable) { |
| 867 return SK_MinS32; | 867 return SK_MinS32; |
| 868 } | 868 } |
| 869 int angleCount = angles.count(); | 869 int angleCount = angles.count(); |
| 870 const SkOpAngle* angle; | 870 const SkOpAngle* angle; |
| 871 const SkOpSegment* base; | 871 const SkOpSegment* base; |
| 872 int winding; | 872 int winding; |
| 873 int oWinding; | 873 int oWinding; |
| 874 int firstIndex = 0; | 874 int firstIndex = 0; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 889 bool inner = UseInnerWinding(winding + spanWinding, winding); | 889 bool inner = UseInnerWinding(winding + spanWinding, winding); |
| 890 #if DEBUG_WINDING | 890 #if DEBUG_WINDING |
| 891 SkDebugf("%s spanWinding=%d winding=%d sign=%d inner=%d result=%d\n", __FUNC
TION__, | 891 SkDebugf("%s spanWinding=%d winding=%d sign=%d inner=%d result=%d\n", __FUNC
TION__, |
| 892 spanWinding, winding, angle->sign(), inner, | 892 spanWinding, winding, angle->sign(), inner, |
| 893 inner ? winding + spanWinding : winding); | 893 inner ? winding + spanWinding : winding); |
| 894 #endif | 894 #endif |
| 895 if (inner) { | 895 if (inner) { |
| 896 winding += spanWinding; | 896 winding += spanWinding; |
| 897 } | 897 } |
| 898 #if DEBUG_SORT | 898 #if DEBUG_SORT |
| 899 base->debugShowSort(__FUNCTION__, sorted, firstIndex, winding, oWinding); | 899 base->debugShowSort(__FUNCTION__, sorted, firstIndex, winding, oWinding, sor
table); |
| 900 #endif | 900 #endif |
| 901 int nextIndex = firstIndex + 1; | 901 int nextIndex = firstIndex + 1; |
| 902 int lastIndex = firstIndex != 0 ? firstIndex : angleCount; | 902 int lastIndex = firstIndex != 0 ? firstIndex : angleCount; |
| 903 winding -= base->spanSign(angle); | 903 winding -= base->spanSign(angle); |
| 904 oWinding -= base->oppSign(angle); | 904 oWinding -= base->oppSign(angle); |
| 905 do { | 905 do { |
| 906 if (nextIndex == angleCount) { | 906 if (nextIndex == angleCount) { |
| 907 nextIndex = 0; | 907 nextIndex = 0; |
| 908 } | 908 } |
| 909 angle = sorted[nextIndex]; | 909 angle = sorted[nextIndex]; |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 other = endSpan->fOther; | 1127 other = endSpan->fOther; |
| 1128 *nextStart = endSpan->fOtherIndex; | 1128 *nextStart = endSpan->fOtherIndex; |
| 1129 double startT = other->fTs[*nextStart].fT; | 1129 double startT = other->fTs[*nextStart].fT; |
| 1130 *nextEnd = *nextStart; | 1130 *nextEnd = *nextStart; |
| 1131 do { | 1131 do { |
| 1132 *nextEnd += step; | 1132 *nextEnd += step; |
| 1133 } | 1133 } |
| 1134 while (precisely_zero(startT - other->fTs[*nextEnd].fT)); | 1134 while (precisely_zero(startT - other->fTs[*nextEnd].fT)); |
| 1135 SkASSERT(step < 0 ? *nextEnd >= 0 : *nextEnd < other->fTs.count()); | 1135 SkASSERT(step < 0 ? *nextEnd >= 0 : *nextEnd < other->fTs.count()); |
| 1136 if (other->isTiny(SkMin32(*nextStart, *nextEnd))) { | 1136 if (other->isTiny(SkMin32(*nextStart, *nextEnd))) { |
| 1137 *unsortable = true; |
| 1137 return NULL; | 1138 return NULL; |
| 1138 } | 1139 } |
| 1139 return other; | 1140 return other; |
| 1140 } | 1141 } |
| 1141 // more than one viable candidate -- measure angles to find best | 1142 // more than one viable candidate -- measure angles to find best |
| 1142 SkSTArray<SkOpAngle::kStackBasedCount, SkOpAngle, true> angles; | 1143 SkSTArray<SkOpAngle::kStackBasedCount, SkOpAngle, true> angles; |
| 1143 SkASSERT(startIndex - endIndex != 0); | 1144 SkASSERT(startIndex - endIndex != 0); |
| 1144 SkASSERT((startIndex - endIndex < 0) ^ (step < 0)); | 1145 SkASSERT((startIndex - endIndex < 0) ^ (step < 0)); |
| 1145 addTwoAngles(startIndex, end, &angles); | 1146 addTwoAngles(startIndex, end, &angles); |
| 1146 buildAngles(end, &angles, true); | 1147 buildAngles(end, &angles, true); |
| 1147 SkSTArray<SkOpAngle::kStackBasedCount, SkOpAngle*, true> sorted; | 1148 SkSTArray<SkOpAngle::kStackBasedCount, SkOpAngle*, true> sorted; |
| 1148 bool sortable = SortAngles(angles, &sorted, SkOpSegment::kMustBeOrdered_Sort
AngleKind); | 1149 bool sortable = SortAngles(angles, &sorted, SkOpSegment::kMustBeOrdered_Sort
AngleKind); |
| 1149 int angleCount = angles.count(); | 1150 int angleCount = angles.count(); |
| 1150 int firstIndex = findStartingEdge(sorted, startIndex, end); | 1151 int firstIndex = findStartingEdge(sorted, startIndex, end); |
| 1151 SkASSERT(firstIndex >= 0); | 1152 SkASSERT(firstIndex >= 0); |
| 1152 #if DEBUG_SORT | 1153 #if DEBUG_SORT |
| 1153 debugShowSort(__FUNCTION__, sorted, firstIndex); | 1154 debugShowSort(__FUNCTION__, sorted, firstIndex, sortable); |
| 1154 #endif | 1155 #endif |
| 1155 if (!sortable) { | 1156 if (!sortable) { |
| 1156 *unsortable = true; | 1157 *unsortable = true; |
| 1157 return NULL; | 1158 return NULL; |
| 1158 } | 1159 } |
| 1159 SkASSERT(sorted[firstIndex]->segment() == this); | 1160 SkASSERT(sorted[firstIndex]->segment() == this); |
| 1160 #if DEBUG_WINDING | 1161 #if DEBUG_WINDING |
| 1161 SkDebugf("%s firstIndex=[%d] sign=%d\n", __FUNCTION__, firstIndex, | 1162 SkDebugf("%s firstIndex=[%d] sign=%d\n", __FUNCTION__, firstIndex, |
| 1162 sorted[firstIndex]->sign()); | 1163 sorted[firstIndex]->sign()); |
| 1163 #endif | 1164 #endif |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 SkASSERT(startIndex - endIndex != 0); | 1266 SkASSERT(startIndex - endIndex != 0); |
| 1266 SkASSERT((startIndex - endIndex < 0) ^ (step < 0)); | 1267 SkASSERT((startIndex - endIndex < 0) ^ (step < 0)); |
| 1267 addTwoAngles(startIndex, end, &angles); | 1268 addTwoAngles(startIndex, end, &angles); |
| 1268 buildAngles(end, &angles, true); | 1269 buildAngles(end, &angles, true); |
| 1269 SkSTArray<SkOpAngle::kStackBasedCount, SkOpAngle*, true> sorted; | 1270 SkSTArray<SkOpAngle::kStackBasedCount, SkOpAngle*, true> sorted; |
| 1270 bool sortable = SortAngles(angles, &sorted, SkOpSegment::kMustBeOrdered_Sort
AngleKind); | 1271 bool sortable = SortAngles(angles, &sorted, SkOpSegment::kMustBeOrdered_Sort
AngleKind); |
| 1271 int angleCount = angles.count(); | 1272 int angleCount = angles.count(); |
| 1272 int firstIndex = findStartingEdge(sorted, startIndex, end); | 1273 int firstIndex = findStartingEdge(sorted, startIndex, end); |
| 1273 SkASSERT(firstIndex >= 0); | 1274 SkASSERT(firstIndex >= 0); |
| 1274 #if DEBUG_SORT | 1275 #if DEBUG_SORT |
| 1275 debugShowSort(__FUNCTION__, sorted, firstIndex); | 1276 debugShowSort(__FUNCTION__, sorted, firstIndex, sortable); |
| 1276 #endif | 1277 #endif |
| 1277 if (!sortable) { | 1278 if (!sortable) { |
| 1278 *unsortable = true; | 1279 *unsortable = true; |
| 1279 return NULL; | 1280 return NULL; |
| 1280 } | 1281 } |
| 1281 SkASSERT(sorted[firstIndex]->segment() == this); | 1282 SkASSERT(sorted[firstIndex]->segment() == this); |
| 1282 #if DEBUG_WINDING | 1283 #if DEBUG_WINDING |
| 1283 SkDebugf("%s firstIndex=[%d] sign=%d\n", __FUNCTION__, firstIndex, | 1284 SkDebugf("%s firstIndex=[%d] sign=%d\n", __FUNCTION__, firstIndex, |
| 1284 sorted[firstIndex]->sign()); | 1285 sorted[firstIndex]->sign()); |
| 1285 #endif | 1286 #endif |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1393 SkSTArray<SkOpAngle::kStackBasedCount, SkOpAngle, true> angles; | 1394 SkSTArray<SkOpAngle::kStackBasedCount, SkOpAngle, true> angles; |
| 1394 SkASSERT(startIndex - endIndex != 0); | 1395 SkASSERT(startIndex - endIndex != 0); |
| 1395 SkASSERT((startIndex - endIndex < 0) ^ (step < 0)); | 1396 SkASSERT((startIndex - endIndex < 0) ^ (step < 0)); |
| 1396 addTwoAngles(startIndex, end, &angles); | 1397 addTwoAngles(startIndex, end, &angles); |
| 1397 buildAngles(end, &angles, false); | 1398 buildAngles(end, &angles, false); |
| 1398 SkSTArray<SkOpAngle::kStackBasedCount, SkOpAngle*, true> sorted; | 1399 SkSTArray<SkOpAngle::kStackBasedCount, SkOpAngle*, true> sorted; |
| 1399 bool sortable = SortAngles(angles, &sorted, SkOpSegment::kMustBeOrdered_Sort
AngleKind); | 1400 bool sortable = SortAngles(angles, &sorted, SkOpSegment::kMustBeOrdered_Sort
AngleKind); |
| 1400 if (!sortable) { | 1401 if (!sortable) { |
| 1401 *unsortable = true; | 1402 *unsortable = true; |
| 1402 #if DEBUG_SORT | 1403 #if DEBUG_SORT |
| 1403 debugShowSort(__FUNCTION__, sorted, findStartingEdge(sorted, startIndex,
end), 0, 0); | 1404 debugShowSort(__FUNCTION__, sorted, findStartingEdge(sorted, startIndex,
end), 0, 0, |
| 1405 sortable); |
| 1404 #endif | 1406 #endif |
| 1405 return NULL; | 1407 return NULL; |
| 1406 } | 1408 } |
| 1407 int angleCount = angles.count(); | 1409 int angleCount = angles.count(); |
| 1408 int firstIndex = findStartingEdge(sorted, startIndex, end); | 1410 int firstIndex = findStartingEdge(sorted, startIndex, end); |
| 1409 SkASSERT(firstIndex >= 0); | 1411 SkASSERT(firstIndex >= 0); |
| 1410 #if DEBUG_SORT | 1412 #if DEBUG_SORT |
| 1411 debugShowSort(__FUNCTION__, sorted, firstIndex, 0, 0); | 1413 debugShowSort(__FUNCTION__, sorted, firstIndex, 0, 0, sortable); |
| 1412 #endif | 1414 #endif |
| 1413 SkASSERT(sorted[firstIndex]->segment() == this); | 1415 SkASSERT(sorted[firstIndex]->segment() == this); |
| 1414 int nextIndex = firstIndex + 1; | 1416 int nextIndex = firstIndex + 1; |
| 1415 int lastIndex = firstIndex != 0 ? firstIndex : angleCount; | 1417 int lastIndex = firstIndex != 0 ? firstIndex : angleCount; |
| 1416 const SkOpAngle* foundAngle = NULL; | 1418 const SkOpAngle* foundAngle = NULL; |
| 1417 bool foundDone = false; | 1419 bool foundDone = false; |
| 1418 SkOpSegment* nextSegment; | 1420 SkOpSegment* nextSegment; |
| 1419 int activeCount = 0; | 1421 int activeCount = 0; |
| 1420 do { | 1422 do { |
| 1421 SkASSERT(nextIndex != firstIndex); | 1423 SkASSERT(nextIndex != firstIndex); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1647 SkOpSegment* next = angle->segment(); | 1649 SkOpSegment* next = angle->segment(); |
| 1648 SkPathOpsBounds bounds; | 1650 SkPathOpsBounds bounds; |
| 1649 next->subDivideBounds(angle->end(), angle->start(), &bounds); | 1651 next->subDivideBounds(angle->end(), angle->start(), &bounds); |
| 1650 if (approximately_greater(top, bounds.fTop)) { | 1652 if (approximately_greater(top, bounds.fTop)) { |
| 1651 top = bounds.fTop; | 1653 top = bounds.fTop; |
| 1652 first = index; | 1654 first = index; |
| 1653 } | 1655 } |
| 1654 } | 1656 } |
| 1655 SkASSERT(first < SK_MaxS32); | 1657 SkASSERT(first < SK_MaxS32); |
| 1656 #if DEBUG_SORT // || DEBUG_SWAP_TOP | 1658 #if DEBUG_SORT // || DEBUG_SWAP_TOP |
| 1657 sorted[first]->segment()->debugShowSort(__FUNCTION__, sorted, first, 0, 0); | 1659 sorted[first]->segment()->debugShowSort(__FUNCTION__, sorted, first, 0, 0, s
ortable); |
| 1658 #endif | 1660 #endif |
| 1659 if (onlySortable && !sortable) { | 1661 if (onlySortable && !sortable) { |
| 1660 *unsortable = true; | 1662 *unsortable = true; |
| 1661 return NULL; | 1663 return NULL; |
| 1662 } | 1664 } |
| 1663 // skip edges that have already been processed | 1665 // skip edges that have already been processed |
| 1664 firstT = first - 1; | 1666 firstT = first - 1; |
| 1665 SkOpSegment* leftSegment; | 1667 SkOpSegment* leftSegment; |
| 1666 do { | 1668 do { |
| 1667 if (++firstT == count) { | 1669 if (++firstT == count) { |
| (...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2558 *dx = (*CurveSlopeAtT[SkPathOpsVerbToPoints(fVerb)])(fPts, tHit).fX; | 2560 *dx = (*CurveSlopeAtT[SkPathOpsVerbToPoints(fVerb)])(fPts, tHit).fX; |
| 2559 if (fVerb > SkPath::kLine_Verb && approximately_zero(*dx)) { | 2561 if (fVerb > SkPath::kLine_Verb && approximately_zero(*dx)) { |
| 2560 *dx = fPts[2].fX - fPts[1].fX - *dx; | 2562 *dx = fPts[2].fX - fPts[1].fX - *dx; |
| 2561 } | 2563 } |
| 2562 if (*dx == 0) { | 2564 if (*dx == 0) { |
| 2563 #if DEBUG_WINDING_AT_T | 2565 #if DEBUG_WINDING_AT_T |
| 2564 SkDebugf(" dx=0 winding=SK_MinS32\n"); | 2566 SkDebugf(" dx=0 winding=SK_MinS32\n"); |
| 2565 #endif | 2567 #endif |
| 2566 return SK_MinS32; | 2568 return SK_MinS32; |
| 2567 } | 2569 } |
| 2570 if (windVal < 0) { // reverse sign if opp contour traveled in reverse |
| 2571 *dx = -*dx; |
| 2572 } |
| 2568 if (winding * *dx > 0) { // if same signs, result is negative | 2573 if (winding * *dx > 0) { // if same signs, result is negative |
| 2569 winding += *dx > 0 ? -windVal : windVal; | 2574 winding += *dx > 0 ? -windVal : windVal; |
| 2570 } | 2575 } |
| 2571 #if DEBUG_WINDING_AT_T | 2576 #if DEBUG_WINDING_AT_T |
| 2572 SkDebugf(" dx=%c winding=%d\n", *dx > 0 ? '+' : '-', winding); | 2577 SkDebugf(" dx=%c winding=%d\n", *dx > 0 ? '+' : '-', winding); |
| 2573 #endif | 2578 #endif |
| 2574 return winding; | 2579 return winding; |
| 2575 } | 2580 } |
| 2576 | 2581 |
| 2577 int SkOpSegment::windSum(const SkOpAngle* angle) const { | 2582 int SkOpSegment::windSum(const SkOpAngle* angle) const { |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2762 } else { | 2767 } else { |
| 2763 SkDebugf("%d", span.fWindSum); | 2768 SkDebugf("%d", span.fWindSum); |
| 2764 } | 2769 } |
| 2765 SkDebugf(" windValue=%d\n", span.fWindValue); | 2770 SkDebugf(" windValue=%d\n", span.fWindValue); |
| 2766 } | 2771 } |
| 2767 #endif | 2772 #endif |
| 2768 | 2773 |
| 2769 #if DEBUG_SORT || DEBUG_SWAP_TOP | 2774 #if DEBUG_SORT || DEBUG_SWAP_TOP |
| 2770 void SkOpSegment::debugShowSort(const char* fun, const SkTArray<SkOpAngle*, true
>& angles, | 2775 void SkOpSegment::debugShowSort(const char* fun, const SkTArray<SkOpAngle*, true
>& angles, |
| 2771 int first, const int contourWinding, | 2776 int first, const int contourWinding, |
| 2772 const int oppContourWinding) const { | 2777 const int oppContourWinding, bool sortable) cons
t { |
| 2773 if (--gDebugSortCount < 0) { | 2778 if (--gDebugSortCount < 0) { |
| 2774 return; | 2779 return; |
| 2775 } | 2780 } |
| 2776 SkASSERT(angles[first]->segment() == this); | 2781 SkASSERT(angles[first]->segment() == this); |
| 2777 SkASSERT(angles.count() > 1); | 2782 SkASSERT(!sortable || angles.count() > 1); |
| 2778 int lastSum = contourWinding; | 2783 int lastSum = contourWinding; |
| 2779 int oppLastSum = oppContourWinding; | 2784 int oppLastSum = oppContourWinding; |
| 2780 const SkOpAngle* firstAngle = angles[first]; | 2785 const SkOpAngle* firstAngle = angles[first]; |
| 2781 int windSum = lastSum - spanSign(firstAngle); | 2786 int windSum = lastSum - spanSign(firstAngle); |
| 2782 int oppoSign = oppSign(firstAngle); | 2787 int oppoSign = oppSign(firstAngle); |
| 2783 int oppWindSum = oppLastSum - oppoSign; | 2788 int oppWindSum = oppLastSum - oppoSign; |
| 2784 #define WIND_AS_STRING(x) char x##Str[12]; if (!valid_wind(x)) strcpy(x##Str
, "?"); \ | 2789 #define WIND_AS_STRING(x) char x##Str[12]; if (!valid_wind(x)) strcpy(x##Str
, "?"); \ |
| 2785 else SK_SNPRINTF(x##Str, sizeof(x##Str), "%d", x) | 2790 else SK_SNPRINTF(x##Str, sizeof(x##Str), "%d", x) |
| 2786 WIND_AS_STRING(contourWinding); | 2791 WIND_AS_STRING(contourWinding); |
| 2787 WIND_AS_STRING(oppContourWinding); | 2792 WIND_AS_STRING(oppContourWinding); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2871 if (index == angles.count()) { | 2876 if (index == angles.count()) { |
| 2872 index = 0; | 2877 index = 0; |
| 2873 } | 2878 } |
| 2874 if (firstTime) { | 2879 if (firstTime) { |
| 2875 firstTime = false; | 2880 firstTime = false; |
| 2876 } | 2881 } |
| 2877 } while (index != first); | 2882 } while (index != first); |
| 2878 } | 2883 } |
| 2879 | 2884 |
| 2880 void SkOpSegment::debugShowSort(const char* fun, const SkTArray<SkOpAngle*, true
>& angles, | 2885 void SkOpSegment::debugShowSort(const char* fun, const SkTArray<SkOpAngle*, true
>& angles, |
| 2881 int first) { | 2886 int first, bool sortable) { |
| 2882 const SkOpAngle* firstAngle = angles[first]; | 2887 const SkOpAngle* firstAngle = angles[first]; |
| 2883 const SkOpSegment* segment = firstAngle->segment(); | 2888 const SkOpSegment* segment = firstAngle->segment(); |
| 2884 int winding = segment->updateWinding(firstAngle); | 2889 int winding = segment->updateWinding(firstAngle); |
| 2885 int oppWinding = segment->updateOppWinding(firstAngle); | 2890 int oppWinding = segment->updateOppWinding(firstAngle); |
| 2886 debugShowSort(fun, angles, first, winding, oppWinding); | 2891 debugShowSort(fun, angles, first, winding, oppWinding, sortable); |
| 2887 } | 2892 } |
| 2888 | 2893 |
| 2889 #endif | 2894 #endif |
| 2890 | 2895 |
| 2891 #if DEBUG_SHOW_WINDING | 2896 #if DEBUG_SHOW_WINDING |
| 2892 int SkOpSegment::debugShowWindingValues(int slotCount, int ofInterest) const { | 2897 int SkOpSegment::debugShowWindingValues(int slotCount, int ofInterest) const { |
| 2893 if (!(1 << fID & ofInterest)) { | 2898 if (!(1 << fID & ofInterest)) { |
| 2894 return 0; | 2899 return 0; |
| 2895 } | 2900 } |
| 2896 int sum = 0; | 2901 int sum = 0; |
| 2897 SkTArray<char, true> slots(slotCount * 2); | 2902 SkTArray<char, true> slots(slotCount * 2); |
| 2898 memset(slots.begin(), ' ', slotCount * 2); | 2903 memset(slots.begin(), ' ', slotCount * 2); |
| 2899 for (int i = 0; i < fTs.count(); ++i) { | 2904 for (int i = 0; i < fTs.count(); ++i) { |
| 2900 // if (!(1 << fTs[i].fOther->fID & ofInterest)) { | 2905 // if (!(1 << fTs[i].fOther->fID & ofInterest)) { |
| 2901 // continue; | 2906 // continue; |
| 2902 // } | 2907 // } |
| 2903 sum += fTs[i].fWindValue; | 2908 sum += fTs[i].fWindValue; |
| 2904 slots[fTs[i].fOther->fID - 1] = as_digit(fTs[i].fWindValue); | 2909 slots[fTs[i].fOther->fID - 1] = as_digit(fTs[i].fWindValue); |
| 2905 sum += fTs[i].fOppValue; | 2910 sum += fTs[i].fOppValue; |
| 2906 slots[slotCount + fTs[i].fOther->fID - 1] = as_digit(fTs[i].fOppValue); | 2911 slots[slotCount + fTs[i].fOther->fID - 1] = as_digit(fTs[i].fOppValue); |
| 2907 } | 2912 } |
| 2908 SkDebugf("%s id=%2d %.*s | %.*s\n", __FUNCTION__, fID, slotCount, slots.begi
n(), slotCount, | 2913 SkDebugf("%s id=%2d %.*s | %.*s\n", __FUNCTION__, fID, slotCount, slots.begi
n(), slotCount, |
| 2909 slots.begin() + slotCount); | 2914 slots.begin() + slotCount); |
| 2910 return sum; | 2915 return sum; |
| 2911 } | 2916 } |
| 2912 #endif | 2917 #endif |
| OLD | NEW |