blob: a2b48acddc0e164ed00b3ec63e1888b12e5702ff [file] [log] [blame]
commit-bot@chromium.org4431e772014-04-14 17:08:59 +00001#include "SkOpContour.h"
2#include "SkIntersectionHelper.h"
3#include "SkOpSegment.h"
4
5inline void DebugDumpDouble(double x) {
6 if (x == floor(x)) {
7 SkDebugf("%.0f", x);
8 } else {
9 SkDebugf("%1.19g", x);
10 }
11}
12
13inline void DebugDumpFloat(float x) {
14 if (x == floorf(x)) {
15 SkDebugf("%.0f", x);
16 } else {
17 SkDebugf("%1.9gf", x);
18 }
19}
20
21// if not defined by PathOpsDebug.cpp ...
22#if !defined SK_DEBUG && FORCE_RELEASE
23bool SkPathOpsDebug::ValidWind(int wind) {
24 return wind > SK_MinS32 + 0xFFFF && wind < SK_MaxS32 - 0xFFFF;
25}
26
27void SkPathOpsDebug::WindingPrintf(int wind) {
28 if (wind == SK_MinS32) {
29 SkDebugf("?");
30 } else {
31 SkDebugf("%d", wind);
32 }
33}
34#endif
35
36void SkOpAngle::dump() const {
caryclarkdac1d172014-06-17 05:15:38 -070037 dumpOne(true);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000038 SkDebugf("\n");
39}
40
caryclarkdac1d172014-06-17 05:15:38 -070041void SkOpAngle::dumpOne(bool functionHeader) const {
42// fSegment->debugValidate();
43 const SkOpSpan& mSpan = fSegment->span(SkMin32(fStart, fEnd));
44 if (functionHeader) {
45 SkDebugf("%s ", __FUNCTION__);
46 }
47 SkDebugf("[%d", fSegment->debugID());
48 SkDebugf("/%d", debugID());
49 SkDebugf("] next=");
50 if (fNext) {
51 SkDebugf("%d", fNext->fSegment->debugID());
52 SkDebugf("/%d", fNext->debugID());
53 } else {
54 SkDebugf("?");
55 }
56 SkDebugf(" sect=%d/%d ", fSectorStart, fSectorEnd);
57 SkDebugf(" s=%1.9g [%d] e=%1.9g [%d]", fSegment->span(fStart).fT, fStart,
58 fSegment->span(fEnd).fT, fEnd);
59 SkDebugf(" sgn=%d windVal=%d", sign(), mSpan.fWindValue);
60
61 SkDebugf(" windSum=");
62 SkPathOpsDebug::WindingPrintf(mSpan.fWindSum);
63 if (mSpan.fOppValue != 0 || mSpan.fOppSum != SK_MinS32) {
64 SkDebugf(" oppVal=%d", mSpan.fOppValue);
65 SkDebugf(" oppSum=");
66 SkPathOpsDebug::WindingPrintf(mSpan.fOppSum);
67 }
68 if (mSpan.fDone) {
69 SkDebugf(" done");
70 }
71 if (unorderable()) {
72 SkDebugf(" unorderable");
73 }
74 if (small()) {
75 SkDebugf(" small");
76 }
77 if (mSpan.fTiny) {
78 SkDebugf(" tiny");
79 }
80 if (fSegment->operand()) {
81 SkDebugf(" operand");
82 }
83 if (fStop) {
84 SkDebugf(" stop");
85 }
86}
87
88void SkOpAngle::dumpTo(const SkOpSegment* segment, const SkOpAngle* to) const {
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000089 const SkOpAngle* first = this;
90 const SkOpAngle* next = this;
91 const char* indent = "";
92 do {
93 SkDebugf("%s", indent);
caryclarkdac1d172014-06-17 05:15:38 -070094 next->dumpOne(false);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000095 if (segment == next->fSegment) {
caryclarkdac1d172014-06-17 05:15:38 -070096 if (this == fNext) {
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000097 SkDebugf(" << from");
98 }
caryclarkdac1d172014-06-17 05:15:38 -070099 if (to == fNext) {
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000100 SkDebugf(" << to");
101 }
102 }
103 SkDebugf("\n");
104 indent = " ";
105 next = next->fNext;
106 } while (next && next != first);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000107}
108
109void SkOpAngle::dumpLoop() const {
110 const SkOpAngle* first = this;
111 const SkOpAngle* next = this;
112 do {
113 next->dump();
114 next = next->fNext;
115 } while (next && next != first);
116}
117
118void SkOpAngle::dumpPartials() const {
119 const SkOpAngle* first = this;
120 const SkOpAngle* next = this;
121 do {
122 next->fCurvePart.dumpNumber();
123 next = next->fNext;
124 } while (next && next != first);
125}
126
caryclarkdac1d172014-06-17 05:15:38 -0700127void SkOpAngleSet::dump() const {
128 // FIXME: unimplemented
129/* This requires access to the internal SkChunkAlloc data
130 Defer implementing this until it is needed for debugging
131*/
132 SkASSERT(0);
133}
134
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000135void SkOpContour::dump() const {
136 int segmentCount = fSegments.count();
137 SkDebugf("((SkOpContour*) 0x%p) [%d]\n", this, debugID());
138 for (int test = 0; test < segmentCount; ++test) {
139 SkDebugf(" [%d] ((SkOpSegment*) 0x%p) [%d]\n", test, &fSegments[test],
140 fSegments[test].debugID());
141 }
142}
143
144void SkOpContour::dumpAngles() const {
145 int segmentCount = fSegments.count();
146 SkDebugf("((SkOpContour*) 0x%p) [%d]\n", this, debugID());
147 for (int test = 0; test < segmentCount; ++test) {
148 SkDebugf(" [%d] ", test);
149 fSegments[test].dumpAngles();
150 }
151}
152
caryclarkdac1d172014-06-17 05:15:38 -0700153void SkOpContour::dumpCoincidence(const SkCoincidence& coin) const {
154 int thisIndex = coin.fSegments[0];
155 const SkOpSegment& s1 = fSegments[thisIndex];
156 int otherIndex = coin.fSegments[1];
157 const SkOpSegment& s2 = coin.fOther->fSegments[otherIndex];
158 SkDebugf("((SkOpSegment*) 0x%p) [%d] ((SkOpSegment*) 0x%p) [%d]\n", &s1, s1.debugID(),
159 &s2, s2.debugID());
160 for (int index = 0; index < 2; ++index) {
161 SkDebugf(" {%1.9gf, %1.9gf}", coin.fPts[0][index].fX, coin.fPts[0][index].fY);
162 if (coin.fNearly[index]) {
163 SkDebugf(" {%1.9gf, %1.9gf}", coin.fPts[1][index].fX, coin.fPts[1][index].fY);
164 }
165 SkDebugf(" seg1t=%1.9g seg2t=%1.9g\n", coin.fTs[0][index], coin.fTs[1][index]);
166 }
167}
168
169void SkOpContour::dumpCoincidences() const {
170 int count = fCoincidences.count();
171 if (count > 0) {
172 SkDebugf("fCoincidences count=%d\n", count);
173 for (int test = 0; test < count; ++test) {
174 dumpCoincidence(fCoincidences[test]);
175 }
176 }
177 count = fPartialCoincidences.count();
178 if (count == 0) {
179 return;
180 }
181 SkDebugf("fPartialCoincidences count=%d\n", count);
182 for (int test = 0; test < count; ++test) {
183 dumpCoincidence(fPartialCoincidences[test]);
184 }
185}
186
187void SkOpContour::dumpPt(int index) const {
188 int segmentCount = fSegments.count();
189 for (int test = 0; test < segmentCount; ++test) {
190 const SkOpSegment& segment = fSegments[test];
191 if (segment.debugID() == index) {
192 fSegments[test].dumpPts();
193 }
194 }
195}
196
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000197void SkOpContour::dumpPts() const {
198 int segmentCount = fSegments.count();
199 SkDebugf("((SkOpContour*) 0x%p) [%d]\n", this, debugID());
200 for (int test = 0; test < segmentCount; ++test) {
201 SkDebugf(" [%d] ", test);
202 fSegments[test].dumpPts();
203 }
204}
205
caryclarkdac1d172014-06-17 05:15:38 -0700206void SkOpContour::dumpSpan(int index) const {
207 int segmentCount = fSegments.count();
208 for (int test = 0; test < segmentCount; ++test) {
209 const SkOpSegment& segment = fSegments[test];
210 if (segment.debugID() == index) {
211 fSegments[test].dumpSpans();
212 }
213 }
214}
215
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000216void SkOpContour::dumpSpans() const {
217 int segmentCount = fSegments.count();
218 SkDebugf("((SkOpContour*) 0x%p) [%d]\n", this, debugID());
219 for (int test = 0; test < segmentCount; ++test) {
220 SkDebugf(" [%d] ", test);
221 fSegments[test].dumpSpans();
222 }
223}
224
225void SkDCubic::dump() const {
226 SkDebugf("{{");
227 int index = 0;
228 do {
229 fPts[index].dump();
230 SkDebugf(", ");
231 } while (++index < 3);
232 fPts[index].dump();
233 SkDebugf("}}\n");
234}
235
236void SkDCubic::dumpNumber() const {
237 SkDebugf("{{");
238 int index = 0;
239 bool dumpedOne = false;
240 do {
241 if (!(fPts[index].fX == fPts[index].fX && fPts[index].fY == fPts[index].fY)) {
242 continue;
243 }
244 if (dumpedOne) {
245 SkDebugf(", ");
246 }
247 fPts[index].dump();
248 dumpedOne = true;
249 } while (++index < 3);
250 if (fPts[index].fX == fPts[index].fX && fPts[index].fY == fPts[index].fY) {
251 if (dumpedOne) {
252 SkDebugf(", ");
253 }
254 fPts[index].dump();
255 }
256 SkDebugf("}}\n");
257}
258
259void SkDLine::dump() const {
260 SkDebugf("{{");
261 fPts[0].dump();
262 SkDebugf(", ");
263 fPts[1].dump();
264 SkDebugf("}}\n");
265}
266
267void SkDPoint::dump() const {
268 SkDebugf("{");
269 DebugDumpDouble(fX);
270 SkDebugf(", ");
271 DebugDumpDouble(fY);
272 SkDebugf("}");
273}
274
275void SkDPoint::Dump(const SkPoint& pt) {
276 SkDebugf("{");
277 DebugDumpFloat(pt.fX);
278 SkDebugf(", ");
279 DebugDumpFloat(pt.fY);
280 SkDebugf("}");
281}
282
283
284void SkDQuad::dumpComma(const char* comma) const {
285 SkDebugf("{{");
286 int index = 0;
287 do {
288 fPts[index].dump();
289 SkDebugf(", ");
290 } while (++index < 2);
291 fPts[index].dump();
292 SkDebugf("}}%s\n", comma ? comma : "");
293}
294
295void SkDQuad::dump() const {
296 dumpComma("");
297}
298
299void SkIntersectionHelper::dump() const {
300 SkDPoint::Dump(pts()[0]);
301 SkDPoint::Dump(pts()[1]);
302 if (verb() >= SkPath::kQuad_Verb) {
303 SkDPoint::Dump(pts()[2]);
304 }
305 if (verb() >= SkPath::kCubic_Verb) {
306 SkDPoint::Dump(pts()[3]);
307 }
308}
309
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +0000310const SkTDArray<SkOpSpan>& SkOpSegment::debugSpans() const {
311 return fTs;
312}
313
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000314void SkOpSegment::dumpAngles() const {
315 SkDebugf("((SkOpSegment*) 0x%p) [%d]\n", this, debugID());
caryclarkdac1d172014-06-17 05:15:38 -0700316 const SkOpAngle* fromAngle = NULL;
317 const SkOpAngle* toAngle = NULL;
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000318 for (int index = 0; index < count(); ++index) {
caryclarkdac1d172014-06-17 05:15:38 -0700319 const SkOpAngle* fAngle = fTs[index].fFromAngle;
320 const SkOpAngle* tAngle = fTs[index].fToAngle;
321 if (fromAngle == fAngle && toAngle == tAngle) {
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000322 continue;
323 }
caryclarkdac1d172014-06-17 05:15:38 -0700324 if (fAngle) {
325 SkDebugf(" [%d] from=%d ", index, fAngle->debugID());
326 fAngle->dumpTo(this, tAngle);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000327 }
caryclarkdac1d172014-06-17 05:15:38 -0700328 if (tAngle) {
329 SkDebugf(" [%d] to=%d ", index, tAngle->debugID());
330 tAngle->dumpTo(this, fAngle);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000331 }
caryclarkdac1d172014-06-17 05:15:38 -0700332 fromAngle = fAngle;
333 toAngle = tAngle;
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000334 }
335}
336
337void SkOpSegment::dumpContour(int firstID, int lastID) const {
338 if (debugID() < 0) {
339 return;
340 }
341 const SkOpSegment* test = this - (debugID() - 1);
342 test += (firstID - 1);
343 const SkOpSegment* last = test + (lastID - firstID);
344 while (test <= last) {
345 test->dumpSpans();
346 ++test;
347 }
348}
349
350void SkOpSegment::dumpPts() const {
351 int last = SkPathOpsVerbToPoints(fVerb);
352 SkDebugf("((SkOpSegment*) 0x%p) [%d] {{", this, debugID());
353 int index = 0;
354 do {
355 SkDPoint::Dump(fPts[index]);
356 SkDebugf(", ");
357 } while (++index < last);
358 SkDPoint::Dump(fPts[index]);
359 SkDebugf("}}\n");
360}
361
362void SkOpSegment::dumpDPts() const {
363 int count = SkPathOpsVerbToPoints(fVerb);
364 SkDebugf("((SkOpSegment*) 0x%p) [%d] {{", this, debugID());
365 int index = 0;
366 do {
367 SkDPoint dPt = {fPts[index].fX, fPts[index].fY};
368 dPt.dump();
369 if (index != count) {
370 SkDebugf(", ");
371 }
372 } while (++index <= count);
373 SkDebugf("}}\n");
374}
375
376void SkOpSegment::dumpSpans() const {
377 int count = this->count();
378 SkDebugf("((SkOpSegment*) 0x%p) [%d]\n", this, debugID());
379 for (int index = 0; index < count; ++index) {
380 const SkOpSpan& span = this->span(index);
381 SkDebugf(" [%d] ", index);
382 span.dumpOne();
383 }
384}
385
caryclarkdac1d172014-06-17 05:15:38 -0700386void SkPathOpsDebug::DumpCoincidence(const SkTArray<SkOpContour, true>& contours) {
387 int count = contours.count();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000388 for (int index = 0; index < count; ++index) {
caryclarkdac1d172014-06-17 05:15:38 -0700389 contours[index].dumpCoincidences();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000390 }
391}
392
caryclarkdac1d172014-06-17 05:15:38 -0700393void SkPathOpsDebug::DumpCoincidence(const SkTArray<SkOpContour* , true>& contours) {
394 int count = contours.count();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000395 for (int index = 0; index < count; ++index) {
caryclarkdac1d172014-06-17 05:15:38 -0700396 contours[index]->dumpCoincidences();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000397 }
398}
399
400void SkPathOpsDebug::DumpContours(const SkTArray<SkOpContour, true>& contours) {
401 int count = contours.count();
402 for (int index = 0; index < count; ++index) {
403 contours[index].dump();
404 }
405}
406
407void SkPathOpsDebug::DumpContours(const SkTArray<SkOpContour* , true>& contours) {
408 int count = contours.count();
409 for (int index = 0; index < count; ++index) {
410 contours[index]->dump();
411 }
412}
413
414void SkPathOpsDebug::DumpContourAngles(const SkTArray<SkOpContour, true>& contours) {
415 int count = contours.count();
416 for (int index = 0; index < count; ++index) {
417 contours[index].dumpAngles();
418 }
419}
420
421void SkPathOpsDebug::DumpContourAngles(const SkTArray<SkOpContour* , true>& contours) {
422 int count = contours.count();
423 for (int index = 0; index < count; ++index) {
424 contours[index]->dumpAngles();
425 }
426}
427
428void SkPathOpsDebug::DumpContourPts(const SkTArray<SkOpContour, true>& contours) {
429 int count = contours.count();
430 for (int index = 0; index < count; ++index) {
431 contours[index].dumpPts();
432 }
433}
434
435void SkPathOpsDebug::DumpContourPts(const SkTArray<SkOpContour* , true>& contours) {
436 int count = contours.count();
437 for (int index = 0; index < count; ++index) {
438 contours[index]->dumpPts();
439 }
440}
441
caryclarkdac1d172014-06-17 05:15:38 -0700442void SkPathOpsDebug::DumpContourPt(const SkTArray<SkOpContour, true>& contours, int segmentID) {
443 int count = contours.count();
444 for (int index = 0; index < count; ++index) {
445 contours[index].dumpPt(segmentID);
446 }
447}
448
449void SkPathOpsDebug::DumpContourPt(const SkTArray<SkOpContour* , true>& contours, int segmentID) {
450 int count = contours.count();
451 for (int index = 0; index < count; ++index) {
452 contours[index]->dumpPt(segmentID);
453 }
454}
455
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000456void SkPathOpsDebug::DumpContourSpans(const SkTArray<SkOpContour, true>& contours) {
457 int count = contours.count();
458 for (int index = 0; index < count; ++index) {
459 contours[index].dumpSpans();
460 }
461}
462
463void SkPathOpsDebug::DumpContourSpans(const SkTArray<SkOpContour* , true>& contours) {
464 int count = contours.count();
465 for (int index = 0; index < count; ++index) {
466 contours[index]->dumpSpans();
467 }
468}
469
caryclarkdac1d172014-06-17 05:15:38 -0700470void SkPathOpsDebug::DumpContourSpan(const SkTArray<SkOpContour, true>& contours, int segmentID) {
471 int count = contours.count();
472 for (int index = 0; index < count; ++index) {
473 contours[index].dumpSpan(segmentID);
474 }
475}
476
477void SkPathOpsDebug::DumpContourSpan(const SkTArray<SkOpContour* , true>& contours, int segmentID) {
478 int count = contours.count();
479 for (int index = 0; index < count; ++index) {
480 contours[index]->dumpSpan(segmentID);
481 }
482}
483
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000484void SkPathOpsDebug::DumpSpans(const SkTDArray<SkOpSpan *>& spans) {
485 int count = spans.count();
486 for (int index = 0; index < count; ++index) {
487 const SkOpSpan* span = spans[index];
488 const SkOpSpan& oSpan = span->fOther->span(span->fOtherIndex);
489 const SkOpSegment* segment = oSpan.fOther;
490 SkDebugf("((SkOpSegment*) 0x%p) [%d] ", segment, segment->debugID());
491 SkDebugf("spanIndex:%d ", oSpan.fOtherIndex);
492 span->dumpOne();
493 }
494}
495
496// this does not require that other T index is initialized or correct
497const SkOpSegment* SkOpSpan::debugToSegment(ptrdiff_t* spanIndex) const {
498 if (!fOther) {
499 return NULL;
500 }
501 int oppCount = fOther->count();
502 for (int index = 0; index < oppCount; ++index) {
503 const SkOpSpan& otherSpan = fOther->span(index);
504 double otherTestT = otherSpan.fT;
505 if (otherTestT < fOtherT) {
506 continue;
507 }
508 SkASSERT(otherTestT == fOtherT);
509 const SkOpSegment* candidate = otherSpan.fOther;
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +0000510 const SkOpSpan* first = candidate->debugSpans().begin();
511 const SkOpSpan* last = candidate->debugSpans().end() - 1;
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000512 if (first <= this && this <= last) {
513 if (spanIndex) {
514 *spanIndex = this - first;
515 }
516 return candidate;
517 }
518 }
519 SkASSERT(0);
520 return NULL;
521}
522
523void SkOpSpan::dumpOne() const {
524 SkDebugf("t=");
525 DebugDumpDouble(fT);
526 SkDebugf(" pt=");
527 SkDPoint::Dump(fPt);
528 if (fOther) {
529 SkDebugf(" other.fID=%d", fOther->debugID());
530 SkDebugf(" [%d] otherT=", fOtherIndex);
531 DebugDumpDouble(fOtherT);
532 } else {
533 SkDebugf(" other.fID=? [?] otherT=?");
534 }
caryclarkdac1d172014-06-17 05:15:38 -0700535 if (fWindSum != SK_MinS32) {
536 SkDebugf(" windSum=%d", fWindSum);
537 }
538 if (fOppSum != SK_MinS32 && (SkPathOpsDebug::ValidWind(fOppSum) || fOppValue != 0)) {
539 SkDebugf(" oppSum=%d", fOppSum);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000540 }
541 SkDebugf(" windValue=%d", fWindValue);
542 if (SkPathOpsDebug::ValidWind(fOppSum) || fOppValue != 0) {
543 SkDebugf(" oppValue=%d", fOppValue);
544 }
caryclarkdac1d172014-06-17 05:15:38 -0700545 if (fFromAngle && fFromAngle->debugID()) {
546 SkDebugf(" from=%d", fFromAngle->debugID());
547 }
548 if (fToAngle && fToAngle->debugID()) {
549 SkDebugf(" to=%d", fToAngle->debugID());
550 }
551 if (fChased) {
552 SkDebugf(" chased");
553 }
554 if (fCoincident) {
555 SkDebugf(" coincident");
556 }
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000557 if (fDone) {
558 SkDebugf(" done");
559 }
caryclarkdac1d172014-06-17 05:15:38 -0700560 if (fLoop) {
561 SkDebugf(" loop");
562 }
563 if (fMultiple) {
564 SkDebugf(" multiple");
565 }
566 if (fNear) {
567 SkDebugf(" near");
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000568 }
569 if (fSmall) {
570 SkDebugf(" small");
571 }
caryclarkdac1d172014-06-17 05:15:38 -0700572 if (fTiny) {
573 SkDebugf(" tiny");
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000574 }
575 SkDebugf("\n");
576}
577
578void SkOpSpan::dump() const {
579 ptrdiff_t spanIndex;
580 const SkOpSegment* segment = debugToSegment(&spanIndex);
581 if (segment) {
582 SkDebugf("((SkOpSegment*) 0x%p) [%d]\n", segment, segment->debugID());
583 SkDebugf(" [%d] ", spanIndex);
584 } else {
585 SkDebugf("((SkOpSegment*) ?) [?]\n");
586 SkDebugf(" [?] ");
587 }
588 dumpOne();
589}
590
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000591void Dump(const SkTArray<class SkOpContour, true>& contours) {
592 SkPathOpsDebug::DumpContours(contours);
593}
594
595void Dump(const SkTArray<class SkOpContour* , true>& contours) {
596 SkPathOpsDebug::DumpContours(contours);
597}
598
599void Dump(const SkTArray<class SkOpContour, true>* contours) {
600 SkPathOpsDebug::DumpContours(*contours);
601}
602
603void Dump(const SkTArray<class SkOpContour* , true>* contours) {
604 SkPathOpsDebug::DumpContours(*contours);
605}
606
caryclarkdac1d172014-06-17 05:15:38 -0700607void Dump(const SkTDArray<SkOpSpan *>& chase) {
608 SkPathOpsDebug::DumpSpans(chase);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000609}
610
caryclarkdac1d172014-06-17 05:15:38 -0700611void Dump(const SkTDArray<SkOpSpan *>* chase) {
612 SkPathOpsDebug::DumpSpans(*chase);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000613}
614
615void DumpAngles(const SkTArray<class SkOpContour, true>& contours) {
616 SkPathOpsDebug::DumpContourAngles(contours);
617}
618
619void DumpAngles(const SkTArray<class SkOpContour* , true>& contours) {
620 SkPathOpsDebug::DumpContourAngles(contours);
621}
622
623void DumpAngles(const SkTArray<class SkOpContour, true>* contours) {
624 SkPathOpsDebug::DumpContourAngles(*contours);
625}
626
627void DumpAngles(const SkTArray<class SkOpContour* , true>* contours) {
628 SkPathOpsDebug::DumpContourAngles(*contours);
629}
630
caryclarkdac1d172014-06-17 05:15:38 -0700631void DumpCoin(const SkTArray<class SkOpContour, true>& contours) {
632 SkPathOpsDebug::DumpCoincidence(contours);
633}
634
635void DumpCoin(const SkTArray<class SkOpContour* , true>& contours) {
636 SkPathOpsDebug::DumpCoincidence(contours);
637}
638
639void DumpCoin(const SkTArray<class SkOpContour, true>* contours) {
640 SkPathOpsDebug::DumpCoincidence(*contours);
641}
642
643void DumpCoin(const SkTArray<class SkOpContour* , true>* contours) {
644 SkPathOpsDebug::DumpCoincidence(*contours);
645}
646
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000647void DumpSpans(const SkTArray<class SkOpContour, true>& contours) {
648 SkPathOpsDebug::DumpContourSpans(contours);
649}
650
651void DumpSpans(const SkTArray<class SkOpContour* , true>& contours) {
652 SkPathOpsDebug::DumpContourSpans(contours);
653}
654
655void DumpSpans(const SkTArray<class SkOpContour, true>* contours) {
656 SkPathOpsDebug::DumpContourSpans(*contours);
657}
658
659void DumpSpans(const SkTArray<class SkOpContour* , true>* contours) {
660 SkPathOpsDebug::DumpContourSpans(*contours);
661}
662
caryclarkdac1d172014-06-17 05:15:38 -0700663void DumpSpan(const SkTArray<class SkOpContour, true>& contours, int segmentID) {
664 SkPathOpsDebug::DumpContourSpan(contours, segmentID);
665}
666
667void DumpSpan(const SkTArray<class SkOpContour* , true>& contours, int segmentID) {
668 SkPathOpsDebug::DumpContourSpan(contours, segmentID);
669}
670
671void DumpSpan(const SkTArray<class SkOpContour, true>* contours, int segmentID) {
672 SkPathOpsDebug::DumpContourSpan(*contours, segmentID);
673}
674
675void DumpSpan(const SkTArray<class SkOpContour* , true>* contours, int segmentID) {
676 SkPathOpsDebug::DumpContourSpan(*contours, segmentID);
677}
678
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000679void DumpPts(const SkTArray<class SkOpContour, true>& contours) {
680 SkPathOpsDebug::DumpContourPts(contours);
681}
682
683void DumpPts(const SkTArray<class SkOpContour* , true>& contours) {
684 SkPathOpsDebug::DumpContourPts(contours);
685}
686
687void DumpPts(const SkTArray<class SkOpContour, true>* contours) {
688 SkPathOpsDebug::DumpContourPts(*contours);
689}
690
691void DumpPts(const SkTArray<class SkOpContour* , true>* contours) {
692 SkPathOpsDebug::DumpContourPts(*contours);
693}
694
caryclarkdac1d172014-06-17 05:15:38 -0700695void DumpPt(const SkTArray<class SkOpContour, true>& contours, int segmentID) {
696 SkPathOpsDebug::DumpContourPt(contours, segmentID);
697}
698
699void DumpPt(const SkTArray<class SkOpContour* , true>& contours, int segmentID) {
700 SkPathOpsDebug::DumpContourPt(contours, segmentID);
701}
702
703void DumpPt(const SkTArray<class SkOpContour, true>* contours, int segmentID) {
704 SkPathOpsDebug::DumpContourPt(*contours, segmentID);
705}
706
707void DumpPt(const SkTArray<class SkOpContour* , true>* contours, int segmentID) {
708 SkPathOpsDebug::DumpContourPt(*contours, segmentID);
709}
710
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000711static void dumpTestCase(const SkDQuad& quad1, const SkDQuad& quad2, int testNo) {
712 SkDebugf("<div id=\"quad%d\">\n", testNo);
713 quad1.dumpComma(",");
714 quad2.dump();
715 SkDebugf("</div>\n\n");
716}
717
718static void dumpTestTrailer() {
719 SkDebugf("</div>\n\n<script type=\"text/javascript\">\n\n");
720 SkDebugf(" var testDivs = [\n");
721}
722
723static void dumpTestList(int testNo, double min) {
724 SkDebugf(" quad%d,", testNo);
725 if (min > 0) {
726 SkDebugf(" // %1.9g", min);
727 }
728 SkDebugf("\n");
729}
730
731void DumpQ(const SkDQuad& quad1, const SkDQuad& quad2, int testNo) {
732 SkDebugf("\n");
733 dumpTestCase(quad1, quad2, testNo);
734 dumpTestTrailer();
735 dumpTestList(testNo, 0);
736 SkDebugf("\n");
737}
738
739void DumpT(const SkDQuad& quad, double t) {
740 SkDLine line = {{quad.ptAtT(t), quad[0]}};
741 line.dump();
742}