aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PathOpsTSectDebug.h
blob: 5f8915f68123778a857c7abea9e99286ab10f33d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * Copyright 2014 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "SkPathOpsTSect.h"

template<typename TCurve>
void SkTSect<TCurve>::dump() const {
    SkDebugf("id=%d", debugID());
    const SkTSpan<TCurve>* test = fHead;
    if (!test) {
        SkDebugf(" (empty)");
        return;
    }
    do {
        SkDebugf(" ");
        test->dump(this);
    } while ((test = test->next()));
}

template<typename TCurve>
void SkTSect<TCurve>::dumpBoth(const SkTSect& opp) const {
    dump();
    SkDebugf(" ");
    opp.dump();
    SkDebugf("\n");
}

template<typename TCurve>
void SkTSect<TCurve>::dumpBoth(const SkTSect* opp) const {
    dumpBoth(*opp);
}

template<typename TCurve>
void SkTSect<TCurve>::dumpCurves() const {
    const SkTSpan<TCurve>* test = fHead;
    do {
        test->fPart.dump();
    } while ((test = test->next()));
}

#if !DEBUG_T_SECT
template<typename TCurve>
int SkTSpan<TCurve>::debugID(const SkTSect<TCurve>* sect) const {
    if (!sect) {
        return -1;
    }
    int id = 1;
    const SkTSpan* test = sect->fHead;
    while (test && test != this) {
        ++id;
        test = test->fNext;
    }
    return id;
}
#endif

template<typename TCurve>
void SkTSpan<TCurve>::dumpID(const SkTSect<TCurve>* sect) const {
    if (fCoinStart.isCoincident()) {
        SkDebugf("%c", '*');
    }
    SkDebugf("%d", debugID(sect));
    if (fCoinEnd.isCoincident()) {
        SkDebugf("%c", '*');
    }
}

template<typename TCurve>
void SkTSpan<TCurve>::dump(const SkTSect<TCurve>* sect) const {
    dumpID(sect);
    SkDebugf("=(%g,%g) [", fStartT, fEndT);
    for (int index = 0; index < fBounded.count(); ++index) {
        SkTSpan* span = fBounded[index];
        span->dumpID(sect);
        if (index < fBounded.count() - 1) {
            SkDebugf(",");
        }
    }
    SkDebugf("]");
}