blob: 5f8915f68123778a857c7abea9e99286ab10f33d [file] [log] [blame]
caryclark45fa4472015-01-16 07:04:10 -08001/*
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 "SkPathOpsTSect.h"
9
10template<typename TCurve>
11void SkTSect<TCurve>::dump() const {
12 SkDebugf("id=%d", debugID());
13 const SkTSpan<TCurve>* test = fHead;
14 if (!test) {
15 SkDebugf(" (empty)");
16 return;
17 }
18 do {
19 SkDebugf(" ");
20 test->dump(this);
21 } while ((test = test->next()));
22}
23
24template<typename TCurve>
25void SkTSect<TCurve>::dumpBoth(const SkTSect& opp) const {
26 dump();
27 SkDebugf(" ");
28 opp.dump();
29 SkDebugf("\n");
30}
31
32template<typename TCurve>
33void SkTSect<TCurve>::dumpBoth(const SkTSect* opp) const {
34 dumpBoth(*opp);
35}
36
37template<typename TCurve>
38void SkTSect<TCurve>::dumpCurves() const {
39 const SkTSpan<TCurve>* test = fHead;
40 do {
41 test->fPart.dump();
42 } while ((test = test->next()));
43}
44
45#if !DEBUG_T_SECT
46template<typename TCurve>
47int SkTSpan<TCurve>::debugID(const SkTSect<TCurve>* sect) const {
48 if (!sect) {
49 return -1;
50 }
51 int id = 1;
52 const SkTSpan* test = sect->fHead;
53 while (test && test != this) {
54 ++id;
55 test = test->fNext;
56 }
57 return id;
58}
59#endif
60
61template<typename TCurve>
62void SkTSpan<TCurve>::dumpID(const SkTSect<TCurve>* sect) const {
63 if (fCoinStart.isCoincident()) {
64 SkDebugf("%c", '*');
65 }
66 SkDebugf("%d", debugID(sect));
67 if (fCoinEnd.isCoincident()) {
68 SkDebugf("%c", '*');
69 }
70}
71
72template<typename TCurve>
73void SkTSpan<TCurve>::dump(const SkTSect<TCurve>* sect) const {
74 dumpID(sect);
75 SkDebugf("=(%g,%g) [", fStartT, fEndT);
76 for (int index = 0; index < fBounded.count(); ++index) {
77 SkTSpan* span = fBounded[index];
78 span->dumpID(sect);
79 if (index < fBounded.count() - 1) {
80 SkDebugf(",");
81 }
82 }
83 SkDebugf("]");
84}