| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 | 7 |
| 8 #include "PathOpsTSectDebug.h" | 8 #include "PathOpsTSectDebug.h" |
| 9 #include "SkOpCoincidence.h" | 9 #include "SkOpCoincidence.h" |
| 10 #include "SkOpContour.h" | 10 #include "SkOpContour.h" |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 291 } |
| 292 | 292 |
| 293 const SkOpSegment* SkPathOpsDebug::DebugSpanSegment(const SkOpSpanBase* span, in
t id) { | 293 const SkOpSegment* SkPathOpsDebug::DebugSpanSegment(const SkOpSpanBase* span, in
t id) { |
| 294 return span->debugSegment(id); | 294 return span->debugSegment(id); |
| 295 } | 295 } |
| 296 | 296 |
| 297 const SkOpSpanBase* SkPathOpsDebug::DebugSpanSpan(const SkOpSpanBase* span, int
id) { | 297 const SkOpSpanBase* SkPathOpsDebug::DebugSpanSpan(const SkOpSpanBase* span, int
id) { |
| 298 return span->debugSpan(id); | 298 return span->debugSpan(id); |
| 299 } | 299 } |
| 300 | 300 |
| 301 void SkPathOpsDebug::DumpContours(SkTDArray<SkOpContour* >* contours) { | 301 void SkOpContour::dumpContours() const { |
| 302 int count = contours->count(); | 302 SkOpContour* contour = this->globalState()->contourHead(); |
| 303 for (int index = 0; index < count; ++index) { | 303 do { |
| 304 (*contours)[index]->dump(); | 304 contour->dump(); |
| 305 } | 305 } while ((contour = contour->next())); |
| 306 } | 306 } |
| 307 | 307 |
| 308 void SkPathOpsDebug::DumpContoursAll(SkTDArray<SkOpContour* >* contours) { | 308 void SkOpContour::dumpContoursAll() const { |
| 309 int count = contours->count(); | 309 SkOpContour* contour = this->globalState()->contourHead(); |
| 310 for (int index = 0; index < count; ++index) { | 310 do { |
| 311 (*contours)[index]->dumpAll(); | 311 contour->dumpAll(); |
| 312 } | 312 } while ((contour = contour->next())); |
| 313 } | 313 } |
| 314 | 314 |
| 315 void SkPathOpsDebug::DumpContoursAngles(const SkTDArray<SkOpContour* >* contours
) { | 315 void SkOpContour::dumpContoursAngles() const { |
| 316 int count = contours->count(); | 316 SkOpContour* contour = this->globalState()->contourHead(); |
| 317 for (int index = 0; index < count; ++index) { | 317 do { |
| 318 (*contours)[index]->dumpAngles(); | 318 contour->dumpAngles(); |
| 319 } | 319 } while ((contour = contour->next())); |
| 320 } | 320 } |
| 321 | 321 |
| 322 void SkPathOpsDebug::DumpContoursPts(const SkTDArray<SkOpContour* >* contours) { | 322 void SkOpContour::dumpContoursPts() const { |
| 323 int count = contours->count(); | 323 SkOpContour* contour = this->globalState()->contourHead(); |
| 324 for (int index = 0; index < count; ++index) { | 324 do { |
| 325 (*contours)[index]->dumpPts(); | 325 contour->dumpPts(); |
| 326 } | 326 } while ((contour = contour->next())); |
| 327 } | 327 } |
| 328 | 328 |
| 329 void SkPathOpsDebug::DumpContoursPt(const SkTDArray<SkOpContour* >* contours, in
t segmentID) { | 329 void SkOpContour::dumpContoursPt(int segmentID) const { |
| 330 int count = contours->count(); | 330 SkOpContour* contour = this->globalState()->contourHead(); |
| 331 for (int index = 0; index < count; ++index) { | 331 do { |
| 332 (*contours)[index]->dumpPt(segmentID); | 332 contour->dumpPt(segmentID); |
| 333 } | 333 } while ((contour = contour->next())); |
| 334 } | 334 } |
| 335 | 335 |
| 336 void SkPathOpsDebug::DumpContoursSegment(const SkTDArray<SkOpContour* >* contour
s, | 336 void SkOpContour::dumpContoursSegment(int segmentID) const { |
| 337 int segmentID) { | 337 SkOpContour* contour = this->globalState()->contourHead(); |
| 338 if (contours->count()) { | 338 do { |
| 339 (*contours)[0]->dumpSegment(segmentID); | 339 contour->dumpSegment(segmentID); |
| 340 } | 340 } while ((contour = contour->next())); |
| 341 } | 341 } |
| 342 | 342 |
| 343 void SkPathOpsDebug::DumpContoursSpan(const SkTDArray<SkOpContour* >* contours, | 343 void SkOpContour::dumpContoursSpan(int spanID) const { |
| 344 int spanID) { | 344 SkOpContour* contour = this->globalState()->contourHead(); |
| 345 if (contours->count()) { | 345 do { |
| 346 (*contours)[0]->dumpSpan(spanID); | 346 contour->dumpSpan(spanID); |
| 347 } | 347 } while ((contour = contour->next())); |
| 348 } | 348 } |
| 349 | 349 |
| 350 void SkPathOpsDebug::DumpContoursSpans(const SkTDArray<SkOpContour* >* contours)
{ | 350 void SkOpContour::dumpContoursSpans() const { |
| 351 int count = contours->count(); | 351 SkOpContour* contour = this->globalState()->contourHead(); |
| 352 for (int index = 0; index < count; ++index) { | 352 do { |
| 353 (*contours)[index]->dumpSpans(); | 353 contour->dumpSpans(); |
| 354 } | 354 } while ((contour = contour->next())); |
| 355 } | 355 } |
| 356 | 356 |
| 357 template <typename TCurve, typename OppCurve> | 357 template <typename TCurve, typename OppCurve> |
| 358 const SkTSpan<TCurve, OppCurve>* DebugSpan(const SkTSect<TCurve, OppCurve>* sect
, int id) { | 358 const SkTSpan<TCurve, OppCurve>* DebugSpan(const SkTSect<TCurve, OppCurve>* sect
, int id) { |
| 359 return sect->debugSpan(id); | 359 return sect->debugSpan(id); |
| 360 } | 360 } |
| 361 | 361 |
| 362 void DontCallDebugSpan(int id); | 362 void DontCallDebugSpan(int id); |
| 363 void DontCallDebugSpan(int id) { // exists to instantiate the templates | 363 void DontCallDebugSpan(int id) { // exists to instantiate the templates |
| 364 SkDQuad quad; | 364 SkDQuad quad; |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 } | 721 } |
| 722 | 722 |
| 723 const SkOpPtT* SkOpAngle::debugPtT(int id) const { | 723 const SkOpPtT* SkOpAngle::debugPtT(int id) const { |
| 724 return this->segment()->debugPtT(id); | 724 return this->segment()->debugPtT(id); |
| 725 } | 725 } |
| 726 | 726 |
| 727 const SkOpSegment* SkOpAngle::debugSegment(int id) const { | 727 const SkOpSegment* SkOpAngle::debugSegment(int id) const { |
| 728 return this->segment()->debugSegment(id); | 728 return this->segment()->debugSegment(id); |
| 729 } | 729 } |
| 730 | 730 |
| 731 int SkOpAngle::debugSign() const { |
| 732 SkASSERT(fStart->t() != fEnd->t()); |
| 733 return fStart->t() < fEnd->t() ? -1 : 1; |
| 734 } |
| 735 |
| 731 const SkOpSpanBase* SkOpAngle::debugSpan(int id) const { | 736 const SkOpSpanBase* SkOpAngle::debugSpan(int id) const { |
| 732 return this->segment()->debugSpan(id); | 737 return this->segment()->debugSpan(id); |
| 733 } | 738 } |
| 734 | 739 |
| 735 void SkOpAngle::dump() const { | 740 void SkOpAngle::dump() const { |
| 736 dumpOne(true); | 741 dumpOne(true); |
| 737 SkDebugf("\n"); | 742 SkDebugf("\n"); |
| 738 } | 743 } |
| 739 | 744 |
| 740 void SkOpAngle::dumpOne(bool functionHeader) const { | 745 void SkOpAngle::dumpOne(bool functionHeader) const { |
| 741 // fSegment->debugValidate(); | 746 // fSegment->debugValidate(); |
| 742 const SkOpSegment* segment = this->segment(); | 747 const SkOpSegment* segment = this->segment(); |
| 743 const SkOpSpan& mSpan = *fStart->starter(fEnd); | 748 const SkOpSpan& mSpan = *fStart->starter(fEnd); |
| 744 if (functionHeader) { | 749 if (functionHeader) { |
| 745 SkDebugf("%s ", __FUNCTION__); | 750 SkDebugf("%s ", __FUNCTION__); |
| 746 } | 751 } |
| 747 SkDebugf("[%d", segment->debugID()); | 752 SkDebugf("[%d", segment->debugID()); |
| 748 SkDebugf("/%d", debugID()); | 753 SkDebugf("/%d", debugID()); |
| 749 SkDebugf("] next="); | 754 SkDebugf("] next="); |
| 750 if (fNext) { | 755 if (fNext) { |
| 751 SkDebugf("%d", fNext->fStart->segment()->debugID()); | 756 SkDebugf("%d", fNext->fStart->segment()->debugID()); |
| 752 SkDebugf("/%d", fNext->debugID()); | 757 SkDebugf("/%d", fNext->debugID()); |
| 753 } else { | 758 } else { |
| 754 SkDebugf("?"); | 759 SkDebugf("?"); |
| 755 } | 760 } |
| 756 SkDebugf(" sect=%d/%d ", fSectorStart, fSectorEnd); | 761 SkDebugf(" sect=%d/%d ", fSectorStart, fSectorEnd); |
| 757 SkDebugf(" s=%1.9g [%d] e=%1.9g [%d]", fStart->t(), fStart->debugID(), | 762 SkDebugf(" s=%1.9g [%d] e=%1.9g [%d]", fStart->t(), fStart->debugID(), |
| 758 fEnd->t(), fEnd->debugID()); | 763 fEnd->t(), fEnd->debugID()); |
| 759 SkDebugf(" sgn=%d windVal=%d", this->sign(), mSpan.windValue()); | 764 SkDebugf(" sgn=%d windVal=%d", this->debugSign(), mSpan.windValue()); |
| 760 | 765 |
| 761 SkDebugf(" windSum="); | 766 SkDebugf(" windSum="); |
| 762 SkPathOpsDebug::WindingPrintf(mSpan.windSum()); | 767 SkPathOpsDebug::WindingPrintf(mSpan.windSum()); |
| 763 if (mSpan.oppValue() != 0 || mSpan.oppSum() != SK_MinS32) { | 768 if (mSpan.oppValue() != 0 || mSpan.oppSum() != SK_MinS32) { |
| 764 SkDebugf(" oppVal=%d", mSpan.oppValue()); | 769 SkDebugf(" oppVal=%d", mSpan.oppValue()); |
| 765 SkDebugf(" oppSum="); | 770 SkDebugf(" oppSum="); |
| 766 SkPathOpsDebug::WindingPrintf(mSpan.oppSum()); | 771 SkPathOpsDebug::WindingPrintf(mSpan.oppSum()); |
| 767 } | 772 } |
| 768 if (mSpan.done()) { | 773 if (mSpan.done()) { |
| 769 SkDebugf(" done"); | 774 SkDebugf(" done"); |
| 770 } | 775 } |
| 771 if (unorderable()) { | 776 if (unorderable()) { |
| 772 SkDebugf(" unorderable"); | 777 SkDebugf(" unorderable"); |
| 773 } | 778 } |
| 774 if (segment->operand()) { | 779 if (segment->operand()) { |
| 775 SkDebugf(" operand"); | 780 SkDebugf(" operand"); |
| 776 } | 781 } |
| 777 if (fStop) { | |
| 778 SkDebugf(" stop"); | |
| 779 } | |
| 780 } | 782 } |
| 781 | 783 |
| 782 void SkOpAngle::dumpTo(const SkOpSegment* segment, const SkOpAngle* to) const { | 784 void SkOpAngle::dumpTo(const SkOpSegment* segment, const SkOpAngle* to) const { |
| 783 const SkOpAngle* first = this; | 785 const SkOpAngle* first = this; |
| 784 const SkOpAngle* next = this; | 786 const SkOpAngle* next = this; |
| 785 const char* indent = ""; | 787 const char* indent = ""; |
| 786 do { | 788 do { |
| 787 SkDebugf("%s", indent); | 789 SkDebugf("%s", indent); |
| 788 next->dumpOne(false); | 790 next->dumpOne(false); |
| 789 if (segment == next->fStart->segment()) { | 791 if (segment == next->fStart->segment()) { |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 } while (!span->final() && (span = span->upCast()->next())); | 1056 } while (!span->final() && (span = span->upCast()->next())); |
| 1055 } | 1057 } |
| 1056 | 1058 |
| 1057 void SkOpSegment::dumpCoin() const { | 1059 void SkOpSegment::dumpCoin() const { |
| 1058 const SkOpSpan* span = &fHead; | 1060 const SkOpSpan* span = &fHead; |
| 1059 do { | 1061 do { |
| 1060 span->dumpCoin(); | 1062 span->dumpCoin(); |
| 1061 } while ((span = span->next()->upCastable())); | 1063 } while ((span = span->next()->upCastable())); |
| 1062 } | 1064 } |
| 1063 | 1065 |
| 1064 void SkOpSegment::dumpPts() const { | 1066 void SkOpSegment::dumpPtsInner() const { |
| 1065 int last = SkPathOpsVerbToPoints(fVerb); | 1067 int last = SkPathOpsVerbToPoints(fVerb); |
| 1066 SkDebugf("seg=%d {{", this->debugID()); | 1068 SkDebugf("seg=%d {{", this->debugID()); |
| 1067 if (fVerb == SkPath::kConic_Verb) { | 1069 if (fVerb == SkPath::kConic_Verb) { |
| 1068 SkDebugf("{"); | 1070 SkDebugf("{"); |
| 1069 } | 1071 } |
| 1070 int index = 0; | 1072 int index = 0; |
| 1071 do { | 1073 do { |
| 1072 SkDPoint::Dump(fPts[index]); | 1074 SkDPoint::Dump(fPts[index]); |
| 1073 SkDebugf(", "); | 1075 SkDebugf(", "); |
| 1074 } while (++index < last); | 1076 } while (++index < last); |
| 1075 SkDPoint::Dump(fPts[index]); | 1077 SkDPoint::Dump(fPts[index]); |
| 1076 SkDebugf("}}"); | 1078 SkDebugf("}}"); |
| 1077 if (fVerb == SkPath::kConic_Verb) { | 1079 if (fVerb == SkPath::kConic_Verb) { |
| 1078 SkDebugf(", %1.9gf}", fWeight); | 1080 SkDebugf(", %1.9gf}", fWeight); |
| 1079 } | 1081 } |
| 1082 } |
| 1083 |
| 1084 void SkOpSegment::dumpPts() const { |
| 1085 dumpPtsInner(); |
| 1080 SkDebugf("\n"); | 1086 SkDebugf("\n"); |
| 1081 } | 1087 } |
| 1082 | 1088 |
| 1083 void SkCoincidentSpans::dump() const { | 1089 void SkCoincidentSpans::dump() const { |
| 1084 SkDebugf("- seg=%d span=%d ptT=%d ", fCoinPtTStart->segment()->debugID(), | 1090 SkDebugf("- seg=%d span=%d ptT=%d ", fCoinPtTStart->segment()->debugID(), |
| 1085 fCoinPtTStart->span()->debugID(), fCoinPtTStart->debugID()); | 1091 fCoinPtTStart->span()->debugID(), fCoinPtTStart->debugID()); |
| 1086 fCoinPtTStart->dumpBase(); | 1092 fCoinPtTStart->dumpBase(); |
| 1087 SkDebugf(" span=%d ptT=%d ", fCoinPtTEnd->span()->debugID(), fCoinPtTEnd->de
bugID()); | 1093 SkDebugf(" span=%d ptT=%d ", fCoinPtTEnd->span()->debugID(), fCoinPtTEnd->de
bugID()); |
| 1088 fCoinPtTEnd->dumpBase(); | 1094 fCoinPtTEnd->dumpBase(); |
| 1089 if (fCoinPtTStart->segment()->operand()) { | 1095 if (fCoinPtTStart->segment()->operand()) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1108 } | 1114 } |
| 1109 | 1115 |
| 1110 void SkOpCoincidence::dump() const { | 1116 void SkOpCoincidence::dump() const { |
| 1111 SkCoincidentSpans* span = fHead; | 1117 SkCoincidentSpans* span = fHead; |
| 1112 while (span) { | 1118 while (span) { |
| 1113 span->dump(); | 1119 span->dump(); |
| 1114 span = span->fNext; | 1120 span = span->fNext; |
| 1115 } | 1121 } |
| 1116 } | 1122 } |
| 1117 | 1123 |
| 1118 void SkOpContour::dump() { | 1124 void SkOpContour::dump() const { |
| 1119 SkDebugf("contour=%d count=%d op=%d xor=%d\n", this->debugID(), fCount, fOpe
rand, fXor); | 1125 SkDebugf("contour=%d count=%d op=%d xor=%d\n", this->debugID(), fCount, fOpe
rand, fXor); |
| 1120 if (!fCount) { | 1126 if (!fCount) { |
| 1121 return; | 1127 return; |
| 1122 } | 1128 } |
| 1123 const SkOpSegment* segment = &fHead; | 1129 const SkOpSegment* segment = &fHead; |
| 1124 SkDEBUGCODE(fIndent = 0); | 1130 SkDEBUGCODE(fDebugIndent = 0); |
| 1125 indentDump(); | 1131 this->indentDump(); |
| 1126 do { | 1132 do { |
| 1127 segment->dump(); | 1133 segment->dump(); |
| 1128 } while ((segment = segment->next())); | 1134 } while ((segment = segment->next())); |
| 1129 outdentDump(); | 1135 this->outdentDump(); |
| 1130 } | 1136 } |
| 1131 | 1137 |
| 1132 void SkOpContour::dumpAll() { | 1138 void SkOpContour::dumpAll() const { |
| 1133 SkDebugf("contour=%d count=%d op=%d xor=%d\n", this->debugID(), fCount, fOpe
rand, fXor); | 1139 SkDebugf("contour=%d count=%d op=%d xor=%d\n", this->debugID(), fCount, fOpe
rand, fXor); |
| 1134 if (!fCount) { | 1140 if (!fCount) { |
| 1135 return; | 1141 return; |
| 1136 } | 1142 } |
| 1137 const SkOpSegment* segment = &fHead; | 1143 const SkOpSegment* segment = &fHead; |
| 1138 SkDEBUGCODE(fIndent = 0); | 1144 SkDEBUGCODE(fDebugIndent = 0); |
| 1139 indentDump(); | 1145 this->indentDump(); |
| 1140 do { | 1146 do { |
| 1141 segment->dumpAll(); | 1147 segment->dumpAll(); |
| 1142 } while ((segment = segment->next())); | 1148 } while ((segment = segment->next())); |
| 1143 outdentDump(); | 1149 this->outdentDump(); |
| 1144 } | 1150 } |
| 1145 | 1151 |
| 1146 | 1152 |
| 1147 void SkOpContour::dumpAngles() const { | 1153 void SkOpContour::dumpAngles() const { |
| 1148 SkDebugf("contour=%d\n", this->debugID()); | 1154 SkDebugf("contour=%d\n", this->debugID()); |
| 1149 const SkOpSegment* segment = &fHead; | 1155 const SkOpSegment* segment = &fHead; |
| 1150 do { | 1156 do { |
| 1151 SkDebugf(" seg=%d ", segment->debugID()); | 1157 SkDebugf(" seg=%d ", segment->debugID()); |
| 1152 segment->dumpAngles(); | 1158 segment->dumpAngles(); |
| 1153 } while ((segment = segment->next())); | 1159 } while ((segment = segment->next())); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1218 SkDebugf("{{"); | 1224 SkDebugf("{{"); |
| 1219 int index; | 1225 int index; |
| 1220 for (index = 0; index <= count - 1; ++index) { | 1226 for (index = 0; index <= count - 1; ++index) { |
| 1221 SkDebugf("{%1.9gf,%1.9gf}, ", fPts[index].fX, fPts[index].fY); | 1227 SkDebugf("{%1.9gf,%1.9gf}, ", fPts[index].fX, fPts[index].fY); |
| 1222 } | 1228 } |
| 1223 SkDebugf("{%1.9gf,%1.9gf}}}\n", fPts[index].fX, fPts[index].fY); | 1229 SkDebugf("{%1.9gf,%1.9gf}}}\n", fPts[index].fX, fPts[index].fY); |
| 1224 } | 1230 } |
| 1225 | 1231 |
| 1226 #ifdef SK_DEBUG | 1232 #ifdef SK_DEBUG |
| 1227 const SkOpAngle* SkOpGlobalState::debugAngle(int id) const { | 1233 const SkOpAngle* SkOpGlobalState::debugAngle(int id) const { |
| 1228 const SkOpContour* contour = fHead; | 1234 const SkOpContour* contour = fContourHead; |
| 1229 do { | 1235 do { |
| 1230 const SkOpSegment* segment = contour->first(); | 1236 const SkOpSegment* segment = contour->first(); |
| 1231 while (segment) { | 1237 while (segment) { |
| 1232 const SkOpSpan* span = segment->head(); | 1238 const SkOpSpan* span = segment->head(); |
| 1233 do { | 1239 do { |
| 1234 SkOpAngle* angle = span->fromAngle(); | 1240 SkOpAngle* angle = span->fromAngle(); |
| 1235 if (angle && angle->debugID() == id) { | 1241 if (angle && angle->debugID() == id) { |
| 1236 return angle; | 1242 return angle; |
| 1237 } | 1243 } |
| 1238 angle = span->toAngle(); | 1244 angle = span->toAngle(); |
| 1239 if (angle && angle->debugID() == id) { | 1245 if (angle && angle->debugID() == id) { |
| 1240 return angle; | 1246 return angle; |
| 1241 } | 1247 } |
| 1242 } while ((span = span->next()->upCastable())); | 1248 } while ((span = span->next()->upCastable())); |
| 1243 const SkOpSpanBase* tail = segment->tail(); | 1249 const SkOpSpanBase* tail = segment->tail(); |
| 1244 SkOpAngle* angle = tail->fromAngle(); | 1250 SkOpAngle* angle = tail->fromAngle(); |
| 1245 if (angle && angle->debugID() == id) { | 1251 if (angle && angle->debugID() == id) { |
| 1246 return angle; | 1252 return angle; |
| 1247 } | 1253 } |
| 1248 segment = segment->next(); | 1254 segment = segment->next(); |
| 1249 } | 1255 } |
| 1250 } while ((contour = contour->next())); | 1256 } while ((contour = contour->next())); |
| 1251 return NULL; | 1257 return NULL; |
| 1252 } | 1258 } |
| 1253 | 1259 |
| 1254 SkOpContour* SkOpGlobalState::debugContour(int id) { | 1260 SkOpContour* SkOpGlobalState::debugContour(int id) { |
| 1255 SkOpContour* contour = fHead; | 1261 SkOpContour* contour = fContourHead; |
| 1256 do { | 1262 do { |
| 1257 if (contour->debugID() == id) { | 1263 if (contour->debugID() == id) { |
| 1258 return contour; | 1264 return contour; |
| 1259 } | 1265 } |
| 1260 } while ((contour = contour->next())); | 1266 } while ((contour = contour->next())); |
| 1261 return NULL; | 1267 return NULL; |
| 1262 } | 1268 } |
| 1263 | 1269 |
| 1264 const SkOpPtT* SkOpGlobalState::debugPtT(int id) const { | 1270 const SkOpPtT* SkOpGlobalState::debugPtT(int id) const { |
| 1265 const SkOpContour* contour = fHead; | 1271 const SkOpContour* contour = fContourHead; |
| 1266 do { | 1272 do { |
| 1267 const SkOpSegment* segment = contour->first(); | 1273 const SkOpSegment* segment = contour->first(); |
| 1268 while (segment) { | 1274 while (segment) { |
| 1269 const SkOpSpan* span = segment->head(); | 1275 const SkOpSpan* span = segment->head(); |
| 1270 do { | 1276 do { |
| 1271 const SkOpPtT* ptT = span->ptT(); | 1277 const SkOpPtT* ptT = span->ptT(); |
| 1272 if (ptT->debugMatchID(id)) { | 1278 if (ptT->debugMatchID(id)) { |
| 1273 return ptT; | 1279 return ptT; |
| 1274 } | 1280 } |
| 1275 } while ((span = span->next()->upCastable())); | 1281 } while ((span = span->next()->upCastable())); |
| 1276 const SkOpSpanBase* tail = segment->tail(); | 1282 const SkOpSpanBase* tail = segment->tail(); |
| 1277 const SkOpPtT* ptT = tail->ptT(); | 1283 const SkOpPtT* ptT = tail->ptT(); |
| 1278 if (ptT->debugMatchID(id)) { | 1284 if (ptT->debugMatchID(id)) { |
| 1279 return ptT; | 1285 return ptT; |
| 1280 } | 1286 } |
| 1281 segment = segment->next(); | 1287 segment = segment->next(); |
| 1282 } | 1288 } |
| 1283 } while ((contour = contour->next())); | 1289 } while ((contour = contour->next())); |
| 1284 return NULL; | 1290 return NULL; |
| 1285 } | 1291 } |
| 1286 | 1292 |
| 1287 const SkOpSegment* SkOpGlobalState::debugSegment(int id) const { | 1293 const SkOpSegment* SkOpGlobalState::debugSegment(int id) const { |
| 1288 const SkOpContour* contour = fHead; | 1294 const SkOpContour* contour = fContourHead; |
| 1289 do { | 1295 do { |
| 1290 const SkOpSegment* segment = contour->first(); | 1296 const SkOpSegment* segment = contour->first(); |
| 1291 while (segment) { | 1297 while (segment) { |
| 1292 if (segment->debugID() == id) { | 1298 if (segment->debugID() == id) { |
| 1293 return segment; | 1299 return segment; |
| 1294 } | 1300 } |
| 1295 segment = segment->next(); | 1301 segment = segment->next(); |
| 1296 } | 1302 } |
| 1297 } while ((contour = contour->next())); | 1303 } while ((contour = contour->next())); |
| 1298 return NULL; | 1304 return NULL; |
| 1299 } | 1305 } |
| 1300 | 1306 |
| 1301 const SkOpSpanBase* SkOpGlobalState::debugSpan(int id) const { | 1307 const SkOpSpanBase* SkOpGlobalState::debugSpan(int id) const { |
| 1302 const SkOpContour* contour = fHead; | 1308 const SkOpContour* contour = fContourHead; |
| 1303 do { | 1309 do { |
| 1304 const SkOpSegment* segment = contour->first(); | 1310 const SkOpSegment* segment = contour->first(); |
| 1305 while (segment) { | 1311 while (segment) { |
| 1306 const SkOpSpan* span = segment->head(); | 1312 const SkOpSpan* span = segment->head(); |
| 1307 do { | 1313 do { |
| 1308 if (span->debugID() == id) { | 1314 if (span->debugID() == id) { |
| 1309 return span; | 1315 return span; |
| 1310 } | 1316 } |
| 1311 } while ((span = span->next()->upCastable())); | 1317 } while ((span = span->next()->upCastable())); |
| 1312 const SkOpSpanBase* tail = segment->tail(); | 1318 const SkOpSpanBase* tail = segment->tail(); |
| 1313 if (tail->debugID() == id) { | 1319 if (tail->debugID() == id) { |
| 1314 return tail; | 1320 return tail; |
| 1315 } | 1321 } |
| 1316 segment = segment->next(); | 1322 segment = segment->next(); |
| 1317 } | 1323 } |
| 1318 } while ((contour = contour->next())); | 1324 } while ((contour = contour->next())); |
| 1319 return NULL; | 1325 return NULL; |
| 1320 } | 1326 } |
| 1321 #endif | 1327 #endif |
| 1322 | 1328 |
| 1323 const SkOpAngle* DebugAngle(const SkTDArray<SkOpContour* >* contours, int id) { | |
| 1324 return (*contours)[0]->debugAngle(id); | |
| 1325 } | |
| 1326 | |
| 1327 SkOpContour* DumpContour(const SkTDArray<SkOpContour* >* contours, int id) { | |
| 1328 return (*contours)[0]->debugContour(id); | |
| 1329 } | |
| 1330 | |
| 1331 const SkOpPtT* DebugPtT(const SkTDArray<SkOpContour* >* contours, int id) { | |
| 1332 return (*contours)[0]->debugPtT(id); | |
| 1333 } | |
| 1334 | |
| 1335 const SkOpSegment* DebugSegment(const SkTDArray<SkOpContour* >* contours, int id
) { | |
| 1336 return (*contours)[0]->debugSegment(id); | |
| 1337 } | |
| 1338 | |
| 1339 const SkOpSpanBase* DebugSpan(const SkTDArray<SkOpContour* >* contours, int id)
{ | |
| 1340 return (*contours)[0]->debugSpan(id); | |
| 1341 } | |
| 1342 | |
| 1343 void Dump(SkTDArray<SkOpContour* >* contours) { | |
| 1344 SkPathOpsDebug::DumpContours(contours); | |
| 1345 } | |
| 1346 | |
| 1347 void DumpAll(SkTDArray<SkOpContour* >* contours) { | |
| 1348 SkPathOpsDebug::DumpContoursAll(contours); | |
| 1349 } | |
| 1350 | |
| 1351 void DumpAngles(const SkTDArray<SkOpContour* >* contours) { | |
| 1352 SkPathOpsDebug::DumpContoursAngles(contours); | |
| 1353 } | |
| 1354 | |
| 1355 void DumpSegment(const SkTDArray<SkOpContour* >* contours, int segmentID) { | |
| 1356 SkPathOpsDebug::DumpContoursSegment(contours, segmentID); | |
| 1357 } | |
| 1358 | |
| 1359 void DumpSpan(const SkTDArray<SkOpContour* >* contours, int spanID) { | |
| 1360 SkPathOpsDebug::DumpContoursSpan(contours, spanID); | |
| 1361 } | |
| 1362 | |
| 1363 void DumpSpans(const SkTDArray<SkOpContour* >* contours) { | |
| 1364 SkPathOpsDebug::DumpContoursSpans(contours); | |
| 1365 } | |
| 1366 | |
| 1367 void DumpPt(const SkTDArray<SkOpContour* >* contours, int segmentID) { | |
| 1368 SkPathOpsDebug::DumpContoursPt(contours, segmentID); | |
| 1369 } | |
| 1370 | |
| 1371 void DumpPts(const SkTDArray<SkOpContour* >* contours) { | |
| 1372 SkPathOpsDebug::DumpContoursPts(contours); | |
| 1373 } | |
| 1374 | |
| 1375 #if DEBUG_T_SECT_DUMP > 1 | 1329 #if DEBUG_T_SECT_DUMP > 1 |
| 1376 int gDumpTSectNum; | 1330 int gDumpTSectNum; |
| 1377 #endif | 1331 #endif |
| OLD | NEW |