From 45fa447460f70ec21d22cf4e1531490acfd3c578 Mon Sep 17 00:00:00 2001 From: caryclark Date: Fri, 16 Jan 2015 07:04:10 -0800 Subject: new files for pathops geometric intersection There's no gyp references to these new files, so this should only have the effect of reducing the size of the commit that turns this code on. TBR= Review URL: https://codereview.chromium.org/853223002 --- tests/PathOpsTSectDebug.h | 84 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 tests/PathOpsTSectDebug.h (limited to 'tests/PathOpsTSectDebug.h') diff --git a/tests/PathOpsTSectDebug.h b/tests/PathOpsTSectDebug.h new file mode 100644 index 0000000000..5f8915f681 --- /dev/null +++ b/tests/PathOpsTSectDebug.h @@ -0,0 +1,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 +void SkTSect::dump() const { + SkDebugf("id=%d", debugID()); + const SkTSpan* test = fHead; + if (!test) { + SkDebugf(" (empty)"); + return; + } + do { + SkDebugf(" "); + test->dump(this); + } while ((test = test->next())); +} + +template +void SkTSect::dumpBoth(const SkTSect& opp) const { + dump(); + SkDebugf(" "); + opp.dump(); + SkDebugf("\n"); +} + +template +void SkTSect::dumpBoth(const SkTSect* opp) const { + dumpBoth(*opp); +} + +template +void SkTSect::dumpCurves() const { + const SkTSpan* test = fHead; + do { + test->fPart.dump(); + } while ((test = test->next())); +} + +#if !DEBUG_T_SECT +template +int SkTSpan::debugID(const SkTSect* 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 +void SkTSpan::dumpID(const SkTSect* sect) const { + if (fCoinStart.isCoincident()) { + SkDebugf("%c", '*'); + } + SkDebugf("%d", debugID(sect)); + if (fCoinEnd.isCoincident()) { + SkDebugf("%c", '*'); + } +} + +template +void SkTSpan::dump(const SkTSect* 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("]"); +} -- cgit v1.2.3