Index: tests/PathOpsDebug.cpp |
diff --git a/tests/PathOpsDebug.cpp b/tests/PathOpsDebug.cpp |
index 93fe33d99a64c1f1e5ef62700d43f0bb63a6aab9..d4edd14b48fcac32e2df530f4620b6395d6ebf27 100755 |
--- a/tests/PathOpsDebug.cpp |
+++ b/tests/PathOpsDebug.cpp |
@@ -9,6 +9,7 @@ |
#include "SkOpCoincidence.h" |
#include "SkOpContour.h" |
#include "SkIntersectionHelper.h" |
+#include "SkMutex.h" |
#include "SkOpSegment.h" |
#include "SkString.h" |
@@ -32,144 +33,6 @@ inline void DebugDumpHexFloat(float x) { |
SkDebugf("SkBits2Float(0x%08x)", SkFloat2Bits(x)); |
} |
-#if DEBUG_SHOW_TEST_NAME |
- |
-static void output_scalar(SkScalar num) { |
- if (num == (int) num) { |
- SkDebugf("%d", (int) num); |
- } else { |
- SkString str; |
- str.printf("%1.9g", num); |
- int width = (int) str.size(); |
- const char* cStr = str.c_str(); |
- while (cStr[width - 1] == '0') { |
- --width; |
- } |
- str.resize(width); |
- SkDebugf("%sf", str.c_str()); |
- } |
-} |
- |
-static void output_points(const SkPoint* pts, int count) { |
- for (int index = 0; index < count; ++index) { |
- output_scalar(pts[index].fX); |
- SkDebugf(", "); |
- output_scalar(pts[index].fY); |
- if (index + 1 < count) { |
- SkDebugf(", "); |
- } |
- } |
-} |
- |
-static void showPathContours(SkPath::RawIter& iter, const char* pathName) { |
- uint8_t verb; |
- SkPoint pts[4]; |
- while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { |
- switch (verb) { |
- case SkPath::kMove_Verb: |
- SkDebugf(" %s.moveTo(", pathName); |
- output_points(&pts[0], 1); |
- SkDebugf(");\n"); |
- continue; |
- case SkPath::kLine_Verb: |
- SkDebugf(" %s.lineTo(", pathName); |
- output_points(&pts[1], 1); |
- SkDebugf(");\n"); |
- break; |
- case SkPath::kQuad_Verb: |
- SkDebugf(" %s.quadTo(", pathName); |
- output_points(&pts[1], 2); |
- SkDebugf(");\n"); |
- break; |
- case SkPath::kConic_Verb: |
- SkDebugf(" %s.conicTo(", pathName); |
- output_points(&pts[1], 2); |
- SkDebugf(", %1.9gf);\n", iter.conicWeight()); |
- break; |
- case SkPath::kCubic_Verb: |
- SkDebugf(" %s.cubicTo(", pathName); |
- output_points(&pts[1], 3); |
- SkDebugf(");\n"); |
- break; |
- case SkPath::kClose_Verb: |
- SkDebugf(" %s.close();\n", pathName); |
- break; |
- default: |
- SkDEBUGFAIL("bad verb"); |
- return; |
- } |
- } |
-} |
- |
-static const char* gFillTypeStr[] = { |
- "kWinding_FillType", |
- "kEvenOdd_FillType", |
- "kInverseWinding_FillType", |
- "kInverseEvenOdd_FillType" |
-}; |
- |
-void SkPathOpsDebug::ShowOnePath(const SkPath& path, const char* name, bool includeDeclaration) { |
- SkPath::RawIter iter(path); |
-#define SUPPORT_RECT_CONTOUR_DETECTION 0 |
-#if SUPPORT_RECT_CONTOUR_DETECTION |
- int rectCount = path.isRectContours() ? path.rectContours(NULL, NULL) : 0; |
- if (rectCount > 0) { |
- SkTDArray<SkRect> rects; |
- SkTDArray<SkPath::Direction> directions; |
- rects.setCount(rectCount); |
- directions.setCount(rectCount); |
- path.rectContours(rects.begin(), directions.begin()); |
- for (int contour = 0; contour < rectCount; ++contour) { |
- const SkRect& rect = rects[contour]; |
- SkDebugf("path.addRect(%1.9g, %1.9g, %1.9g, %1.9g, %s);\n", rect.fLeft, rect.fTop, |
- rect.fRight, rect.fBottom, directions[contour] == SkPath::kCCW_Direction |
- ? "SkPath::kCCW_Direction" : "SkPath::kCW_Direction"); |
- } |
- return; |
- } |
-#endif |
- SkPath::FillType fillType = path.getFillType(); |
- SkASSERT(fillType >= SkPath::kWinding_FillType && fillType <= SkPath::kInverseEvenOdd_FillType); |
- if (includeDeclaration) { |
- SkDebugf(" SkPath %s;\n", name); |
- } |
- SkDebugf(" %s.setFillType(SkPath::%s);\n", name, gFillTypeStr[fillType]); |
- iter.setPath(path); |
- showPathContours(iter, name); |
-} |
- |
-static void show_function_header(const char* functionName) { |
- SkDebugf("\nstatic void %s(skiatest::Reporter* reporter, const char* filename) {\n", functionName); |
- if (strcmp("skphealth_com76", functionName) == 0) { |
- SkDebugf("found it\n"); |
- } |
-} |
- |
-static const char* gOpStrs[] = { |
- "kDifference_SkPathOp", |
- "kIntersect_SkPathOp", |
- "kUnion_SkPathOp", |
- "kXor_PathOp", |
- "kReverseDifference_SkPathOp", |
-}; |
- |
-static void show_op(SkPathOp op, const char* pathOne, const char* pathTwo) { |
- SkDebugf(" testPathOp(reporter, %s, %s, %s, filename);\n", pathOne, pathTwo, gOpStrs[op]); |
- SkDebugf("}\n"); |
-} |
- |
-SK_DECLARE_STATIC_MUTEX(gTestMutex); |
- |
-void SkPathOpsDebug::ShowPath(const SkPath& a, const SkPath& b, SkPathOp shapeOp, |
- const char* testName) { |
- SkAutoMutexAcquire ac(gTestMutex); |
- show_function_header(testName); |
- ShowOnePath(a, "path", true); |
- ShowOnePath(b, "pathB", true); |
- show_op(shapeOp, "path", "pathB"); |
-} |
-#endif |
- |
// if not defined by PathOpsDebug.cpp ... |
#if !defined SK_DEBUG && FORCE_RELEASE |
bool SkPathOpsDebug::ValidWind(int wind) { |
@@ -185,13 +48,34 @@ void SkPathOpsDebug::WindingPrintf(int wind) { |
} |
#endif |
-void SkDCubic::dump() const { |
+void SkDConic::dump() const { |
dumpInner(); |
+ SkDebugf("},\n"); |
+} |
+ |
+void SkDConic::dumpID(int id) const { |
+ dumpInner(); |
+ SkDebugf("} id=%d\n", id); |
+} |
+ |
+void SkDConic::dumpInner() const { |
+ SkDebugf("{{"); |
+ int index = 0; |
+ do { |
+ fPts[index].dump(); |
+ SkDebugf(", "); |
+ } while (++index < 2); |
+ fPts[index].dump(); |
+ SkDebugf("}, %1.9g", fWeight); |
+} |
+ |
+void SkDCubic::dump() const { |
+ this->dumpInner(); |
SkDebugf("}},\n"); |
} |
void SkDCubic::dumpID(int id) const { |
- dumpInner(); |
+ this->dumpInner(); |
SkDebugf("}} id=%d\n", id); |
} |
@@ -216,12 +100,44 @@ void SkDCubic::dumpInner() const { |
fPts[index].dump(); |
} |
+void SkDCurve::dumpID(int id) const { |
+#ifndef SK_RELEASE |
+ switch(fVerb) { |
+ case SkPath::kLine_Verb: |
+ fLine.dumpID(id); |
+ break; |
+ case SkPath::kQuad_Verb: |
+ fQuad.dumpID(id); |
+ break; |
+ case SkPath::kConic_Verb: |
+ fConic.dumpID(id); |
+ break; |
+ case SkPath::kCubic_Verb: |
+ fCubic.dumpID(id); |
+ break; |
+ default: |
+ SkASSERT(0); |
+ } |
+#else |
+ fCubic.dumpID(id); |
+#endif |
+} |
+ |
void SkDLine::dump() const { |
+ this->dumpInner(); |
+ SkDebugf("}},\n"); |
+} |
+ |
+void SkDLine::dumpID(int id) const { |
+ this->dumpInner(); |
+ SkDebugf("}} id=%d\n", id); |
+} |
+ |
+void SkDLine::dumpInner() const { |
SkDebugf("{{"); |
fPts[0].dump(); |
SkDebugf(", "); |
fPts[1].dump(); |
- SkDebugf("}},\n"); |
} |
void SkDPoint::dump() const { |
@@ -438,84 +354,328 @@ void SkPathOpsDebug::DumpContoursSpans(const SkTDArray<SkOpContour* >* contours) |
} |
} |
-const SkTSpan<SkDCubic>* DebugSpan(const SkTSect<SkDCubic>* sect, int id) { |
+template <typename TCurve, typename OppCurve> |
+const SkTSpan<TCurve, OppCurve>* DebugSpan(const SkTSect<TCurve, OppCurve>* sect, int id) { |
return sect->debugSpan(id); |
} |
-const SkTSpan<SkDQuad>* DebugSpan(const SkTSect<SkDQuad>* sect, int id) { |
- return sect->debugSpan(id); |
-} |
- |
-const SkTSpan<SkDCubic>* DebugT(const SkTSect<SkDCubic>* sect, double t) { |
+void DontCallDebugSpan(int id); |
+void DontCallDebugSpan(int id) { // exists to instantiate the templates |
+ SkDQuad quad; |
+ SkDConic conic; |
+ SkDCubic cubic; |
+ SkTSect<SkDQuad, SkDQuad> q1q2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDQuad, SkDConic> q1k2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDQuad, SkDCubic> q1c2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDQuad> k1q2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDConic> k1k2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDCubic> k1c2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDQuad> c1q2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDConic> c1k2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDCubic> c1c2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ DebugSpan(&q1q2, id); |
+ DebugSpan(&q1k2, id); |
+ DebugSpan(&q1c2, id); |
+ DebugSpan(&k1q2, id); |
+ DebugSpan(&k1k2, id); |
+ DebugSpan(&k1c2, id); |
+ DebugSpan(&c1q2, id); |
+ DebugSpan(&c1k2, id); |
+ DebugSpan(&c1c2, id); |
+} |
+ |
+template <typename TCurve, typename OppCurve> |
+const SkTSpan<TCurve, OppCurve>* DebugT(const SkTSect<TCurve, OppCurve>* sect, double t) { |
return sect->debugT(t); |
} |
-const SkTSpan<SkDQuad>* DebugT(const SkTSect<SkDQuad>* sect, double t) { |
- return sect->debugT(t); |
-} |
- |
-const SkTSpan<SkDCubic>* DebugSpan(const SkTSpan<SkDCubic>* span, int id) { |
- return span->debugSpan(id); |
-} |
- |
-const SkTSpan<SkDQuad>* DebugSpan(const SkTSpan<SkDQuad>* span, int id) { |
- return span->debugSpan(id); |
-} |
- |
-const SkTSpan<SkDCubic>* DebugT(const SkTSpan<SkDCubic>* span, double t) { |
- return span->debugT(t); |
-} |
- |
-const SkTSpan<SkDQuad>* DebugT(const SkTSpan<SkDQuad>* span, double t) { |
- return span->debugT(t); |
-} |
- |
-void Dump(const SkTSect<SkDCubic>* sect) { |
+void DontCallDebugT(double t); |
+void DontCallDebugT(double t) { // exists to instantiate the templates |
+ SkDQuad quad; |
+ SkDConic conic; |
+ SkDCubic cubic; |
+ SkTSect<SkDQuad, SkDQuad> q1q2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDQuad, SkDConic> q1k2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDQuad, SkDCubic> q1c2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDQuad> k1q2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDConic> k1k2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDCubic> k1c2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDQuad> c1q2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDConic> c1k2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDCubic> c1c2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ DebugT(&q1q2, t); |
+ DebugT(&q1k2, t); |
+ DebugT(&q1c2, t); |
+ DebugT(&k1q2, t); |
+ DebugT(&k1k2, t); |
+ DebugT(&k1c2, t); |
+ DebugT(&c1q2, t); |
+ DebugT(&c1k2, t); |
+ DebugT(&c1c2, t); |
+} |
+ |
+template <typename TCurve, typename OppCurve> |
+void Dump(const SkTSect<TCurve, OppCurve>* sect) { |
sect->dump(); |
} |
-void Dump(const SkTSect<SkDQuad>* sect) { |
- sect->dump(); |
-} |
- |
-void Dump(const SkTSpan<SkDCubic>* span) { |
- span->dump(); |
-} |
- |
-void Dump(const SkTSpan<SkDQuad>* span) { |
- span->dump(); |
-} |
- |
-void DumpBoth(SkTSect<SkDCubic>* sect1, SkTSect<SkDCubic>* sect2) { |
- sect1->dumpBoth(sect2); |
-} |
- |
-void DumpBoth(SkTSect<SkDQuad>* sect1, SkTSect<SkDQuad>* sect2) { |
+void DontCallDumpTSect(); |
+void DontCallDumpTSect() { // exists to instantiate the templates |
+ SkDQuad quad; |
+ SkDConic conic; |
+ SkDCubic cubic; |
+ SkTSect<SkDQuad, SkDQuad> q1q2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDQuad, SkDConic> q1k2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDQuad, SkDCubic> q1c2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDQuad> k1q2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDConic> k1k2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDCubic> k1c2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDQuad> c1q2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDConic> c1k2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDCubic> c1c2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ Dump(&q1q2); |
+ Dump(&q1k2); |
+ Dump(&q1c2); |
+ Dump(&k1q2); |
+ Dump(&k1k2); |
+ Dump(&k1c2); |
+ Dump(&c1q2); |
+ Dump(&c1k2); |
+ Dump(&c1c2); |
+} |
+ |
+template <typename TCurve, typename OppCurve> |
+void DumpBoth(SkTSect<TCurve, OppCurve>* sect1, SkTSect<OppCurve, TCurve>* sect2) { |
sect1->dumpBoth(sect2); |
} |
-void DumpCoin(SkTSect<SkDCubic>* sect1) { |
+void DontCallDumpBoth(); |
+void DontCallDumpBoth() { // exists to instantiate the templates |
+ SkDQuad quad; |
+ SkDConic conic; |
+ SkDCubic cubic; |
+ SkTSect<SkDQuad, SkDQuad> q1q2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDQuad, SkDConic> q1k2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDQuad, SkDCubic> q1c2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDQuad> k1q2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDConic> k1k2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDCubic> k1c2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDQuad> c1q2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDConic> c1k2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDCubic> c1c2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ DumpBoth(&q1q2, &q1q2); |
+ DumpBoth(&q1k2, &k1q2); |
+ DumpBoth(&q1c2, &c1q2); |
+ DumpBoth(&k1q2, &q1k2); |
+ DumpBoth(&k1k2, &k1k2); |
+ DumpBoth(&k1c2, &c1k2); |
+ DumpBoth(&c1q2, &q1c2); |
+ DumpBoth(&c1k2, &k1c2); |
+ DumpBoth(&c1c2, &c1c2); |
+} |
+ |
+template <typename TCurve, typename OppCurve> |
+void DumpBounded(SkTSect<TCurve, OppCurve>* sect1, int id) { |
+ sect1->dumpBounded(id); |
+} |
+ |
+void DontCallDumpBounded(); |
+void DontCallDumpBounded() { |
+ SkDQuad quad; |
+ SkDConic conic; |
+ SkDCubic cubic; |
+ SkTSect<SkDQuad, SkDQuad> q1q2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDQuad, SkDConic> q1k2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDQuad, SkDCubic> q1c2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDQuad> k1q2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDConic> k1k2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDCubic> k1c2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDQuad> c1q2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDConic> c1k2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDCubic> c1c2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ DumpBounded(&q1q2, 0); |
+ DumpBounded(&q1k2, 0); |
+ DumpBounded(&q1c2, 0); |
+ DumpBounded(&k1q2, 0); |
+ DumpBounded(&k1k2, 0); |
+ DumpBounded(&k1c2, 0); |
+ DumpBounded(&c1q2, 0); |
+ DumpBounded(&c1k2, 0); |
+ DumpBounded(&c1c2, 0); |
+} |
+ |
+template <typename TCurve, typename OppCurve> |
+void DumpBounds(SkTSect<TCurve, OppCurve>* sect1) { |
+ sect1->dumpBounds(); |
+} |
+ |
+void DontCallDumpBounds(); |
+void DontCallDumpBounds() { |
+ SkDQuad quad; |
+ SkDConic conic; |
+ SkDCubic cubic; |
+ SkTSect<SkDQuad, SkDQuad> q1q2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDQuad, SkDConic> q1k2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDQuad, SkDCubic> q1c2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDQuad> k1q2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDConic> k1k2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDCubic> k1c2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDQuad> c1q2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDConic> c1k2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDCubic> c1c2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ DumpBounds(&q1q2); |
+ DumpBounds(&q1k2); |
+ DumpBounds(&q1c2); |
+ DumpBounds(&k1q2); |
+ DumpBounds(&k1k2); |
+ DumpBounds(&k1c2); |
+ DumpBounds(&c1q2); |
+ DumpBounds(&c1k2); |
+ DumpBounds(&c1c2); |
+} |
+ |
+template <typename TCurve, typename OppCurve> |
+void DumpCoin(SkTSect<TCurve, OppCurve>* sect1) { |
sect1->dumpCoin(); |
} |
-void DumpCoin(SkTSect<SkDQuad>* sect1) { |
- sect1->dumpCoin(); |
+void DontCallDumpCoin(); |
+void DontCallDumpCoin() { // exists to instantiate the templates |
+ SkDQuad quad; |
+ SkDConic conic; |
+ SkDCubic cubic; |
+ SkTSect<SkDQuad, SkDQuad> q1q2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDQuad, SkDConic> q1k2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDQuad, SkDCubic> q1c2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDQuad> k1q2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDConic> k1k2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDCubic> k1c2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDQuad> c1q2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDConic> c1k2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDCubic> c1c2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ DumpCoin(&q1q2); |
+ DumpCoin(&q1k2); |
+ DumpCoin(&q1c2); |
+ DumpCoin(&k1q2); |
+ DumpCoin(&k1k2); |
+ DumpCoin(&k1c2); |
+ DumpCoin(&c1q2); |
+ DumpCoin(&c1k2); |
+ DumpCoin(&c1c2); |
+} |
+ |
+template <typename TCurve, typename OppCurve> |
+void DumpCoinCurves(SkTSect<TCurve, OppCurve>* sect1) { |
+ sect1->dumpCoinCurves(); |
} |
-void DumpCoinCurves(SkTSect<SkDCubic>* sect1) { |
- sect1->dumpCoinCurves(); |
+void DontCallDumpCoinCurves(); |
+void DontCallDumpCoinCurves() { // exists to instantiate the templates |
+ SkDQuad quad; |
+ SkDConic conic; |
+ SkDCubic cubic; |
+ SkTSect<SkDQuad, SkDQuad> q1q2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDQuad, SkDConic> q1k2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDQuad, SkDCubic> q1c2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDQuad> k1q2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDConic> k1k2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDCubic> k1c2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDQuad> c1q2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDConic> c1k2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDCubic> c1c2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ DumpCoinCurves(&q1q2); |
+ DumpCoinCurves(&q1k2); |
+ DumpCoinCurves(&q1c2); |
+ DumpCoinCurves(&k1q2); |
+ DumpCoinCurves(&k1k2); |
+ DumpCoinCurves(&k1c2); |
+ DumpCoinCurves(&c1q2); |
+ DumpCoinCurves(&c1k2); |
+ DumpCoinCurves(&c1c2); |
+} |
+ |
+template <typename TCurve, typename OppCurve> |
+void DumpCurves(const SkTSect<TCurve, OppCurve>* sect) { |
+ sect->dumpCurves(); |
} |
-void DumpCoinCurves(SkTSect<SkDQuad>* sect1) { |
- sect1->dumpCoinCurves(); |
+void DontCallDumpCurves(); |
+void DontCallDumpCurves() { // exists to instantiate the templates |
+ SkDQuad quad; |
+ SkDConic conic; |
+ SkDCubic cubic; |
+ SkTSect<SkDQuad, SkDQuad> q1q2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDQuad, SkDConic> q1k2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDQuad, SkDCubic> q1c2(quad PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDQuad> k1q2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDConic> k1k2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDConic, SkDCubic> k1c2(conic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDQuad> c1q2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDConic> c1k2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ SkTSect<SkDCubic, SkDCubic> c1c2(cubic PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
+ DumpCurves(&q1q2); |
+ DumpCurves(&q1k2); |
+ DumpCurves(&q1c2); |
+ DumpCurves(&k1q2); |
+ DumpCurves(&k1k2); |
+ DumpCurves(&k1c2); |
+ DumpCurves(&c1q2); |
+ DumpCurves(&c1k2); |
+ DumpCurves(&c1c2); |
+} |
+ |
+template <typename TCurve, typename OppCurve> |
+void Dump(const SkTSpan<TCurve, OppCurve>* span) { |
+ span->dump(); |
} |
-void DumpCurves(const SkTSect<SkDQuad>* sect) { |
- sect->dumpCurves(); |
+void DontCallDumpTSpan(); |
+void DontCallDumpTSpan() { // exists to instantiate the templates |
+ SkTSpan<SkDQuad, SkDQuad> q1q2; q1q2.debugInit(); |
+ SkTSpan<SkDQuad, SkDConic> q1k2; q1k2.debugInit(); |
+ SkTSpan<SkDQuad, SkDCubic> q1c2; q1c2.debugInit(); |
+ SkTSpan<SkDConic, SkDQuad> k1q2; k1q2.debugInit(); |
+ SkTSpan<SkDConic, SkDConic> k1k2; k1k2.debugInit(); |
+ SkTSpan<SkDConic, SkDCubic> k1c2; k1c2.debugInit(); |
+ SkTSpan<SkDCubic, SkDQuad> c1q2; c1q2.debugInit(); |
+ SkTSpan<SkDCubic, SkDConic> c1k2; c1k2.debugInit(); |
+ SkTSpan<SkDCubic, SkDCubic> c1c2; c1c2.debugInit(); |
+ Dump(&q1q2); |
+ Dump(&q1k2); |
+ Dump(&q1c2); |
+ Dump(&k1q2); |
+ Dump(&k1k2); |
+ Dump(&k1c2); |
+ Dump(&c1q2); |
+ Dump(&c1k2); |
+ Dump(&c1c2); |
+} |
+ |
+template <typename TCurve, typename OppCurve> |
+void DumpCoin(const SkTSpan<TCurve, OppCurve>* span) { |
+ span->dumpCoin(); |
} |
-void DumpCurves(const SkTSect<SkDCubic>* sect) { |
- sect->dumpCurves(); |
+void DontCallDumpSpanCoin(); |
+void DontCallDumpSpanCoin() { // exists to instantiate the templates |
+ SkTSpan<SkDQuad, SkDQuad> q1q2; q1q2.debugInit(); |
+ SkTSpan<SkDQuad, SkDConic> q1k2; q1k2.debugInit(); |
+ SkTSpan<SkDQuad, SkDCubic> q1c2; q1c2.debugInit(); |
+ SkTSpan<SkDConic, SkDQuad> k1q2; k1q2.debugInit(); |
+ SkTSpan<SkDConic, SkDConic> k1k2; k1k2.debugInit(); |
+ SkTSpan<SkDConic, SkDCubic> k1c2; k1c2.debugInit(); |
+ SkTSpan<SkDCubic, SkDQuad> c1q2; c1q2.debugInit(); |
+ SkTSpan<SkDCubic, SkDConic> c1k2; c1k2.debugInit(); |
+ SkTSpan<SkDCubic, SkDCubic> c1c2; c1c2.debugInit(); |
+ DumpCoin(&q1q2); |
+ DumpCoin(&q1k2); |
+ DumpCoin(&q1c2); |
+ DumpCoin(&k1q2); |
+ DumpCoin(&k1k2); |
+ DumpCoin(&k1c2); |
+ DumpCoin(&c1q2); |
+ DumpCoin(&c1k2); |
+ DumpCoin(&c1c2); |
} |
static void dumpTestCase(const SkDQuad& quad1, const SkDQuad& quad2, int testNo) { |
@@ -903,13 +1063,20 @@ void SkOpSegment::dumpCoin() const { |
void SkOpSegment::dumpPts() const { |
int last = SkPathOpsVerbToPoints(fVerb); |
SkDebugf("seg=%d {{", this->debugID()); |
+ if (fVerb == SkPath::kConic_Verb) { |
+ SkDebugf("{"); |
+ } |
int index = 0; |
do { |
SkDPoint::Dump(fPts[index]); |
SkDebugf(", "); |
} while (++index < last); |
SkDPoint::Dump(fPts[index]); |
- SkDebugf("}}\n"); |
+ SkDebugf("}}"); |
+ if (fVerb == SkPath::kConic_Verb) { |
+ SkDebugf(", %1.9gf}", fWeight); |
+ } |
+ SkDebugf("\n"); |
} |
void SkCoincidentSpans::dump() const { |
@@ -948,12 +1115,12 @@ void SkOpCoincidence::dump() const { |
} |
void SkOpContour::dump() { |
- SkDebugf("contour=%d count=%d\n", this->debugID(), fCount); |
+ SkDebugf("contour=%d count=%d op=%d xor=%d\n", this->debugID(), fCount, fOperand, fXor); |
if (!fCount) { |
return; |
} |
const SkOpSegment* segment = &fHead; |
- PATH_OPS_DEBUG_CODE(fIndent = 0); |
+ SkDEBUGCODE(fIndent = 0); |
indentDump(); |
do { |
segment->dump(); |
@@ -962,12 +1129,12 @@ void SkOpContour::dump() { |
} |
void SkOpContour::dumpAll() { |
- SkDebugf("contour=%d count=%d\n", this->debugID(), fCount); |
+ SkDebugf("contour=%d count=%d op=%d xor=%d\n", this->debugID(), fCount, fOperand, fXor); |
if (!fCount) { |
return; |
} |
const SkOpSegment* segment = &fHead; |
- PATH_OPS_DEBUG_CODE(fIndent = 0); |
+ SkDEBUGCODE(fIndent = 0); |
indentDump(); |
do { |
segment->dumpAll(); |