SkPathOpsDebug.cpp revision 27c8eb8ffd7e221693d840c2b9279d53fe6f03d4
1/*
2 * Copyright 2013 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 "SkPathOpsDebug.h"
9#include "SkPath.h"
10#include "SkString.h"
11#include "SkThread.h"
12
13#if DEBUG_VALIDATE
14extern bool FLAGS_runFail;
15#endif
16
17#if DEBUG_SORT
18int SkPathOpsDebug::gSortCountDefault = SK_MaxS32;
19int SkPathOpsDebug::gSortCount;
20#endif
21
22#if DEBUG_ACTIVE_OP
23const char* SkPathOpsDebug::kPathOpStr[] = {"diff", "sect", "union", "xor"};
24#endif
25
26#if defined SK_DEBUG || !FORCE_RELEASE
27
28const char* SkPathOpsDebug::kLVerbStr[] = {"", "line", "quad", "cubic"};
29
30#if defined(SK_DEBUG) || !FORCE_RELEASE
31int SkPathOpsDebug::gContourID = 0;
32int SkPathOpsDebug::gSegmentID = 0;
33#endif
34
35bool SkPathOpsDebug::ChaseContains(const SkTDArray<SkOpSpanBase* >& chaseArray,
36        const SkOpSpanBase* span) {
37    for (int index = 0; index < chaseArray.count(); ++index) {
38        const SkOpSpanBase* entry = chaseArray[index];
39        if (entry == span) {
40            return true;
41        }
42    }
43    return false;
44}
45
46void SkPathOpsDebug::MathematicaIze(char* str, size_t bufferLen) {
47    size_t len = strlen(str);
48    bool num = false;
49    for (size_t idx = 0; idx < len; ++idx) {
50        if (num && str[idx] == 'e') {
51            if (len + 2 >= bufferLen) {
52                return;
53            }
54            memmove(&str[idx + 2], &str[idx + 1], len - idx);
55            str[idx] = '*';
56            str[idx + 1] = '^';
57            ++len;
58        }
59        num = str[idx] >= '0' && str[idx] <= '9';
60    }
61}
62
63bool SkPathOpsDebug::ValidWind(int wind) {
64    return wind > SK_MinS32 + 0xFFFF && wind < SK_MaxS32 - 0xFFFF;
65}
66
67void SkPathOpsDebug::WindingPrintf(int wind) {
68    if (wind == SK_MinS32) {
69        SkDebugf("?");
70    } else {
71        SkDebugf("%d", wind);
72    }
73}
74#endif //  defined SK_DEBUG || !FORCE_RELEASE
75
76
77#if DEBUG_SHOW_TEST_NAME
78void* SkPathOpsDebug::CreateNameStr() {
79    return SkNEW_ARRAY(char, DEBUG_FILENAME_STRING_LENGTH);
80}
81
82void SkPathOpsDebug::DeleteNameStr(void* v) {
83    SkDELETE_ARRAY(reinterpret_cast<char* >(v));
84}
85
86void SkPathOpsDebug::BumpTestName(char* test) {
87    char* num = test + strlen(test);
88    while (num[-1] >= '0' && num[-1] <= '9') {
89        --num;
90    }
91    if (num[0] == '\0') {
92        return;
93    }
94    int dec = atoi(num);
95    if (dec == 0) {
96        return;
97    }
98    ++dec;
99    SK_SNPRINTF(num, DEBUG_FILENAME_STRING_LENGTH - (num - test), "%d", dec);
100}
101#endif
102
103static void show_function_header(const char* functionName) {
104    SkDebugf("\nstatic void %s(skiatest::Reporter* reporter, const char* filename) {\n", functionName);
105    if (strcmp("skphealth_com76", functionName) == 0) {
106        SkDebugf("found it\n");
107    }
108}
109
110static const char* gOpStrs[] = {
111    "kDifference_SkPathOp",
112    "kIntersect_SkPathOp",
113    "kUnion_SkPathOp",
114    "kXor_PathOp",
115    "kReverseDifference_SkPathOp",
116};
117
118const char* SkPathOpsDebug::OpStr(SkPathOp op) {
119    return gOpStrs[op];
120}
121
122static void show_op(SkPathOp op, const char* pathOne, const char* pathTwo) {
123    SkDebugf("    testPathOp(reporter, %s, %s, %s, filename);\n", pathOne, pathTwo, gOpStrs[op]);
124    SkDebugf("}\n");
125}
126
127SK_DECLARE_STATIC_MUTEX(gTestMutex);
128
129void SkPathOpsDebug::ShowPath(const SkPath& a, const SkPath& b, SkPathOp shapeOp,
130        const char* testName) {
131    SkAutoMutexAcquire ac(gTestMutex);
132    show_function_header(testName);
133    ShowOnePath(a, "path", true);
134    ShowOnePath(b, "pathB", true);
135    show_op(shapeOp, "path", "pathB");
136}
137
138#include "SkPathOpsTypes.h"
139
140#ifdef SK_DEBUG
141bool SkOpGlobalState::debugRunFail() const {
142#if DEBUG_VALIDATE
143    return FLAGS_runFail;
144#else
145    return false;
146#endif
147}
148#endif
149
150#include "SkPathOpsCubic.h"
151#include "SkPathOpsQuad.h"
152
153SkDCubic SkDQuad::debugToCubic() const {
154    SkDCubic cubic;
155    cubic[0] = fPts[0];
156    cubic[2] = fPts[1];
157    cubic[3] = fPts[2];
158    cubic[1].fX = (cubic[0].fX + cubic[2].fX * 2) / 3;
159    cubic[1].fY = (cubic[0].fY + cubic[2].fY * 2) / 3;
160    cubic[2].fX = (cubic[3].fX + cubic[2].fX * 2) / 3;
161    cubic[2].fY = (cubic[3].fY + cubic[2].fY * 2) / 3;
162    return cubic;
163}
164
165#include "SkOpAngle.h"
166#include "SkOpCoincidence.h"
167#include "SkOpSegment.h"
168
169SkOpAngle* SkOpSegment::debugLastAngle() {
170    SkOpAngle* result = NULL;
171    SkOpSpan* span = this->head();
172    do {
173        if (span->toAngle()) {
174            SkASSERT(!result);
175            result = span->toAngle();
176        }
177    } while ((span = span->next()->upCastable()));
178    SkASSERT(result);
179    return result;
180}
181
182void SkOpSegment::debugReset() {
183    this->init(this->fPts, this->fWeight, this->contour(), this->verb());
184}
185
186#if DEBUG_ACTIVE_SPANS
187void SkOpSegment::debugShowActiveSpans() const {
188    debugValidate();
189    if (done()) {
190        return;
191    }
192    int lastId = -1;
193    double lastT = -1;
194    const SkOpSpan* span = &fHead;
195    do {
196        if (span->done()) {
197            continue;
198        }
199        if (lastId == this->debugID() && lastT == span->t()) {
200            continue;
201        }
202        lastId = this->debugID();
203        lastT = span->t();
204        SkDebugf("%s id=%d", __FUNCTION__, this->debugID());
205        SkDebugf(" (%1.9g,%1.9g", fPts[0].fX, fPts[0].fY);
206        for (int vIndex = 1; vIndex <= SkPathOpsVerbToPoints(fVerb); ++vIndex) {
207            SkDebugf(" %1.9g,%1.9g", fPts[vIndex].fX, fPts[vIndex].fY);
208        }
209        if (SkPath::kConic_Verb == fVerb) {
210            SkDebugf(" %1.9gf", fWeight);
211        }
212        const SkOpPtT* ptT = span->ptT();
213        SkDebugf(") t=%1.9g (%1.9g,%1.9g)", ptT->fT, ptT->fPt.fX, ptT->fPt.fY);
214        SkDebugf(" tEnd=%1.9g", span->next()->t());
215        if (span->windSum() == SK_MinS32) {
216            SkDebugf(" windSum=?");
217        } else {
218            SkDebugf(" windSum=%d", span->windSum());
219        }
220        if (span->oppValue() && span->oppSum() == SK_MinS32) {
221            SkDebugf(" oppSum=?");
222        } else if (span->oppValue() || span->oppSum() != SK_MinS32) {
223            SkDebugf(" oppSum=%d", span->oppSum());
224        }
225        SkDebugf(" windValue=%d", span->windValue());
226        if (span->oppValue() || span->oppSum() != SK_MinS32) {
227            SkDebugf(" oppValue=%d", span->oppValue());
228        }
229        SkDebugf("\n");
230   } while ((span = span->next()->upCastable()));
231}
232#endif
233
234#if DEBUG_MARK_DONE
235void SkOpSegment::debugShowNewWinding(const char* fun, const SkOpSpan* span, int winding) {
236    const SkPoint& pt = span->ptT()->fPt;
237    SkDebugf("%s id=%d", fun, this->debugID());
238    SkDebugf(" (%1.9g,%1.9g", fPts[0].fX, fPts[0].fY);
239    for (int vIndex = 1; vIndex <= SkPathOpsVerbToPoints(fVerb); ++vIndex) {
240        SkDebugf(" %1.9g,%1.9g", fPts[vIndex].fX, fPts[vIndex].fY);
241    }
242    SkDebugf(") t=%1.9g [%d] (%1.9g,%1.9g) tEnd=%1.9g newWindSum=",
243            span->t(), span->debugID(), pt.fX, pt.fY, span->next()->t());
244    if (winding == SK_MinS32) {
245        SkDebugf("?");
246    } else {
247        SkDebugf("%d", winding);
248    }
249    SkDebugf(" windSum=");
250    if (span->windSum() == SK_MinS32) {
251        SkDebugf("?");
252    } else {
253        SkDebugf("%d", span->windSum());
254    }
255    SkDebugf(" windValue=%d\n", span->windValue());
256}
257
258void SkOpSegment::debugShowNewWinding(const char* fun, const SkOpSpan* span, int winding,
259                                      int oppWinding) {
260    const SkPoint& pt = span->ptT()->fPt;
261    SkDebugf("%s id=%d", fun, this->debugID());
262    SkDebugf(" (%1.9g,%1.9g", fPts[0].fX, fPts[0].fY);
263    for (int vIndex = 1; vIndex <= SkPathOpsVerbToPoints(fVerb); ++vIndex) {
264        SkDebugf(" %1.9g,%1.9g", fPts[vIndex].fX, fPts[vIndex].fY);
265    }
266    SkDebugf(") t=%1.9g [%d] (%1.9g,%1.9g) tEnd=%1.9g newWindSum=",
267            span->t(), span->debugID(), pt.fX, pt.fY, span->next()->t(), winding, oppWinding);
268    if (winding == SK_MinS32) {
269        SkDebugf("?");
270    } else {
271        SkDebugf("%d", winding);
272    }
273    SkDebugf(" newOppSum=");
274    if (oppWinding == SK_MinS32) {
275        SkDebugf("?");
276    } else {
277        SkDebugf("%d", oppWinding);
278    }
279    SkDebugf(" oppSum=");
280    if (span->oppSum() == SK_MinS32) {
281        SkDebugf("?");
282    } else {
283        SkDebugf("%d", span->oppSum());
284    }
285    SkDebugf(" windSum=");
286    if (span->windSum() == SK_MinS32) {
287        SkDebugf("?");
288    } else {
289        SkDebugf("%d", span->windSum());
290    }
291    SkDebugf(" windValue=%d oppValue=%d\n", span->windValue(), span->oppValue());
292}
293
294#endif
295
296#if DEBUG_ANGLE
297SkString SkOpAngle::debugPart() const {
298    SkString result;
299    switch (this->segment()->verb()) {
300        case SkPath::kLine_Verb:
301            result.printf(LINE_DEBUG_STR " id=%d", LINE_DEBUG_DATA(fCurvePart),
302                    this->segment()->debugID());
303            break;
304        case SkPath::kQuad_Verb:
305            result.printf(QUAD_DEBUG_STR " id=%d", QUAD_DEBUG_DATA(fCurvePart),
306                    this->segment()->debugID());
307            break;
308        case SkPath::kConic_Verb:
309            result.printf(CONIC_DEBUG_STR " id=%d",
310                    CONIC_DEBUG_DATA(fCurvePart, fCurvePart.fConic.fWeight),
311                    this->segment()->debugID());
312            break;
313        case SkPath::kCubic_Verb:
314            result.printf(CUBIC_DEBUG_STR " id=%d", CUBIC_DEBUG_DATA(fCurvePart),
315                    this->segment()->debugID());
316            break;
317        default:
318            SkASSERT(0);
319    }
320    return result;
321}
322#endif
323
324#if DEBUG_SORT
325void SkOpAngle::debugLoop() const {
326    const SkOpAngle* first = this;
327    const SkOpAngle* next = this;
328    do {
329        next->dumpOne(true);
330        SkDebugf("\n");
331        next = next->fNext;
332    } while (next && next != first);
333    next = first;
334    do {
335        next->debugValidate();
336        next = next->fNext;
337    } while (next && next != first);
338}
339#endif
340
341void SkOpAngle::debugValidate() const {
342#if DEBUG_VALIDATE
343    const SkOpAngle* first = this;
344    const SkOpAngle* next = this;
345    int wind = 0;
346    int opp = 0;
347    int lastXor = -1;
348    int lastOppXor = -1;
349    do {
350        if (next->unorderable()) {
351            return;
352        }
353        const SkOpSpan* minSpan = next->start()->starter(next->end());
354        if (minSpan->windValue() == SK_MinS32) {
355            return;
356        }
357        bool op = next->segment()->operand();
358        bool isXor = next->segment()->isXor();
359        bool oppXor = next->segment()->oppXor();
360        SkASSERT(!DEBUG_LIMIT_WIND_SUM || between(0, minSpan->windValue(), DEBUG_LIMIT_WIND_SUM));
361        SkASSERT(!DEBUG_LIMIT_WIND_SUM
362                || between(-DEBUG_LIMIT_WIND_SUM, minSpan->oppValue(), DEBUG_LIMIT_WIND_SUM));
363        bool useXor = op ? oppXor : isXor;
364        SkASSERT(lastXor == -1 || lastXor == (int) useXor);
365        lastXor = (int) useXor;
366        wind += next->debugSign() * (op ? minSpan->oppValue() : minSpan->windValue());
367        if (useXor) {
368            wind &= 1;
369        }
370        useXor = op ? isXor : oppXor;
371        SkASSERT(lastOppXor == -1 || lastOppXor == (int) useXor);
372        lastOppXor = (int) useXor;
373        opp += next->debugSign() * (op ? minSpan->windValue() : minSpan->oppValue());
374        if (useXor) {
375            opp &= 1;
376        }
377        next = next->fNext;
378    } while (next && next != first);
379    SkASSERT(wind == 0 || !FLAGS_runFail);
380    SkASSERT(opp == 0 || !FLAGS_runFail);
381#endif
382}
383
384void SkOpAngle::debugValidateNext() const {
385#if !FORCE_RELEASE
386    const SkOpAngle* first = this;
387    const SkOpAngle* next = first;
388    SkTDArray<const SkOpAngle*>(angles);
389    do {
390//        SK_ALWAYSBREAK(next->fSegment->debugContains(next));
391        angles.push(next);
392        next = next->next();
393        if (next == first) {
394            break;
395        }
396        SK_ALWAYSBREAK(!angles.contains(next));
397        if (!next) {
398            return;
399        }
400    } while (true);
401#endif
402}
403
404void SkOpCoincidence::debugShowCoincidence() const {
405    SkCoincidentSpans* span = fHead;
406    while (span) {
407        SkDebugf("%s - id=%d t=%1.9g tEnd=%1.9g\n", __FUNCTION__,
408                span->fCoinPtTStart->segment()->debugID(),
409                span->fCoinPtTStart->fT, span->fCoinPtTEnd->fT);
410        SkDebugf("%s + id=%d t=%1.9g tEnd=%1.9g\n", __FUNCTION__,
411                span->fOppPtTStart->segment()->debugID(),
412                span->fOppPtTStart->fT, span->fOppPtTEnd->fT);
413        span = span->fNext;
414    }
415}
416
417void SkOpSegment::debugValidate() const {
418#if DEBUG_VALIDATE
419    const SkOpSpanBase* span = &fHead;
420    double lastT = -1;
421    const SkOpSpanBase* prev = NULL;
422    int count = 0;
423    int done = 0;
424    do {
425        if (!span->final()) {
426            ++count;
427            done += span->upCast()->done() ? 1 : 0;
428        }
429        SkASSERT(span->segment() == this);
430        SkASSERT(!prev || prev->upCast()->next() == span);
431        SkASSERT(!prev || prev == span->prev());
432        prev = span;
433        double t = span->ptT()->fT;
434        SkASSERT(lastT < t);
435        lastT = t;
436        span->debugValidate();
437    } while (!span->final() && (span = span->upCast()->next()));
438    SkASSERT(count == fCount);
439    SkASSERT(done == fDoneCount);
440    SkASSERT(count >= fDoneCount);
441    SkASSERT(span->final());
442    span->debugValidate();
443#endif
444}
445
446bool SkOpSpanBase::debugCoinEndLoopCheck() const {
447    int loop = 0;
448    const SkOpSpanBase* next = this;
449    SkOpSpanBase* nextCoin;
450    do {
451        nextCoin = next->fCoinEnd;
452        SkASSERT(nextCoin == this || nextCoin->fCoinEnd != nextCoin);
453        for (int check = 1; check < loop - 1; ++check) {
454            const SkOpSpanBase* checkCoin = this->fCoinEnd;
455            const SkOpSpanBase* innerCoin = checkCoin;
456            for (int inner = check + 1; inner < loop; ++inner) {
457                innerCoin = innerCoin->fCoinEnd;
458                if (checkCoin == innerCoin) {
459                    SkDebugf("*** bad coincident end loop ***\n");
460                    return false;
461                }
462            }
463        }
464        ++loop;
465    } while ((next = nextCoin) && next != this);
466    return true;
467}
468
469void SkOpSpanBase::debugValidate() const {
470#if DEBUG_VALIDATE
471    const SkOpPtT* ptT = &fPtT;
472    SkASSERT(ptT->span() == this);
473    do {
474//        SkASSERT(SkDPoint::RoughlyEqual(fPtT.fPt, ptT->fPt));
475        ptT->debugValidate();
476        ptT = ptT->next();
477    } while (ptT != &fPtT);
478    SkASSERT(this->debugCoinEndLoopCheck());
479    if (!this->final()) {
480        SkASSERT(this->upCast()->debugCoinLoopCheck());
481    }
482    if (fFromAngle) {
483        fFromAngle->debugValidate();
484    }
485    if (!this->final() && this->upCast()->toAngle()) {
486        this->upCast()->toAngle()->debugValidate();
487    }
488#endif
489}
490
491bool SkOpSpan::debugCoinLoopCheck() const {
492    int loop = 0;
493    const SkOpSpan* next = this;
494    SkOpSpan* nextCoin;
495    do {
496        nextCoin = next->fCoincident;
497        SkASSERT(nextCoin == this || nextCoin->fCoincident != nextCoin);
498        for (int check = 1; check < loop - 1; ++check) {
499            const SkOpSpan* checkCoin = this->fCoincident;
500            const SkOpSpan* innerCoin = checkCoin;
501            for (int inner = check + 1; inner < loop; ++inner) {
502                innerCoin = innerCoin->fCoincident;
503                if (checkCoin == innerCoin) {
504                    SkDebugf("*** bad coincident loop ***\n");
505                    return false;
506                }
507            }
508        }
509        ++loop;
510    } while ((next = nextCoin) && next != this);
511    return true;
512}
513
514// called only by test code
515int SkIntersections::debugCoincidentUsed() const {
516    if (!fIsCoincident[0]) {
517        SkASSERT(!fIsCoincident[1]);
518        return 0;
519    }
520    int count = 0;
521    SkDEBUGCODE(int count2 = 0;)
522    for (int index = 0; index < fUsed; ++index) {
523        if (fIsCoincident[0] & (1 << index)) {
524            ++count;
525        }
526#ifdef SK_DEBUG
527        if (fIsCoincident[1] & (1 << index)) {
528            ++count2;
529        }
530#endif
531    }
532    SkASSERT(count == count2);
533    return count;
534}
535
536#include "SkOpContour.h"
537
538int SkOpPtT::debugLoopLimit(bool report) const {
539    int loop = 0;
540    const SkOpPtT* next = this;
541    do {
542        for (int check = 1; check < loop - 1; ++check) {
543            const SkOpPtT* checkPtT = this->fNext;
544            const SkOpPtT* innerPtT = checkPtT;
545            for (int inner = check + 1; inner < loop; ++inner) {
546                innerPtT = innerPtT->fNext;
547                if (checkPtT == innerPtT) {
548                    if (report) {
549                        SkDebugf("*** bad ptT loop ***\n");
550                    }
551                    return loop;
552                }
553            }
554        }
555        ++loop;
556    } while ((next = next->fNext) && next != this);
557    return 0;
558}
559
560void SkOpPtT::debugValidate() const {
561#if DEBUG_VALIDATE
562    SkOpGlobalState::Phase phase = contour()->globalState()->phase();
563    if (phase == SkOpGlobalState::kIntersecting
564            || phase == SkOpGlobalState::kFixWinding) {
565        return;
566    }
567    SkASSERT(fNext);
568    SkASSERT(fNext != this);
569    SkASSERT(fNext->fNext);
570    SkASSERT(debugLoopLimit(false) == 0);
571#endif
572}
573
574static void output_scalar(SkScalar num) {
575    if (num == (int) num) {
576        SkDebugf("%d", (int) num);
577    } else {
578        SkString str;
579        str.printf("%1.9g", num);
580        int width = (int) str.size();
581        const char* cStr = str.c_str();
582        while (cStr[width - 1] == '0') {
583            --width;
584        }
585        str.resize(width);
586        SkDebugf("%sf", str.c_str());
587    }
588}
589
590static void output_points(const SkPoint* pts, int count) {
591    for (int index = 0; index < count; ++index) {
592        output_scalar(pts[index].fX);
593        SkDebugf(", ");
594        output_scalar(pts[index].fY);
595        if (index + 1 < count) {
596            SkDebugf(", ");
597        }
598    }
599}
600
601static void showPathContours(SkPath::RawIter& iter, const char* pathName) {
602    uint8_t verb;
603    SkPoint pts[4];
604    while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
605        switch (verb) {
606            case SkPath::kMove_Verb:
607                SkDebugf("    %s.moveTo(", pathName);
608                output_points(&pts[0], 1);
609                SkDebugf(");\n");
610                continue;
611            case SkPath::kLine_Verb:
612                SkDebugf("    %s.lineTo(", pathName);
613                output_points(&pts[1], 1);
614                SkDebugf(");\n");
615                break;
616            case SkPath::kQuad_Verb:
617                SkDebugf("    %s.quadTo(", pathName);
618                output_points(&pts[1], 2);
619                SkDebugf(");\n");
620                break;
621            case SkPath::kConic_Verb:
622                SkDebugf("    %s.conicTo(", pathName);
623                output_points(&pts[1], 2);
624                SkDebugf(", %1.9gf);\n", iter.conicWeight());
625                break;
626            case SkPath::kCubic_Verb:
627                SkDebugf("    %s.cubicTo(", pathName);
628                output_points(&pts[1], 3);
629                SkDebugf(");\n");
630                break;
631            case SkPath::kClose_Verb:
632                SkDebugf("    %s.close();\n", pathName);
633                break;
634            default:
635                SkDEBUGFAIL("bad verb");
636                return;
637        }
638    }
639}
640
641static const char* gFillTypeStr[] = {
642    "kWinding_FillType",
643    "kEvenOdd_FillType",
644    "kInverseWinding_FillType",
645    "kInverseEvenOdd_FillType"
646};
647
648void SkPathOpsDebug::ShowOnePath(const SkPath& path, const char* name, bool includeDeclaration) {
649    SkPath::RawIter iter(path);
650#define SUPPORT_RECT_CONTOUR_DETECTION 0
651#if SUPPORT_RECT_CONTOUR_DETECTION
652    int rectCount = path.isRectContours() ? path.rectContours(NULL, NULL) : 0;
653    if (rectCount > 0) {
654        SkTDArray<SkRect> rects;
655        SkTDArray<SkPath::Direction> directions;
656        rects.setCount(rectCount);
657        directions.setCount(rectCount);
658        path.rectContours(rects.begin(), directions.begin());
659        for (int contour = 0; contour < rectCount; ++contour) {
660            const SkRect& rect = rects[contour];
661            SkDebugf("path.addRect(%1.9g, %1.9g, %1.9g, %1.9g, %s);\n", rect.fLeft, rect.fTop,
662                    rect.fRight, rect.fBottom, directions[contour] == SkPath::kCCW_Direction
663                    ? "SkPath::kCCW_Direction" : "SkPath::kCW_Direction");
664        }
665        return;
666    }
667#endif
668    SkPath::FillType fillType = path.getFillType();
669    SkASSERT(fillType >= SkPath::kWinding_FillType && fillType <= SkPath::kInverseEvenOdd_FillType);
670    if (includeDeclaration) {
671        SkDebugf("    SkPath %s;\n", name);
672    }
673    SkDebugf("    %s.setFillType(SkPath::%s);\n", name, gFillTypeStr[fillType]);
674    iter.setPath(path);
675    showPathContours(iter, name);
676}
677