OLD | NEW |
1 /* | |
2 * Copyright 2014 Google Inc. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 | |
8 #include "PathOpsTSectDebug.h" | |
9 #include "SkOpCoincidence.h" | |
10 #include "SkOpContour.h" | 1 #include "SkOpContour.h" |
11 #include "SkIntersectionHelper.h" | 2 #include "SkIntersectionHelper.h" |
12 #include "SkOpSegment.h" | 3 #include "SkOpSegment.h" |
13 #include "SkString.h" | 4 #include "SkString.h" |
14 | 5 |
15 inline void DebugDumpDouble(double x) { | 6 inline void DebugDumpDouble(double x) { |
16 if (x == floor(x)) { | 7 if (x == floor(x)) { |
17 SkDebugf("%.0f", x); | 8 SkDebugf("%.0f", x); |
18 } else { | 9 } else { |
19 SkDebugf("%1.19g", x); | 10 SkDebugf("%1.19g", x); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 43 |
53 static void output_points(const SkPoint* pts, int count) { | 44 static void output_points(const SkPoint* pts, int count) { |
54 for (int index = 0; index < count; ++index) { | 45 for (int index = 0; index < count; ++index) { |
55 output_scalar(pts[index].fX); | 46 output_scalar(pts[index].fX); |
56 SkDebugf(", "); | 47 SkDebugf(", "); |
57 output_scalar(pts[index].fY); | 48 output_scalar(pts[index].fY); |
58 if (index + 1 < count) { | 49 if (index + 1 < count) { |
59 SkDebugf(", "); | 50 SkDebugf(", "); |
60 } | 51 } |
61 } | 52 } |
| 53 SkDebugf(");\n"); |
62 } | 54 } |
63 | 55 |
64 static void showPathContours(SkPath::RawIter& iter, const char* pathName) { | 56 static void showPathContours(SkPath::RawIter& iter, const char* pathName) { |
65 uint8_t verb; | 57 uint8_t verb; |
66 SkPoint pts[4]; | 58 SkPoint pts[4]; |
67 while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { | 59 while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { |
68 switch (verb) { | 60 switch (verb) { |
69 case SkPath::kMove_Verb: | 61 case SkPath::kMove_Verb: |
70 SkDebugf(" %s.moveTo(", pathName); | 62 SkDebugf(" %s.moveTo(", pathName); |
71 output_points(&pts[0], 1); | 63 output_points(&pts[0], 1); |
72 SkDebugf(");\n"); | |
73 continue; | 64 continue; |
74 case SkPath::kLine_Verb: | 65 case SkPath::kLine_Verb: |
75 SkDebugf(" %s.lineTo(", pathName); | 66 SkDebugf(" %s.lineTo(", pathName); |
76 output_points(&pts[1], 1); | 67 output_points(&pts[1], 1); |
77 SkDebugf(");\n"); | |
78 break; | 68 break; |
79 case SkPath::kQuad_Verb: | 69 case SkPath::kQuad_Verb: |
80 SkDebugf(" %s.quadTo(", pathName); | 70 SkDebugf(" %s.quadTo(", pathName); |
81 output_points(&pts[1], 2); | 71 output_points(&pts[1], 2); |
82 SkDebugf(");\n"); | |
83 break; | |
84 case SkPath::kConic_Verb: | |
85 SkDebugf(" %s.conicTo(", pathName); | |
86 output_points(&pts[1], 2); | |
87 SkDebugf(", %1.9gf);\n", iter.conicWeight()); | |
88 break; | 72 break; |
89 case SkPath::kCubic_Verb: | 73 case SkPath::kCubic_Verb: |
90 SkDebugf(" %s.cubicTo(", pathName); | 74 SkDebugf(" %s.cubicTo(", pathName); |
91 output_points(&pts[1], 3); | 75 output_points(&pts[1], 3); |
92 SkDebugf(");\n"); | |
93 break; | 76 break; |
94 case SkPath::kClose_Verb: | 77 case SkPath::kClose_Verb: |
95 SkDebugf(" %s.close();\n", pathName); | 78 SkDebugf(" %s.close();\n", pathName); |
96 break; | 79 break; |
97 default: | 80 default: |
98 SkDEBUGFAIL("bad verb"); | 81 SkDEBUGFAIL("bad verb"); |
99 return; | 82 return; |
100 } | 83 } |
101 } | 84 } |
102 } | 85 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 161 |
179 void SkPathOpsDebug::WindingPrintf(int wind) { | 162 void SkPathOpsDebug::WindingPrintf(int wind) { |
180 if (wind == SK_MinS32) { | 163 if (wind == SK_MinS32) { |
181 SkDebugf("?"); | 164 SkDebugf("?"); |
182 } else { | 165 } else { |
183 SkDebugf("%d", wind); | 166 SkDebugf("%d", wind); |
184 } | 167 } |
185 } | 168 } |
186 #endif | 169 #endif |
187 | 170 |
188 void SkDCubic::dump() const { | |
189 dumpInner(); | |
190 SkDebugf("}},\n"); | |
191 } | |
192 | |
193 void SkDCubic::dumpID(int id) const { | |
194 dumpInner(); | |
195 SkDebugf("}} id=%d\n", id); | |
196 } | |
197 | |
198 static inline bool double_is_NaN(double x) { return x != x; } | |
199 | |
200 void SkDCubic::dumpInner() const { | |
201 SkDebugf("{{"); | |
202 int index = 0; | |
203 do { | |
204 if (index != 0) { | |
205 if (double_is_NaN(fPts[index].fX) && double_is_NaN(fPts[index].fY))
{ | |
206 return; | |
207 } | |
208 SkDebugf(", "); | |
209 } | |
210 fPts[index].dump(); | |
211 } while (++index < 3); | |
212 if (double_is_NaN(fPts[index].fX) && double_is_NaN(fPts[index].fY)) { | |
213 return; | |
214 } | |
215 SkDebugf(", "); | |
216 fPts[index].dump(); | |
217 } | |
218 | |
219 void SkDLine::dump() const { | |
220 SkDebugf("{{"); | |
221 fPts[0].dump(); | |
222 SkDebugf(", "); | |
223 fPts[1].dump(); | |
224 SkDebugf("}},\n"); | |
225 } | |
226 | |
227 void SkDPoint::dump() const { | |
228 SkDebugf("{"); | |
229 DebugDumpDouble(fX); | |
230 SkDebugf(", "); | |
231 DebugDumpDouble(fY); | |
232 SkDebugf("}"); | |
233 } | |
234 | |
235 void SkDPoint::Dump(const SkPoint& pt) { | |
236 SkDebugf("{"); | |
237 DebugDumpFloat(pt.fX); | |
238 SkDebugf(", "); | |
239 DebugDumpFloat(pt.fY); | |
240 SkDebugf("}"); | |
241 } | |
242 | |
243 void SkDPoint::DumpHex(const SkPoint& pt) { | |
244 SkDebugf("{"); | |
245 DebugDumpHexFloat(pt.fX); | |
246 SkDebugf(", "); | |
247 DebugDumpHexFloat(pt.fY); | |
248 SkDebugf("}"); | |
249 } | |
250 | |
251 void SkDQuad::dump() const { | |
252 dumpInner(); | |
253 SkDebugf("}},\n"); | |
254 } | |
255 | |
256 void SkDQuad::dumpID(int id) const { | |
257 dumpInner(); | |
258 SkDebugf("}} id=%d\n", id); | |
259 } | |
260 | |
261 void SkDQuad::dumpInner() const { | |
262 SkDebugf("{{"); | |
263 int index = 0; | |
264 do { | |
265 fPts[index].dump(); | |
266 SkDebugf(", "); | |
267 } while (++index < 2); | |
268 fPts[index].dump(); | |
269 } | |
270 | |
271 void SkIntersections::dump() const { | |
272 SkDebugf("used=%d of %d", fUsed, fMax); | |
273 for (int index = 0; index < fUsed; ++index) { | |
274 SkDebugf(" t=(%s%1.9g,%s%1.9g) pt=(%1.9g,%1.9g)", | |
275 fIsCoincident[0] & (1 << index) ? "*" : "", fT[0][index], | |
276 fIsCoincident[1] & (1 << index) ? "*" : "", fT[1][index], | |
277 fPt[index].fX, fPt[index].fY); | |
278 if (index < 2 && fNearlySame[index]) { | |
279 SkDebugf(" pt2=(%1.9g,%1.9g)",fPt2[index].fX, fPt2[index].fY); | |
280 } | |
281 } | |
282 SkDebugf("\n"); | |
283 } | |
284 | |
285 const SkOpAngle* SkPathOpsDebug::DebugAngleAngle(const SkOpAngle* angle, int id)
{ | |
286 return angle->debugAngle(id); | |
287 } | |
288 | |
289 SkOpContour* SkPathOpsDebug::DebugAngleContour(SkOpAngle* angle, int id) { | |
290 return angle->debugContour(id); | |
291 } | |
292 | |
293 const SkOpPtT* SkPathOpsDebug::DebugAnglePtT(const SkOpAngle* angle, int id) { | |
294 return angle->debugPtT(id); | |
295 } | |
296 | |
297 const SkOpSegment* SkPathOpsDebug::DebugAngleSegment(const SkOpAngle* angle, int
id) { | |
298 return angle->debugSegment(id); | |
299 } | |
300 | |
301 const SkOpSpanBase* SkPathOpsDebug::DebugAngleSpan(const SkOpAngle* angle, int i
d) { | |
302 return angle->debugSpan(id); | |
303 } | |
304 | |
305 const SkOpAngle* SkPathOpsDebug::DebugContourAngle(SkOpContour* contour, int id)
{ | |
306 return contour->debugAngle(id); | |
307 } | |
308 | |
309 SkOpContour* SkPathOpsDebug::DebugContourContour(SkOpContour* contour, int id) { | |
310 return contour->debugContour(id); | |
311 } | |
312 | |
313 const SkOpPtT* SkPathOpsDebug::DebugContourPtT(SkOpContour* contour, int id) { | |
314 return contour->debugPtT(id); | |
315 } | |
316 | |
317 const SkOpSegment* SkPathOpsDebug::DebugContourSegment(SkOpContour* contour, int
id) { | |
318 return contour->debugSegment(id); | |
319 } | |
320 | |
321 const SkOpSpanBase* SkPathOpsDebug::DebugContourSpan(SkOpContour* contour, int i
d) { | |
322 return contour->debugSpan(id); | |
323 } | |
324 | |
325 const SkOpAngle* SkPathOpsDebug::DebugPtTAngle(const SkOpPtT* ptT, int id) { | |
326 return ptT->debugAngle(id); | |
327 } | |
328 | |
329 SkOpContour* SkPathOpsDebug::DebugPtTContour(SkOpPtT* ptT, int id) { | |
330 return ptT->debugContour(id); | |
331 } | |
332 | |
333 const SkOpPtT* SkPathOpsDebug::DebugPtTPtT(const SkOpPtT* ptT, int id) { | |
334 return ptT->debugPtT(id); | |
335 } | |
336 | |
337 const SkOpSegment* SkPathOpsDebug::DebugPtTSegment(const SkOpPtT* ptT, int id) { | |
338 return ptT->debugSegment(id); | |
339 } | |
340 | |
341 const SkOpSpanBase* SkPathOpsDebug::DebugPtTSpan(const SkOpPtT* ptT, int id) { | |
342 return ptT->debugSpan(id); | |
343 } | |
344 | |
345 const SkOpAngle* SkPathOpsDebug::DebugSegmentAngle(const SkOpSegment* span, int
id) { | |
346 return span->debugAngle(id); | |
347 } | |
348 | |
349 SkOpContour* SkPathOpsDebug::DebugSegmentContour(SkOpSegment* span, int id) { | |
350 return span->debugContour(id); | |
351 } | |
352 | |
353 const SkOpPtT* SkPathOpsDebug::DebugSegmentPtT(const SkOpSegment* span, int id)
{ | |
354 return span->debugPtT(id); | |
355 } | |
356 | |
357 const SkOpSegment* SkPathOpsDebug::DebugSegmentSegment(const SkOpSegment* span,
int id) { | |
358 return span->debugSegment(id); | |
359 } | |
360 | |
361 const SkOpSpanBase* SkPathOpsDebug::DebugSegmentSpan(const SkOpSegment* span, in
t id) { | |
362 return span->debugSpan(id); | |
363 } | |
364 | |
365 const SkOpAngle* SkPathOpsDebug::DebugSpanAngle(const SkOpSpanBase* span, int id
) { | |
366 return span->debugAngle(id); | |
367 } | |
368 | |
369 SkOpContour* SkPathOpsDebug::DebugSpanContour(SkOpSpanBase* span, int id) { | |
370 return span->debugContour(id); | |
371 } | |
372 | |
373 const SkOpPtT* SkPathOpsDebug::DebugSpanPtT(const SkOpSpanBase* span, int id) { | |
374 return span->debugPtT(id); | |
375 } | |
376 | |
377 const SkOpSegment* SkPathOpsDebug::DebugSpanSegment(const SkOpSpanBase* span, in
t id) { | |
378 return span->debugSegment(id); | |
379 } | |
380 | |
381 const SkOpSpanBase* SkPathOpsDebug::DebugSpanSpan(const SkOpSpanBase* span, int
id) { | |
382 return span->debugSpan(id); | |
383 } | |
384 | |
385 void SkPathOpsDebug::DumpContours(SkTDArray<SkOpContour* >* contours) { | |
386 int count = contours->count(); | |
387 for (int index = 0; index < count; ++index) { | |
388 (*contours)[index]->dump(); | |
389 } | |
390 } | |
391 | |
392 void SkPathOpsDebug::DumpContoursAll(SkTDArray<SkOpContour* >* contours) { | |
393 int count = contours->count(); | |
394 for (int index = 0; index < count; ++index) { | |
395 (*contours)[index]->dumpAll(); | |
396 } | |
397 } | |
398 | |
399 void SkPathOpsDebug::DumpContoursAngles(const SkTDArray<SkOpContour* >* contours
) { | |
400 int count = contours->count(); | |
401 for (int index = 0; index < count; ++index) { | |
402 (*contours)[index]->dumpAngles(); | |
403 } | |
404 } | |
405 | |
406 void SkPathOpsDebug::DumpContoursPts(const SkTDArray<SkOpContour* >* contours) { | |
407 int count = contours->count(); | |
408 for (int index = 0; index < count; ++index) { | |
409 (*contours)[index]->dumpPts(); | |
410 } | |
411 } | |
412 | |
413 void SkPathOpsDebug::DumpContoursPt(const SkTDArray<SkOpContour* >* contours, in
t segmentID) { | |
414 int count = contours->count(); | |
415 for (int index = 0; index < count; ++index) { | |
416 (*contours)[index]->dumpPt(segmentID); | |
417 } | |
418 } | |
419 | |
420 void SkPathOpsDebug::DumpContoursSegment(const SkTDArray<SkOpContour* >* contour
s, | |
421 int segmentID) { | |
422 if (contours->count()) { | |
423 (*contours)[0]->dumpSegment(segmentID); | |
424 } | |
425 } | |
426 | |
427 void SkPathOpsDebug::DumpContoursSpan(const SkTDArray<SkOpContour* >* contours, | |
428 int spanID) { | |
429 if (contours->count()) { | |
430 (*contours)[0]->dumpSpan(spanID); | |
431 } | |
432 } | |
433 | |
434 void SkPathOpsDebug::DumpContoursSpans(const SkTDArray<SkOpContour* >* contours)
{ | |
435 int count = contours->count(); | |
436 for (int index = 0; index < count; ++index) { | |
437 (*contours)[index]->dumpSpans(); | |
438 } | |
439 } | |
440 | |
441 const SkTSpan<SkDCubic>* DebugSpan(const SkTSect<SkDCubic>* sect, int id) { | |
442 return sect->debugSpan(id); | |
443 } | |
444 | |
445 const SkTSpan<SkDQuad>* DebugSpan(const SkTSect<SkDQuad>* sect, int id) { | |
446 return sect->debugSpan(id); | |
447 } | |
448 | |
449 const SkTSpan<SkDCubic>* DebugT(const SkTSect<SkDCubic>* sect, double t) { | |
450 return sect->debugT(t); | |
451 } | |
452 | |
453 const SkTSpan<SkDQuad>* DebugT(const SkTSect<SkDQuad>* sect, double t) { | |
454 return sect->debugT(t); | |
455 } | |
456 | |
457 const SkTSpan<SkDCubic>* DebugSpan(const SkTSpan<SkDCubic>* span, int id) { | |
458 return span->debugSpan(id); | |
459 } | |
460 | |
461 const SkTSpan<SkDQuad>* DebugSpan(const SkTSpan<SkDQuad>* span, int id) { | |
462 return span->debugSpan(id); | |
463 } | |
464 | |
465 const SkTSpan<SkDCubic>* DebugT(const SkTSpan<SkDCubic>* span, double t) { | |
466 return span->debugT(t); | |
467 } | |
468 | |
469 const SkTSpan<SkDQuad>* DebugT(const SkTSpan<SkDQuad>* span, double t) { | |
470 return span->debugT(t); | |
471 } | |
472 | |
473 void Dump(const SkTSect<SkDCubic>* sect) { | |
474 sect->dump(); | |
475 } | |
476 | |
477 void Dump(const SkTSect<SkDQuad>* sect) { | |
478 sect->dump(); | |
479 } | |
480 | |
481 void Dump(const SkTSpan<SkDCubic>* span) { | |
482 span->dump(); | |
483 } | |
484 | |
485 void Dump(const SkTSpan<SkDQuad>* span) { | |
486 span->dump(); | |
487 } | |
488 | |
489 void DumpBoth(SkTSect<SkDCubic>* sect1, SkTSect<SkDCubic>* sect2) { | |
490 sect1->dumpBoth(sect2); | |
491 } | |
492 | |
493 void DumpBoth(SkTSect<SkDQuad>* sect1, SkTSect<SkDQuad>* sect2) { | |
494 sect1->dumpBoth(sect2); | |
495 } | |
496 | |
497 void DumpCoin(SkTSect<SkDCubic>* sect1) { | |
498 sect1->dumpCoin(); | |
499 } | |
500 | |
501 void DumpCoin(SkTSect<SkDQuad>* sect1) { | |
502 sect1->dumpCoin(); | |
503 } | |
504 | |
505 void DumpCoinCurves(SkTSect<SkDCubic>* sect1) { | |
506 sect1->dumpCoinCurves(); | |
507 } | |
508 | |
509 void DumpCoinCurves(SkTSect<SkDQuad>* sect1) { | |
510 sect1->dumpCoinCurves(); | |
511 } | |
512 | |
513 void DumpCurves(const SkTSect<SkDQuad>* sect) { | |
514 sect->dumpCurves(); | |
515 } | |
516 | |
517 void DumpCurves(const SkTSect<SkDCubic>* sect) { | |
518 sect->dumpCurves(); | |
519 } | |
520 | |
521 static void dumpTestCase(const SkDQuad& quad1, const SkDQuad& quad2, int testNo)
{ | |
522 SkDebugf("\n<div id=\"quad%d\">\n", testNo); | |
523 quad1.dumpInner(); | |
524 SkDebugf("}}, "); | |
525 quad2.dump(); | |
526 SkDebugf("</div>\n\n"); | |
527 } | |
528 | |
529 static void dumpTestTrailer() { | |
530 SkDebugf("</div>\n\n<script type=\"text/javascript\">\n\n"); | |
531 SkDebugf(" var testDivs = [\n"); | |
532 } | |
533 | |
534 static void dumpTestList(int testNo, double min) { | |
535 SkDebugf(" quad%d,", testNo); | |
536 if (min > 0) { | |
537 SkDebugf(" // %1.9g", min); | |
538 } | |
539 SkDebugf("\n"); | |
540 } | |
541 | |
542 void DumpQ(const SkDQuad& quad1, const SkDQuad& quad2, int testNo) { | |
543 SkDebugf("\n"); | |
544 dumpTestCase(quad1, quad2, testNo); | |
545 dumpTestTrailer(); | |
546 dumpTestList(testNo, 0); | |
547 SkDebugf("\n"); | |
548 } | |
549 | |
550 void DumpT(const SkDQuad& quad, double t) { | |
551 SkDLine line = {{quad.ptAtT(t), quad[0]}}; | |
552 line.dump(); | |
553 } | |
554 | |
555 const SkOpAngle* SkOpAngle::debugAngle(int id) const { | |
556 return this->segment()->debugAngle(id); | |
557 } | |
558 | |
559 SkOpContour* SkOpAngle::debugContour(int id) { | |
560 return this->segment()->debugContour(id); | |
561 } | |
562 | |
563 const SkOpPtT* SkOpAngle::debugPtT(int id) const { | |
564 return this->segment()->debugPtT(id); | |
565 } | |
566 | |
567 const SkOpSegment* SkOpAngle::debugSegment(int id) const { | |
568 return this->segment()->debugSegment(id); | |
569 } | |
570 | |
571 const SkOpSpanBase* SkOpAngle::debugSpan(int id) const { | |
572 return this->segment()->debugSpan(id); | |
573 } | |
574 | |
575 void SkOpAngle::dump() const { | 171 void SkOpAngle::dump() const { |
576 dumpOne(true); | 172 dumpOne(true); |
577 SkDebugf("\n"); | 173 SkDebugf("\n"); |
578 } | 174 } |
579 | 175 |
580 void SkOpAngle::dumpOne(bool functionHeader) const { | 176 void SkOpAngle::dumpOne(bool functionHeader) const { |
581 // fSegment->debugValidate(); | 177 // fSegment->debugValidate(); |
582 const SkOpSegment* segment = this->segment(); | 178 const SkOpSpan& mSpan = fSegment->span(SkMin32(fStart, fEnd)); |
583 const SkOpSpan& mSpan = *fStart->starter(fEnd); | |
584 if (functionHeader) { | 179 if (functionHeader) { |
585 SkDebugf("%s ", __FUNCTION__); | 180 SkDebugf("%s ", __FUNCTION__); |
586 } | 181 } |
587 SkDebugf("[%d", segment->debugID()); | 182 SkDebugf("[%d", fSegment->debugID()); |
588 SkDebugf("/%d", debugID()); | 183 SkDebugf("/%d", debugID()); |
589 SkDebugf("] next="); | 184 SkDebugf("] next="); |
590 if (fNext) { | 185 if (fNext) { |
591 SkDebugf("%d", fNext->fStart->segment()->debugID()); | 186 SkDebugf("%d", fNext->fSegment->debugID()); |
592 SkDebugf("/%d", fNext->debugID()); | 187 SkDebugf("/%d", fNext->debugID()); |
593 } else { | 188 } else { |
594 SkDebugf("?"); | 189 SkDebugf("?"); |
595 } | 190 } |
596 SkDebugf(" sect=%d/%d ", fSectorStart, fSectorEnd); | 191 SkDebugf(" sect=%d/%d ", fSectorStart, fSectorEnd); |
597 SkDebugf(" s=%1.9g [%d] e=%1.9g [%d]", fStart->t(), fStart->debugID(), | 192 SkDebugf(" s=%1.9g [%d] e=%1.9g [%d]", fSegment->span(fStart).fT, fStart, |
598 fEnd->t(), fEnd->debugID()); | 193 fSegment->span(fEnd).fT, fEnd); |
599 SkDebugf(" sgn=%d windVal=%d", this->sign(), mSpan.windValue()); | 194 SkDebugf(" sgn=%d windVal=%d", sign(), mSpan.fWindValue); |
600 | 195 |
601 SkDebugf(" windSum="); | 196 SkDebugf(" windSum="); |
602 SkPathOpsDebug::WindingPrintf(mSpan.windSum()); | 197 SkPathOpsDebug::WindingPrintf(mSpan.fWindSum); |
603 if (mSpan.oppValue() != 0 || mSpan.oppSum() != SK_MinS32) { | 198 if (mSpan.fOppValue != 0 || mSpan.fOppSum != SK_MinS32) { |
604 SkDebugf(" oppVal=%d", mSpan.oppValue()); | 199 SkDebugf(" oppVal=%d", mSpan.fOppValue); |
605 SkDebugf(" oppSum="); | 200 SkDebugf(" oppSum="); |
606 SkPathOpsDebug::WindingPrintf(mSpan.oppSum()); | 201 SkPathOpsDebug::WindingPrintf(mSpan.fOppSum); |
607 } | 202 } |
608 if (mSpan.done()) { | 203 if (mSpan.fDone) { |
609 SkDebugf(" done"); | 204 SkDebugf(" done"); |
610 } | 205 } |
611 if (unorderable()) { | 206 if (unorderable()) { |
612 SkDebugf(" unorderable"); | 207 SkDebugf(" unorderable"); |
613 } | 208 } |
614 if (segment->operand()) { | 209 if (small()) { |
| 210 SkDebugf(" small"); |
| 211 } |
| 212 if (mSpan.fTiny) { |
| 213 SkDebugf(" tiny"); |
| 214 } |
| 215 if (fSegment->operand()) { |
615 SkDebugf(" operand"); | 216 SkDebugf(" operand"); |
616 } | 217 } |
617 if (fStop) { | 218 if (fStop) { |
618 SkDebugf(" stop"); | 219 SkDebugf(" stop"); |
619 } | 220 } |
620 } | 221 } |
621 | 222 |
622 void SkOpAngle::dumpTo(const SkOpSegment* segment, const SkOpAngle* to) const { | 223 void SkOpAngle::dumpTo(const SkOpSegment* segment, const SkOpAngle* to) const { |
623 const SkOpAngle* first = this; | 224 const SkOpAngle* first = this; |
624 const SkOpAngle* next = this; | 225 const SkOpAngle* next = this; |
625 const char* indent = ""; | 226 const char* indent = ""; |
626 do { | 227 do { |
627 SkDebugf("%s", indent); | 228 SkDebugf("%s", indent); |
628 next->dumpOne(false); | 229 next->dumpOne(false); |
629 if (segment == next->fStart->segment()) { | 230 if (segment == next->fSegment) { |
630 if (this == fNext) { | 231 if (this == fNext) { |
631 SkDebugf(" << from"); | 232 SkDebugf(" << from"); |
632 } | 233 } |
633 if (to == fNext) { | 234 if (to == fNext) { |
634 SkDebugf(" << to"); | 235 SkDebugf(" << to"); |
635 } | 236 } |
636 } | 237 } |
637 SkDebugf("\n"); | 238 SkDebugf("\n"); |
638 indent = " "; | 239 indent = " "; |
639 next = next->fNext; | 240 next = next->fNext; |
640 } while (next && next != first); | 241 } while (next && next != first); |
641 } | 242 } |
642 | |
643 void SkOpAngle::dumpCurves() const { | |
644 const SkOpAngle* first = this; | |
645 const SkOpAngle* next = this; | |
646 do { | |
647 next->fCurvePart.dumpID(next->segment()->debugID()); | |
648 next = next->fNext; | |
649 } while (next && next != first); | |
650 } | |
651 | 243 |
652 void SkOpAngle::dumpLoop() const { | 244 void SkOpAngle::dumpLoop() const { |
653 const SkOpAngle* first = this; | 245 const SkOpAngle* first = this; |
654 const SkOpAngle* next = this; | 246 const SkOpAngle* next = this; |
655 do { | 247 do { |
656 next->dumpOne(false); | 248 next->dumpOne(false); |
657 SkDebugf("\n"); | 249 SkDebugf("\n"); |
658 next = next->fNext; | 250 next = next->fNext; |
659 } while (next && next != first); | 251 } while (next && next != first); |
660 } | 252 } |
661 | 253 |
662 void SkOpAngle::dumpTest() const { | 254 void SkOpAngle::dumpPartials() const { |
663 const SkOpAngle* first = this; | 255 const SkOpAngle* first = this; |
664 const SkOpAngle* next = this; | 256 const SkOpAngle* next = this; |
665 do { | 257 do { |
666 SkDebugf("{ "); | 258 next->fCurvePart.dumpNumber(); |
667 SkOpSegment* segment = next->segment(); | |
668 segment->dumpPts(); | |
669 SkDebugf(", %d, %1.9g, %1.9g, {} },\n", SkPathOpsVerbToPoints(segment->v
erb()) + 1, | |
670 next->start()->t(), next->end()->t()); | |
671 next = next->fNext; | 259 next = next->fNext; |
672 } while (next && next != first); | 260 } while (next && next != first); |
673 } | 261 } |
674 | 262 |
675 bool SkOpPtT::debugMatchID(int id) const { | 263 void SkOpAngleSet::dump() const { |
676 int limit = this->debugLoopLimit(false); | 264 // FIXME: unimplemented |
677 int loop = 0; | 265 /* This requires access to the internal SkChunkAlloc data |
678 const SkOpPtT* ptT = this; | 266 Defer implementing this until it is needed for debugging |
679 do { | 267 */ |
680 if (ptT->debugID() == id) { | 268 SkASSERT(0); |
681 return true; | 269 } |
682 } | 270 |
683 } while ((!limit || ++loop <= limit) && (ptT = ptT->next()) && ptT != this); | 271 void SkOpContour::dump() const { |
684 return false; | 272 int segmentCount = fSegments.count(); |
685 } | 273 SkDebugf("((SkOpContour*) 0x%p) [%d]\n", this, debugID()); |
686 | 274 for (int test = 0; test < segmentCount; ++test) { |
687 const SkOpAngle* SkOpPtT::debugAngle(int id) const { | 275 SkDebugf(" [%d] ((SkOpSegment*) 0x%p) [%d]\n", test, &fSegments[test], |
688 return this->span()->debugAngle(id); | 276 fSegments[test].debugID()); |
689 } | 277 } |
690 | 278 } |
691 SkOpContour* SkOpPtT::debugContour(int id) { | 279 |
692 return this->span()->debugContour(id); | 280 void SkOpContour::dumpAngles() const { |
693 } | 281 int segmentCount = fSegments.count(); |
694 | 282 SkDebugf("((SkOpContour*) 0x%p) [%d]\n", this, debugID()); |
695 const SkOpPtT* SkOpPtT::debugPtT(int id) const { | 283 for (int test = 0; test < segmentCount; ++test) { |
696 return this->span()->debugPtT(id); | 284 SkDebugf(" [%d] ", test); |
697 } | 285 fSegments[test].dumpAngles(); |
698 | 286 } |
699 const SkOpSegment* SkOpPtT::debugSegment(int id) const { | 287 } |
700 return this->span()->debugSegment(id); | 288 |
701 } | 289 void SkOpContour::dumpCoincidence(const SkCoincidence& coin) const { |
702 | 290 int thisIndex = coin.fSegments[0]; |
703 const SkOpSpanBase* SkOpPtT::debugSpan(int id) const { | 291 const SkOpSegment& s1 = fSegments[thisIndex]; |
704 return this->span()->debugSpan(id); | 292 int otherIndex = coin.fSegments[1]; |
705 } | 293 const SkOpSegment& s2 = coin.fOther->fSegments[otherIndex]; |
706 | 294 SkDebugf("((SkOpSegment*) 0x%p) [%d] ((SkOpSegment*) 0x%p) [%d]\n", &s1, s1
.debugID(), |
707 void SkOpPtT::dump() const { | 295 &s2, s2.debugID()); |
708 SkDebugf("seg=%d span=%d ptT=%d", | 296 for (int index = 0; index < 2; ++index) { |
709 this->segment()->debugID(), this->span()->debugID(), this->debugID()
); | 297 SkDebugf(" {%1.9gf, %1.9gf}", coin.fPts[0][index].fX, coin.fPts[0][in
dex].fY); |
710 this->dumpBase(); | 298 if (coin.fNearly[index]) { |
711 SkDebugf("\n"); | 299 SkDebugf(" {%1.9gf, %1.9gf}", coin.fPts[1][index].fX, coin.fPts[1
][index].fY); |
712 } | 300 } |
713 | 301 SkDebugf(" seg1t=%1.9g seg2t=%1.9g\n", coin.fTs[0][index], coin.fTs[1][
index]); |
714 void SkOpPtT::dumpAll() const { | 302 } |
715 contour()->indentDump(); | 303 } |
716 const SkOpPtT* next = this; | 304 |
717 int limit = debugLoopLimit(true); | 305 void SkOpContour::dumpCoincidences() const { |
718 int loop = 0; | 306 int count = fCoincidences.count(); |
719 do { | 307 if (count > 0) { |
720 SkDebugf("%.*s", contour()->debugIndent(), " "); | 308 SkDebugf("fCoincidences count=%d\n", count); |
721 SkDebugf("seg=%d span=%d ptT=%d", | 309 for (int test = 0; test < count; ++test) { |
722 next->segment()->debugID(), next->span()->debugID(), next->debug
ID()); | 310 dumpCoincidence(fCoincidences[test]); |
723 next->dumpBase(); | 311 } |
724 SkDebugf("\n"); | 312 } |
725 if (limit && ++loop >= limit) { | 313 count = fPartialCoincidences.count(); |
726 SkDebugf("*** abort loop ***\n"); | 314 if (count == 0) { |
727 break; | |
728 } | |
729 } while ((next = next->fNext) && next != this); | |
730 contour()->outdentDump(); | |
731 } | |
732 | |
733 void SkOpPtT::dumpBase() const { | |
734 SkDebugf(" t=%1.9g pt=(%1.9g,%1.9g)%s%s", this->fT, this->fPt.fX, this->fPt.
fY, | |
735 this->fDuplicatePt ? " dup" : "", this->fDeleted ? " deleted" : ""); | |
736 } | |
737 | |
738 const SkOpAngle* SkOpSpanBase::debugAngle(int id) const { | |
739 return this->segment()->debugAngle(id); | |
740 } | |
741 | |
742 SkOpContour* SkOpSpanBase::debugContour(int id) { | |
743 return this->segment()->debugContour(id); | |
744 } | |
745 | |
746 const SkOpPtT* SkOpSpanBase::debugPtT(int id) const { | |
747 return this->segment()->debugPtT(id); | |
748 } | |
749 | |
750 const SkOpSegment* SkOpSpanBase::debugSegment(int id) const { | |
751 return this->segment()->debugSegment(id); | |
752 } | |
753 | |
754 const SkOpSpanBase* SkOpSpanBase::debugSpan(int id) const { | |
755 return this->segment()->debugSpan(id); | |
756 } | |
757 | |
758 void SkOpSpanBase::dump() const { | |
759 this->dumpAll(); | |
760 SkDebugf("\n"); | |
761 } | |
762 | |
763 void SkOpSpanBase::dumpAll() const { | |
764 SkDebugf("%.*s", contour()->debugIndent(), " "); | |
765 SkDebugf("seg=%d span=%d", this->segment()->debugID(), this->debugID()); | |
766 this->dumpBase(); | |
767 SkDebugf("\n"); | |
768 this->fPtT.dumpAll(); | |
769 } | |
770 | |
771 void SkOpSpanBase::dumpBase() const { | |
772 if (this->fAligned) { | |
773 SkDebugf(" aligned"); | |
774 } | |
775 if (this->fChased) { | |
776 SkDebugf(" chased"); | |
777 } | |
778 if (!this->final()) { | |
779 this->upCast()->dumpSpan(); | |
780 } | |
781 const SkOpSpanBase* coin = this->coinEnd(); | |
782 if (this != coin) { | |
783 SkDebugf(" coinEnd seg/span=%d/%d", coin->segment()->debugID(), coin->de
bugID()); | |
784 } else if (this->final() || !this->upCast()->isCoincident()) { | |
785 const SkOpPtT* oPt = this->ptT()->next(); | |
786 SkDebugf(" seg/span=%d/%d", oPt->segment()->debugID(), oPt->span()->debu
gID()); | |
787 } | |
788 } | |
789 | |
790 void SkOpSpanBase::dumpCoin() const { | |
791 const SkOpSpan* span = this->upCastable(); | |
792 if (!span) { | |
793 return; | 315 return; |
794 } | 316 } |
795 if (!span->isCoincident()) { | 317 SkDebugf("fPartialCoincidences count=%d\n", count); |
| 318 for (int test = 0; test < count; ++test) { |
| 319 dumpCoincidence(fPartialCoincidences[test]); |
| 320 } |
| 321 } |
| 322 |
| 323 void SkOpContour::dumpPt(int index) const { |
| 324 int segmentCount = fSegments.count(); |
| 325 for (int test = 0; test < segmentCount; ++test) { |
| 326 const SkOpSegment& segment = fSegments[test]; |
| 327 if (segment.debugID() == index) { |
| 328 fSegments[test].dumpPts(); |
| 329 } |
| 330 } |
| 331 } |
| 332 |
| 333 void SkOpContour::dumpPts() const { |
| 334 int segmentCount = fSegments.count(); |
| 335 SkDebugf("((SkOpContour*) 0x%p) [%d]\n", this, debugID()); |
| 336 for (int test = 0; test < segmentCount; ++test) { |
| 337 SkDebugf(" [%d] ", test); |
| 338 fSegments[test].dumpPts(); |
| 339 } |
| 340 } |
| 341 |
| 342 void SkOpContour::dumpSpan(int index) const { |
| 343 int segmentCount = fSegments.count(); |
| 344 for (int test = 0; test < segmentCount; ++test) { |
| 345 const SkOpSegment& segment = fSegments[test]; |
| 346 if (segment.debugID() == index) { |
| 347 fSegments[test].dumpSpans(); |
| 348 } |
| 349 } |
| 350 } |
| 351 |
| 352 void SkOpContour::dumpSpans() const { |
| 353 int segmentCount = fSegments.count(); |
| 354 SkDebugf("((SkOpContour*) 0x%p) [%d]\n", this, debugID()); |
| 355 for (int test = 0; test < segmentCount; ++test) { |
| 356 SkDebugf(" [%d] ", test); |
| 357 fSegments[test].dumpSpans(); |
| 358 } |
| 359 } |
| 360 |
| 361 void SkDCubic::dump() const { |
| 362 SkDebugf("{{"); |
| 363 int index = 0; |
| 364 do { |
| 365 fPts[index].dump(); |
| 366 SkDebugf(", "); |
| 367 } while (++index < 3); |
| 368 fPts[index].dump(); |
| 369 SkDebugf("}}\n"); |
| 370 } |
| 371 |
| 372 void SkDCubic::dumpNumber() const { |
| 373 SkDebugf("{{"); |
| 374 int index = 0; |
| 375 bool dumpedOne = false; |
| 376 do { |
| 377 if (!(fPts[index].fX == fPts[index].fX && fPts[index].fY == fPts[index].
fY)) { |
| 378 continue; |
| 379 } |
| 380 if (dumpedOne) { |
| 381 SkDebugf(", "); |
| 382 } |
| 383 fPts[index].dump(); |
| 384 dumpedOne = true; |
| 385 } while (++index < 3); |
| 386 if (fPts[index].fX == fPts[index].fX && fPts[index].fY == fPts[index].fY) { |
| 387 if (dumpedOne) { |
| 388 SkDebugf(", "); |
| 389 } |
| 390 fPts[index].dump(); |
| 391 } |
| 392 SkDebugf("}}\n"); |
| 393 } |
| 394 |
| 395 void SkDLine::dump() const { |
| 396 SkDebugf("{{"); |
| 397 fPts[0].dump(); |
| 398 SkDebugf(", "); |
| 399 fPts[1].dump(); |
| 400 SkDebugf("}}\n"); |
| 401 } |
| 402 |
| 403 void SkDPoint::dump() const { |
| 404 SkDebugf("{"); |
| 405 DebugDumpDouble(fX); |
| 406 SkDebugf(", "); |
| 407 DebugDumpDouble(fY); |
| 408 SkDebugf("}"); |
| 409 } |
| 410 |
| 411 void SkDPoint::Dump(const SkPoint& pt) { |
| 412 SkDebugf("{"); |
| 413 DebugDumpFloat(pt.fX); |
| 414 SkDebugf(", "); |
| 415 DebugDumpFloat(pt.fY); |
| 416 SkDebugf("}"); |
| 417 } |
| 418 |
| 419 void SkDPoint::DumpHex(const SkPoint& pt) { |
| 420 SkDebugf("{"); |
| 421 DebugDumpHexFloat(pt.fX); |
| 422 SkDebugf(", "); |
| 423 DebugDumpHexFloat(pt.fY); |
| 424 SkDebugf("}"); |
| 425 } |
| 426 |
| 427 void SkDQuad::dump() const { |
| 428 dumpComma(""); |
| 429 } |
| 430 |
| 431 void SkDQuad::dumpComma(const char* comma) const { |
| 432 SkDebugf("{{"); |
| 433 int index = 0; |
| 434 do { |
| 435 fPts[index].dump(); |
| 436 SkDebugf(", "); |
| 437 } while (++index < 2); |
| 438 fPts[index].dump(); |
| 439 SkDebugf("}}%s\n", comma ? comma : ""); |
| 440 } |
| 441 |
| 442 void SkIntersectionHelper::dump() const { |
| 443 SkDPoint::Dump(pts()[0]); |
| 444 SkDPoint::Dump(pts()[1]); |
| 445 if (verb() >= SkPath::kQuad_Verb) { |
| 446 SkDPoint::Dump(pts()[2]); |
| 447 } |
| 448 if (verb() >= SkPath::kCubic_Verb) { |
| 449 SkDPoint::Dump(pts()[3]); |
| 450 } |
| 451 } |
| 452 |
| 453 const SkTDArray<SkOpSpan>& SkOpSegment::debugSpans() const { |
| 454 return fTs; |
| 455 } |
| 456 |
| 457 void SkOpSegment::dumpAngles() const { |
| 458 SkDebugf("((SkOpSegment*) 0x%p) [%d]\n", this, debugID()); |
| 459 const SkOpAngle* fromAngle = NULL; |
| 460 const SkOpAngle* toAngle = NULL; |
| 461 for (int index = 0; index < count(); ++index) { |
| 462 const SkOpAngle* fAngle = fTs[index].fFromAngle; |
| 463 const SkOpAngle* tAngle = fTs[index].fToAngle; |
| 464 if (fromAngle == fAngle && toAngle == tAngle) { |
| 465 continue; |
| 466 } |
| 467 if (fAngle) { |
| 468 SkDebugf(" [%d] from=%d ", index, fAngle->debugID()); |
| 469 fAngle->dumpTo(this, tAngle); |
| 470 } |
| 471 if (tAngle) { |
| 472 SkDebugf(" [%d] to=%d ", index, tAngle->debugID()); |
| 473 tAngle->dumpTo(this, fAngle); |
| 474 } |
| 475 fromAngle = fAngle; |
| 476 toAngle = tAngle; |
| 477 } |
| 478 } |
| 479 |
| 480 void SkOpSegment::dumpContour(int firstID, int lastID) const { |
| 481 if (debugID() < 0) { |
796 return; | 482 return; |
797 } | 483 } |
798 span->dumpCoin(); | 484 const SkOpSegment* test = this - (debugID() - 1); |
799 } | 485 test += (firstID - 1); |
800 | 486 const SkOpSegment* last = test + (lastID - firstID); |
801 void SkOpSpan::dumpCoin() const { | 487 while (test <= last) { |
802 const SkOpSpan* coincident = fCoincident; | 488 test->dumpSpans(); |
803 bool ok = debugCoinLoopCheck(); | 489 ++test; |
804 this->dump(); | 490 } |
805 int loop = 0; | |
806 do { | |
807 coincident->dump(); | |
808 if (!ok && ++loop > 10) { | |
809 SkDebugf("*** abort loop ***\n"); | |
810 break; | |
811 } | |
812 } while ((coincident = coincident->fCoincident) != this); | |
813 } | |
814 | |
815 bool SkOpSpan::dumpSpan() const { | |
816 SkOpSpan* coin = fCoincident; | |
817 if (this != coin) { | |
818 SkDebugf(" coinStart seg/span=%d/%d", coin->segment()->debugID(), coin->
debugID()); | |
819 } | |
820 SkDebugf(" windVal=%d", this->windValue()); | |
821 SkDebugf(" windSum="); | |
822 SkPathOpsDebug::WindingPrintf(this->windSum()); | |
823 if (this->oppValue() != 0 || this->oppSum() != SK_MinS32) { | |
824 SkDebugf(" oppVal=%d", this->oppValue()); | |
825 SkDebugf(" oppSum="); | |
826 SkPathOpsDebug::WindingPrintf(this->oppSum()); | |
827 } | |
828 if (this->done()) { | |
829 SkDebugf(" done"); | |
830 } | |
831 return this != coin; | |
832 } | |
833 | |
834 const SkOpAngle* SkOpSegment::debugAngle(int id) const { | |
835 return this->contour()->debugAngle(id); | |
836 } | |
837 | |
838 SkOpContour* SkOpSegment::debugContour(int id) { | |
839 return this->contour()->debugContour(id); | |
840 } | |
841 | |
842 const SkOpPtT* SkOpSegment::debugPtT(int id) const { | |
843 return this->contour()->debugPtT(id); | |
844 } | |
845 | |
846 const SkOpSegment* SkOpSegment::debugSegment(int id) const { | |
847 return this->contour()->debugSegment(id); | |
848 } | |
849 | |
850 const SkOpSpanBase* SkOpSegment::debugSpan(int id) const { | |
851 return this->contour()->debugSpan(id); | |
852 } | |
853 | |
854 void SkOpSegment::dump() const { | |
855 SkDebugf("%.*s", contour()->debugIndent(), " "); | |
856 this->dumpPts(); | |
857 const SkOpSpanBase* span = &fHead; | |
858 contour()->indentDump(); | |
859 do { | |
860 SkDebugf("%.*s span=%d ", contour()->debugIndent(), " ", span->de
bugID()); | |
861 span->ptT()->dumpBase(); | |
862 span->dumpBase(); | |
863 SkDebugf("\n"); | |
864 } while (!span->final() && (span = span->upCast()->next())); | |
865 contour()->outdentDump(); | |
866 } | |
867 | |
868 void SkOpSegment::dumpAll() const { | |
869 SkDebugf("%.*s", contour()->debugIndent(), " "); | |
870 this->dumpPts(); | |
871 const SkOpSpanBase* span = &fHead; | |
872 contour()->indentDump(); | |
873 do { | |
874 span->dumpAll(); | |
875 } while (!span->final() && (span = span->upCast()->next())); | |
876 contour()->outdentDump(); | |
877 } | |
878 | |
879 void SkOpSegment::dumpAngles() const { | |
880 SkDebugf("seg=%d\n", debugID()); | |
881 const SkOpSpanBase* span = &fHead; | |
882 do { | |
883 const SkOpAngle* fAngle = span->fromAngle(); | |
884 const SkOpAngle* tAngle = span->final() ? NULL : span->upCast()->toAngle
(); | |
885 if (fAngle) { | |
886 SkDebugf(" span=%d from=%d ", span->debugID(), fAngle->debugID()); | |
887 fAngle->dumpTo(this, tAngle); | |
888 } | |
889 if (tAngle) { | |
890 SkDebugf(" span=%d to=%d ", span->debugID(), tAngle->debugID()); | |
891 tAngle->dumpTo(this, fAngle); | |
892 } | |
893 } while (!span->final() && (span = span->upCast()->next())); | |
894 } | |
895 | |
896 void SkOpSegment::dumpCoin() const { | |
897 const SkOpSpan* span = &fHead; | |
898 do { | |
899 span->dumpCoin(); | |
900 } while ((span = span->next()->upCastable())); | |
901 } | 491 } |
902 | 492 |
903 void SkOpSegment::dumpPts() const { | 493 void SkOpSegment::dumpPts() const { |
904 int last = SkPathOpsVerbToPoints(fVerb); | 494 int last = SkPathOpsVerbToPoints(fVerb); |
905 SkDebugf("seg=%d {{", this->debugID()); | 495 SkDebugf("((SkOpSegment*) 0x%p) [%d] {{", this, debugID()); |
906 int index = 0; | 496 int index = 0; |
907 do { | 497 do { |
908 SkDPoint::Dump(fPts[index]); | 498 SkDPoint::Dump(fPts[index]); |
909 SkDebugf(", "); | 499 SkDebugf(", "); |
910 } while (++index < last); | 500 } while (++index < last); |
911 SkDPoint::Dump(fPts[index]); | 501 SkDPoint::Dump(fPts[index]); |
912 SkDebugf("}}\n"); | 502 SkDebugf("}}\n"); |
913 } | 503 } |
914 | 504 |
915 void SkCoincidentSpans::dump() const { | 505 void SkOpSegment::dumpHexPts() const { |
916 SkDebugf("- seg=%d span=%d ptT=%d ", fCoinPtTStart->segment()->debugID(), | 506 int last = SkPathOpsVerbToPoints(fVerb); |
917 fCoinPtTStart->span()->debugID(), fCoinPtTStart->debugID()); | 507 SkDebugf("((SkOpSegment*) 0x%p) [%d] {{", this, debugID()); |
918 fCoinPtTStart->dumpBase(); | 508 int index = 0; |
919 SkDebugf(" span=%d ptT=%d ", fCoinPtTEnd->span()->debugID(), fCoinPtTEnd->de
bugID()); | 509 do { |
920 fCoinPtTEnd->dumpBase(); | 510 SkDPoint::DumpHex(fPts[index]); |
921 if (fCoinPtTStart->segment()->operand()) { | 511 SkDebugf(", "); |
922 SkDebugf(" operand"); | 512 } while (++index < last); |
923 } | 513 SkDPoint::DumpHex(fPts[index]); |
924 if (fCoinPtTStart->segment()->isXor()) { | 514 SkDebugf("}}\n"); |
925 SkDebugf(" xor"); | 515 } |
| 516 |
| 517 void SkOpSegment::dumpDPts() const { |
| 518 int count = SkPathOpsVerbToPoints(fVerb); |
| 519 SkDebugf("((SkOpSegment*) 0x%p) [%d] {{", this, debugID()); |
| 520 int index = 0; |
| 521 do { |
| 522 SkDPoint dPt = {fPts[index].fX, fPts[index].fY}; |
| 523 dPt.dump(); |
| 524 if (index != count) { |
| 525 SkDebugf(", "); |
| 526 } |
| 527 } while (++index <= count); |
| 528 SkDebugf("}}\n"); |
| 529 } |
| 530 |
| 531 void SkOpSegment::dumpSpans() const { |
| 532 int count = this->count(); |
| 533 SkDebugf("((SkOpSegment*) 0x%p) [%d]\n", this, debugID()); |
| 534 for (int index = 0; index < count; ++index) { |
| 535 const SkOpSpan& span = this->span(index); |
| 536 SkDebugf(" [%d] ", index); |
| 537 span.dumpOne(); |
| 538 } |
| 539 } |
| 540 |
| 541 void SkPathOpsDebug::DumpCoincidence(const SkTArray<SkOpContour, true>& contours
) { |
| 542 int count = contours.count(); |
| 543 for (int index = 0; index < count; ++index) { |
| 544 contours[index].dumpCoincidences(); |
| 545 } |
| 546 } |
| 547 |
| 548 void SkPathOpsDebug::DumpCoincidence(const SkTArray<SkOpContour* , true>& contou
rs) { |
| 549 int count = contours.count(); |
| 550 for (int index = 0; index < count; ++index) { |
| 551 contours[index]->dumpCoincidences(); |
| 552 } |
| 553 } |
| 554 |
| 555 void SkPathOpsDebug::DumpContours(const SkTArray<SkOpContour, true>& contours) { |
| 556 int count = contours.count(); |
| 557 for (int index = 0; index < count; ++index) { |
| 558 contours[index].dump(); |
| 559 } |
| 560 } |
| 561 |
| 562 void SkPathOpsDebug::DumpContours(const SkTArray<SkOpContour* , true>& contours)
{ |
| 563 int count = contours.count(); |
| 564 for (int index = 0; index < count; ++index) { |
| 565 contours[index]->dump(); |
| 566 } |
| 567 } |
| 568 |
| 569 void SkPathOpsDebug::DumpContourAngles(const SkTArray<SkOpContour, true>& contou
rs) { |
| 570 int count = contours.count(); |
| 571 for (int index = 0; index < count; ++index) { |
| 572 contours[index].dumpAngles(); |
| 573 } |
| 574 } |
| 575 |
| 576 void SkPathOpsDebug::DumpContourAngles(const SkTArray<SkOpContour* , true>& cont
ours) { |
| 577 int count = contours.count(); |
| 578 for (int index = 0; index < count; ++index) { |
| 579 contours[index]->dumpAngles(); |
| 580 } |
| 581 } |
| 582 |
| 583 void SkPathOpsDebug::DumpContourPts(const SkTArray<SkOpContour, true>& contours)
{ |
| 584 int count = contours.count(); |
| 585 for (int index = 0; index < count; ++index) { |
| 586 contours[index].dumpPts(); |
| 587 } |
| 588 } |
| 589 |
| 590 void SkPathOpsDebug::DumpContourPts(const SkTArray<SkOpContour* , true>& contour
s) { |
| 591 int count = contours.count(); |
| 592 for (int index = 0; index < count; ++index) { |
| 593 contours[index]->dumpPts(); |
| 594 } |
| 595 } |
| 596 |
| 597 void SkPathOpsDebug::DumpContourPt(const SkTArray<SkOpContour, true>& contours,
int segmentID) { |
| 598 int count = contours.count(); |
| 599 for (int index = 0; index < count; ++index) { |
| 600 contours[index].dumpPt(segmentID); |
| 601 } |
| 602 } |
| 603 |
| 604 void SkPathOpsDebug::DumpContourPt(const SkTArray<SkOpContour* , true>& contours
, int segmentID) { |
| 605 int count = contours.count(); |
| 606 for (int index = 0; index < count; ++index) { |
| 607 contours[index]->dumpPt(segmentID); |
| 608 } |
| 609 } |
| 610 |
| 611 void SkPathOpsDebug::DumpContourSpans(const SkTArray<SkOpContour, true>& contour
s) { |
| 612 int count = contours.count(); |
| 613 for (int index = 0; index < count; ++index) { |
| 614 contours[index].dumpSpans(); |
| 615 } |
| 616 } |
| 617 |
| 618 void SkPathOpsDebug::DumpContourSpans(const SkTArray<SkOpContour* , true>& conto
urs) { |
| 619 int count = contours.count(); |
| 620 for (int index = 0; index < count; ++index) { |
| 621 contours[index]->dumpSpans(); |
| 622 } |
| 623 } |
| 624 |
| 625 void SkPathOpsDebug::DumpContourSpan(const SkTArray<SkOpContour, true>& contours
, int segmentID) { |
| 626 int count = contours.count(); |
| 627 for (int index = 0; index < count; ++index) { |
| 628 contours[index].dumpSpan(segmentID); |
| 629 } |
| 630 } |
| 631 |
| 632 void SkPathOpsDebug::DumpContourSpan(const SkTArray<SkOpContour* , true>& contou
rs, int segmentID) { |
| 633 int count = contours.count(); |
| 634 for (int index = 0; index < count; ++index) { |
| 635 contours[index]->dumpSpan(segmentID); |
| 636 } |
| 637 } |
| 638 |
| 639 void SkPathOpsDebug::DumpSpans(const SkTDArray<SkOpSpan *>& spans) { |
| 640 int count = spans.count(); |
| 641 for (int index = 0; index < count; ++index) { |
| 642 const SkOpSpan* span = spans[index]; |
| 643 const SkOpSpan& oSpan = span->fOther->span(span->fOtherIndex); |
| 644 const SkOpSegment* segment = oSpan.fOther; |
| 645 SkDebugf("((SkOpSegment*) 0x%p) [%d] ", segment, segment->debugID()); |
| 646 SkDebugf("spanIndex:%d ", oSpan.fOtherIndex); |
| 647 span->dumpOne(); |
| 648 } |
| 649 } |
| 650 |
| 651 // this does not require that other T index is initialized or correct |
| 652 const SkOpSegment* SkOpSpan::debugToSegment(ptrdiff_t* spanIndex) const { |
| 653 if (!fOther) { |
| 654 return NULL; |
| 655 } |
| 656 int oppCount = fOther->count(); |
| 657 for (int index = 0; index < oppCount; ++index) { |
| 658 const SkOpSpan& otherSpan = fOther->span(index); |
| 659 double otherTestT = otherSpan.fT; |
| 660 if (otherTestT < fOtherT) { |
| 661 continue; |
| 662 } |
| 663 SkASSERT(otherTestT == fOtherT); |
| 664 const SkOpSegment* candidate = otherSpan.fOther; |
| 665 const SkOpSpan* first = candidate->debugSpans().begin(); |
| 666 const SkOpSpan* last = candidate->debugSpans().end() - 1; |
| 667 if (first <= this && this <= last) { |
| 668 if (spanIndex) { |
| 669 *spanIndex = this - first; |
| 670 } |
| 671 return candidate; |
| 672 } |
| 673 } |
| 674 SkASSERT(0); |
| 675 return NULL; |
| 676 } |
| 677 |
| 678 void SkOpSpan::dumpOne() const { |
| 679 SkDebugf("t="); |
| 680 DebugDumpDouble(fT); |
| 681 SkDebugf(" pt="); |
| 682 SkDPoint::Dump(fPt); |
| 683 if (fOther) { |
| 684 SkDebugf(" other.fID=%d", fOther->debugID()); |
| 685 SkDebugf(" [%d] otherT=", fOtherIndex); |
| 686 DebugDumpDouble(fOtherT); |
| 687 } else { |
| 688 SkDebugf(" other.fID=? [?] otherT=?"); |
| 689 } |
| 690 if (fWindSum != SK_MinS32) { |
| 691 SkDebugf(" windSum=%d", fWindSum); |
| 692 } |
| 693 if (fOppSum != SK_MinS32 && (SkPathOpsDebug::ValidWind(fOppSum) || fOppValue
!= 0)) { |
| 694 SkDebugf(" oppSum=%d", fOppSum); |
| 695 } |
| 696 SkDebugf(" windValue=%d", fWindValue); |
| 697 if (SkPathOpsDebug::ValidWind(fOppSum) || fOppValue != 0) { |
| 698 SkDebugf(" oppValue=%d", fOppValue); |
| 699 } |
| 700 if (fFromAngle && fFromAngle->debugID()) { |
| 701 SkDebugf(" from=%d", fFromAngle->debugID()); |
| 702 } |
| 703 if (fToAngle && fToAngle->debugID()) { |
| 704 SkDebugf(" to=%d", fToAngle->debugID()); |
| 705 } |
| 706 if (fChased) { |
| 707 SkDebugf(" chased"); |
| 708 } |
| 709 if (fCoincident) { |
| 710 SkDebugf(" coincident"); |
| 711 } |
| 712 if (fDone) { |
| 713 SkDebugf(" done"); |
| 714 } |
| 715 if (fLoop) { |
| 716 SkDebugf(" loop"); |
| 717 } |
| 718 if (fMultiple) { |
| 719 SkDebugf(" multiple"); |
| 720 } |
| 721 if (fNear) { |
| 722 SkDebugf(" near"); |
| 723 } |
| 724 if (fSmall) { |
| 725 SkDebugf(" small"); |
| 726 } |
| 727 if (fTiny) { |
| 728 SkDebugf(" tiny"); |
926 } | 729 } |
927 SkDebugf("\n"); | 730 SkDebugf("\n"); |
928 SkDebugf("+ seg=%d span=%d ptT=%d ", fOppPtTStart->segment()->debugID(), | 731 } |
929 fOppPtTStart->span()->debugID(), fOppPtTStart->debugID()); | 732 |
930 fOppPtTStart->dumpBase(); | 733 void SkOpSpan::dump() const { |
931 SkDebugf(" span=%d ptT=%d ", fOppPtTEnd->span()->debugID(), fOppPtTEnd->debu
gID()); | 734 ptrdiff_t spanIndex; |
932 fOppPtTEnd->dumpBase(); | 735 const SkOpSegment* segment = debugToSegment(&spanIndex); |
933 if (fOppPtTStart->segment()->operand()) { | 736 if (segment) { |
934 SkDebugf(" operand"); | 737 SkDebugf("((SkOpSegment*) 0x%p) [%d]\n", segment, segment->debugID()); |
935 } | 738 SkDebugf(" [%d] ", spanIndex); |
936 if (fOppPtTStart->segment()->isXor()) { | 739 } else { |
937 SkDebugf(" xor"); | 740 SkDebugf("((SkOpSegment*) ?) [?]\n"); |
| 741 SkDebugf(" [?] "); |
| 742 } |
| 743 dumpOne(); |
| 744 } |
| 745 |
| 746 void Dump(const SkTArray<class SkOpContour, true>& contours) { |
| 747 SkPathOpsDebug::DumpContours(contours); |
| 748 } |
| 749 |
| 750 void Dump(const SkTArray<class SkOpContour* , true>& contours) { |
| 751 SkPathOpsDebug::DumpContours(contours); |
| 752 } |
| 753 |
| 754 void Dump(const SkTArray<class SkOpContour, true>* contours) { |
| 755 SkPathOpsDebug::DumpContours(*contours); |
| 756 } |
| 757 |
| 758 void Dump(const SkTArray<class SkOpContour* , true>* contours) { |
| 759 SkPathOpsDebug::DumpContours(*contours); |
| 760 } |
| 761 |
| 762 void Dump(const SkTDArray<SkOpSpan *>& chase) { |
| 763 SkPathOpsDebug::DumpSpans(chase); |
| 764 } |
| 765 |
| 766 void Dump(const SkTDArray<SkOpSpan *>* chase) { |
| 767 SkPathOpsDebug::DumpSpans(*chase); |
| 768 } |
| 769 |
| 770 void DumpAngles(const SkTArray<class SkOpContour, true>& contours) { |
| 771 SkPathOpsDebug::DumpContourAngles(contours); |
| 772 } |
| 773 |
| 774 void DumpAngles(const SkTArray<class SkOpContour* , true>& contours) { |
| 775 SkPathOpsDebug::DumpContourAngles(contours); |
| 776 } |
| 777 |
| 778 void DumpAngles(const SkTArray<class SkOpContour, true>* contours) { |
| 779 SkPathOpsDebug::DumpContourAngles(*contours); |
| 780 } |
| 781 |
| 782 void DumpAngles(const SkTArray<class SkOpContour* , true>* contours) { |
| 783 SkPathOpsDebug::DumpContourAngles(*contours); |
| 784 } |
| 785 |
| 786 void DumpCoin(const SkTArray<class SkOpContour, true>& contours) { |
| 787 SkPathOpsDebug::DumpCoincidence(contours); |
| 788 } |
| 789 |
| 790 void DumpCoin(const SkTArray<class SkOpContour* , true>& contours) { |
| 791 SkPathOpsDebug::DumpCoincidence(contours); |
| 792 } |
| 793 |
| 794 void DumpCoin(const SkTArray<class SkOpContour, true>* contours) { |
| 795 SkPathOpsDebug::DumpCoincidence(*contours); |
| 796 } |
| 797 |
| 798 void DumpCoin(const SkTArray<class SkOpContour* , true>* contours) { |
| 799 SkPathOpsDebug::DumpCoincidence(*contours); |
| 800 } |
| 801 |
| 802 void DumpSpans(const SkTArray<class SkOpContour, true>& contours) { |
| 803 SkPathOpsDebug::DumpContourSpans(contours); |
| 804 } |
| 805 |
| 806 void DumpSpans(const SkTArray<class SkOpContour* , true>& contours) { |
| 807 SkPathOpsDebug::DumpContourSpans(contours); |
| 808 } |
| 809 |
| 810 void DumpSpans(const SkTArray<class SkOpContour, true>* contours) { |
| 811 SkPathOpsDebug::DumpContourSpans(*contours); |
| 812 } |
| 813 |
| 814 void DumpSpans(const SkTArray<class SkOpContour* , true>* contours) { |
| 815 SkPathOpsDebug::DumpContourSpans(*contours); |
| 816 } |
| 817 |
| 818 void DumpSpan(const SkTArray<class SkOpContour, true>& contours, int segmentID)
{ |
| 819 SkPathOpsDebug::DumpContourSpan(contours, segmentID); |
| 820 } |
| 821 |
| 822 void DumpSpan(const SkTArray<class SkOpContour* , true>& contours, int segmentID
) { |
| 823 SkPathOpsDebug::DumpContourSpan(contours, segmentID); |
| 824 } |
| 825 |
| 826 void DumpSpan(const SkTArray<class SkOpContour, true>* contours, int segmentID)
{ |
| 827 SkPathOpsDebug::DumpContourSpan(*contours, segmentID); |
| 828 } |
| 829 |
| 830 void DumpSpan(const SkTArray<class SkOpContour* , true>* contours, int segmentID
) { |
| 831 SkPathOpsDebug::DumpContourSpan(*contours, segmentID); |
| 832 } |
| 833 |
| 834 void DumpPts(const SkTArray<class SkOpContour, true>& contours) { |
| 835 SkPathOpsDebug::DumpContourPts(contours); |
| 836 } |
| 837 |
| 838 void DumpPts(const SkTArray<class SkOpContour* , true>& contours) { |
| 839 SkPathOpsDebug::DumpContourPts(contours); |
| 840 } |
| 841 |
| 842 void DumpPts(const SkTArray<class SkOpContour, true>* contours) { |
| 843 SkPathOpsDebug::DumpContourPts(*contours); |
| 844 } |
| 845 |
| 846 void DumpPts(const SkTArray<class SkOpContour* , true>* contours) { |
| 847 SkPathOpsDebug::DumpContourPts(*contours); |
| 848 } |
| 849 |
| 850 void DumpPt(const SkTArray<class SkOpContour, true>& contours, int segmentID) { |
| 851 SkPathOpsDebug::DumpContourPt(contours, segmentID); |
| 852 } |
| 853 |
| 854 void DumpPt(const SkTArray<class SkOpContour* , true>& contours, int segmentID)
{ |
| 855 SkPathOpsDebug::DumpContourPt(contours, segmentID); |
| 856 } |
| 857 |
| 858 void DumpPt(const SkTArray<class SkOpContour, true>* contours, int segmentID) { |
| 859 SkPathOpsDebug::DumpContourPt(*contours, segmentID); |
| 860 } |
| 861 |
| 862 void DumpPt(const SkTArray<class SkOpContour* , true>* contours, int segmentID)
{ |
| 863 SkPathOpsDebug::DumpContourPt(*contours, segmentID); |
| 864 } |
| 865 |
| 866 static void dumpTestCase(const SkDQuad& quad1, const SkDQuad& quad2, int testNo)
{ |
| 867 SkDebugf("<div id=\"quad%d\">\n", testNo); |
| 868 quad1.dumpComma(","); |
| 869 quad2.dump(); |
| 870 SkDebugf("</div>\n\n"); |
| 871 } |
| 872 |
| 873 static void dumpTestTrailer() { |
| 874 SkDebugf("</div>\n\n<script type=\"text/javascript\">\n\n"); |
| 875 SkDebugf(" var testDivs = [\n"); |
| 876 } |
| 877 |
| 878 static void dumpTestList(int testNo, double min) { |
| 879 SkDebugf(" quad%d,", testNo); |
| 880 if (min > 0) { |
| 881 SkDebugf(" // %1.9g", min); |
938 } | 882 } |
939 SkDebugf("\n"); | 883 SkDebugf("\n"); |
940 } | 884 } |
941 | 885 |
942 void SkOpCoincidence::dump() const { | 886 void DumpQ(const SkDQuad& quad1, const SkDQuad& quad2, int testNo) { |
943 SkCoincidentSpans* span = fHead; | 887 SkDebugf("\n"); |
944 while (span) { | 888 dumpTestCase(quad1, quad2, testNo); |
945 span->dump(); | 889 dumpTestTrailer(); |
946 span = span->fNext; | 890 dumpTestList(testNo, 0); |
947 } | 891 SkDebugf("\n"); |
948 } | 892 } |
949 | 893 |
950 void SkOpContour::dump() { | 894 void DumpT(const SkDQuad& quad, double t) { |
951 SkDebugf("contour=%d count=%d\n", this->debugID(), fCount); | 895 SkDLine line = {{quad.ptAtT(t), quad[0]}}; |
952 if (!fCount) { | 896 line.dump(); |
953 return; | 897 } |
954 } | |
955 const SkOpSegment* segment = &fHead; | |
956 PATH_OPS_DEBUG_CODE(fIndent = 0); | |
957 indentDump(); | |
958 do { | |
959 segment->dump(); | |
960 } while ((segment = segment->next())); | |
961 outdentDump(); | |
962 } | |
963 | |
964 void SkOpContour::dumpAll() { | |
965 SkDebugf("contour=%d count=%d\n", this->debugID(), fCount); | |
966 if (!fCount) { | |
967 return; | |
968 } | |
969 const SkOpSegment* segment = &fHead; | |
970 PATH_OPS_DEBUG_CODE(fIndent = 0); | |
971 indentDump(); | |
972 do { | |
973 segment->dumpAll(); | |
974 } while ((segment = segment->next())); | |
975 outdentDump(); | |
976 } | |
977 | |
978 | |
979 void SkOpContour::dumpAngles() const { | |
980 SkDebugf("contour=%d\n", this->debugID()); | |
981 const SkOpSegment* segment = &fHead; | |
982 do { | |
983 SkDebugf(" seg=%d ", segment->debugID()); | |
984 segment->dumpAngles(); | |
985 } while ((segment = segment->next())); | |
986 } | |
987 | |
988 void SkOpContour::dumpPt(int index) const { | |
989 const SkOpSegment* segment = &fHead; | |
990 do { | |
991 if (segment->debugID() == index) { | |
992 segment->dumpPts(); | |
993 } | |
994 } while ((segment = segment->next())); | |
995 } | |
996 | |
997 void SkOpContour::dumpPts() const { | |
998 SkDebugf("contour=%d\n", this->debugID()); | |
999 const SkOpSegment* segment = &fHead; | |
1000 do { | |
1001 SkDebugf(" seg=%d ", segment->debugID()); | |
1002 segment->dumpPts(); | |
1003 } while ((segment = segment->next())); | |
1004 } | |
1005 | |
1006 void SkOpContour::dumpPtsX() const { | |
1007 if (!this->fCount) { | |
1008 SkDebugf("<empty>\n"); | |
1009 return; | |
1010 } | |
1011 const SkOpSegment* segment = &fHead; | |
1012 do { | |
1013 segment->dumpPts(); | |
1014 } while ((segment = segment->next())); | |
1015 } | |
1016 | |
1017 void SkOpContour::dumpSegment(int index) const { | |
1018 debugSegment(index)->dump(); | |
1019 } | |
1020 | |
1021 void SkOpContour::dumpSegments(SkPathOp op) const { | |
1022 bool firstOp = false; | |
1023 const SkOpContour* c = this; | |
1024 do { | |
1025 if (!firstOp && c->operand()) { | |
1026 #if DEBUG_ACTIVE_OP | |
1027 SkDebugf("op %s\n", SkPathOpsDebug::kPathOpStr[op]); | |
1028 #endif | |
1029 firstOp = true; | |
1030 } | |
1031 c->dumpPtsX(); | |
1032 } while ((c = c->next())); | |
1033 } | |
1034 | |
1035 void SkOpContour::dumpSpan(int index) const { | |
1036 debugSpan(index)->dump(); | |
1037 } | |
1038 | |
1039 void SkOpContour::dumpSpans() const { | |
1040 SkDebugf("contour=%d\n", this->debugID()); | |
1041 const SkOpSegment* segment = &fHead; | |
1042 do { | |
1043 SkDebugf(" seg=%d ", segment->debugID()); | |
1044 segment->dump(); | |
1045 } while ((segment = segment->next())); | |
1046 } | |
1047 | |
1048 #ifdef SK_DEBUG | |
1049 const SkOpAngle* SkOpGlobalState::debugAngle(int id) const { | |
1050 const SkOpContour* contour = fHead; | |
1051 do { | |
1052 const SkOpSegment* segment = contour->first(); | |
1053 while (segment) { | |
1054 const SkOpSpan* span = segment->head(); | |
1055 do { | |
1056 SkOpAngle* angle = span->fromAngle(); | |
1057 if (angle && angle->debugID() == id) { | |
1058 return angle; | |
1059 } | |
1060 angle = span->toAngle(); | |
1061 if (angle && angle->debugID() == id) { | |
1062 return angle; | |
1063 } | |
1064 } while ((span = span->next()->upCastable())); | |
1065 const SkOpSpanBase* tail = segment->tail(); | |
1066 SkOpAngle* angle = tail->fromAngle(); | |
1067 if (angle && angle->debugID() == id) { | |
1068 return angle; | |
1069 } | |
1070 segment = segment->next(); | |
1071 } | |
1072 } while ((contour = contour->next())); | |
1073 return NULL; | |
1074 } | |
1075 | |
1076 SkOpContour* SkOpGlobalState::debugContour(int id) { | |
1077 SkOpContour* contour = fHead; | |
1078 do { | |
1079 if (contour->debugID() == id) { | |
1080 return contour; | |
1081 } | |
1082 } while ((contour = contour->next())); | |
1083 return NULL; | |
1084 } | |
1085 | |
1086 const SkOpPtT* SkOpGlobalState::debugPtT(int id) const { | |
1087 const SkOpContour* contour = fHead; | |
1088 do { | |
1089 const SkOpSegment* segment = contour->first(); | |
1090 while (segment) { | |
1091 const SkOpSpan* span = segment->head(); | |
1092 do { | |
1093 const SkOpPtT* ptT = span->ptT(); | |
1094 if (ptT->debugMatchID(id)) { | |
1095 return ptT; | |
1096 } | |
1097 } while ((span = span->next()->upCastable())); | |
1098 const SkOpSpanBase* tail = segment->tail(); | |
1099 const SkOpPtT* ptT = tail->ptT(); | |
1100 if (ptT->debugMatchID(id)) { | |
1101 return ptT; | |
1102 } | |
1103 segment = segment->next(); | |
1104 } | |
1105 } while ((contour = contour->next())); | |
1106 return NULL; | |
1107 } | |
1108 | |
1109 const SkOpSegment* SkOpGlobalState::debugSegment(int id) const { | |
1110 const SkOpContour* contour = fHead; | |
1111 do { | |
1112 const SkOpSegment* segment = contour->first(); | |
1113 while (segment) { | |
1114 if (segment->debugID() == id) { | |
1115 return segment; | |
1116 } | |
1117 segment = segment->next(); | |
1118 } | |
1119 } while ((contour = contour->next())); | |
1120 return NULL; | |
1121 } | |
1122 | |
1123 const SkOpSpanBase* SkOpGlobalState::debugSpan(int id) const { | |
1124 const SkOpContour* contour = fHead; | |
1125 do { | |
1126 const SkOpSegment* segment = contour->first(); | |
1127 while (segment) { | |
1128 const SkOpSpan* span = segment->head(); | |
1129 do { | |
1130 if (span->debugID() == id) { | |
1131 return span; | |
1132 } | |
1133 } while ((span = span->next()->upCastable())); | |
1134 const SkOpSpanBase* tail = segment->tail(); | |
1135 if (tail->debugID() == id) { | |
1136 return tail; | |
1137 } | |
1138 segment = segment->next(); | |
1139 } | |
1140 } while ((contour = contour->next())); | |
1141 return NULL; | |
1142 } | |
1143 #endif | |
1144 | |
1145 const SkOpAngle* DebugAngle(const SkTArray<SkOpContour*, true>* contours, int id
) { | |
1146 return (*contours)[0]->debugAngle(id); | |
1147 } | |
1148 | |
1149 SkOpContour* DumpContour(const SkTArray<SkOpContour*, true>* contours, int id) { | |
1150 return (*contours)[0]->debugContour(id); | |
1151 } | |
1152 | |
1153 const SkOpPtT* DebugPtT(const SkTArray<SkOpContour*, true>* contours, int id) { | |
1154 return (*contours)[0]->debugPtT(id); | |
1155 } | |
1156 | |
1157 const SkOpSegment* DebugSegment(const SkTArray<SkOpContour*, true>* contours, in
t id) { | |
1158 return (*contours)[0]->debugSegment(id); | |
1159 } | |
1160 | |
1161 const SkOpSpanBase* DebugSpan(const SkTArray<SkOpContour*, true>* contours, int
id) { | |
1162 return (*contours)[0]->debugSpan(id); | |
1163 } | |
1164 | |
1165 void Dump(SkTDArray<SkOpContour* >* contours) { | |
1166 SkPathOpsDebug::DumpContours(contours); | |
1167 } | |
1168 | |
1169 void DumpAll(SkTDArray<SkOpContour* >* contours) { | |
1170 SkPathOpsDebug::DumpContoursAll(contours); | |
1171 } | |
1172 | |
1173 void DumpAngles(const SkTDArray<SkOpContour* >* contours) { | |
1174 SkPathOpsDebug::DumpContoursAngles(contours); | |
1175 } | |
1176 | |
1177 void DumpSegment(const SkTDArray<SkOpContour* >* contours, int segmentID) { | |
1178 SkPathOpsDebug::DumpContoursSegment(contours, segmentID); | |
1179 } | |
1180 | |
1181 void DumpSpan(const SkTDArray<SkOpContour* >* contours, int spanID) { | |
1182 SkPathOpsDebug::DumpContoursSpan(contours, spanID); | |
1183 } | |
1184 | |
1185 void DumpSpans(const SkTDArray<SkOpContour* >* contours) { | |
1186 SkPathOpsDebug::DumpContoursSpans(contours); | |
1187 } | |
1188 | |
1189 void DumpPt(const SkTDArray<SkOpContour* >* contours, int segmentID) { | |
1190 SkPathOpsDebug::DumpContoursPt(contours, segmentID); | |
1191 } | |
1192 | |
1193 void DumpPts(const SkTDArray<SkOpContour* >* contours) { | |
1194 SkPathOpsDebug::DumpContoursPts(contours); | |
1195 } | |
1196 | |
1197 #if DEBUG_T_SECT_DUMP > 1 | |
1198 int gDumpTSectNum; | |
1199 #endif | |
OLD | NEW |