fix fuzzers

Many old pathops-related fuzz failures have built up while
the codebase was under a state a flux. Now that the code
is stable, address these failures.

Most of the CL plumbs the debug global state to downstream
routines so that, if the data is not trusted (ala fuzzed)
the function can safely exit without asserting.

TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2426173002

Review-Url: https://chromiumcodereview.appspot.com/2426173002
diff --git a/src/pathops/SkAddIntersections.cpp b/src/pathops/SkAddIntersections.cpp
index b3a82cd..17bc9e2 100644
--- a/src/pathops/SkAddIntersections.cpp
+++ b/src/pathops/SkAddIntersections.cpp
@@ -450,8 +450,10 @@
                         }
                         case SkIntersectionHelper::kCubic_Segment: {
                             swap = true;
-                            pts = ts.intersect(cubic2.set(wn.pts()),
-                                    conic1.set(wt.pts(), wt.weight()));
+                            pts = ts.intersect(cubic2.set(wn.pts()
+                                    SkDEBUGPARAMS(ts.globalState())),
+                                    conic1.set(wt.pts(), wt.weight()
+                                    SkDEBUGPARAMS(ts.globalState())));
                             debugShowCubicConicIntersection(pts, wn, wt, ts);
                             break;
                         }
@@ -479,8 +481,10 @@
                             break;
                         }
                         case SkIntersectionHelper::kConic_Segment: {
-                            pts = ts.intersect(cubic1.set(wt.pts()),
-                                    conic2.set(wn.pts(), wn.weight()));
+                            pts = ts.intersect(cubic1.set(wt.pts()
+                                    SkDEBUGPARAMS(ts.globalState())),
+                                    conic2.set(wn.pts(), wn.weight()
+                                    SkDEBUGPARAMS(ts.globalState())));
                             debugShowCubicConicIntersection(pts, wt, wn, ts);
                             break;
                         }
diff --git a/src/pathops/SkDConicLineIntersection.cpp b/src/pathops/SkDConicLineIntersection.cpp
index eb32068..102a4c3 100644
--- a/src/pathops/SkDConicLineIntersection.cpp
+++ b/src/pathops/SkDConicLineIntersection.cpp
@@ -105,8 +105,8 @@
             double conicT = rootVals[index];
             double lineT = this->findLineT(conicT);
 #ifdef SK_DEBUG
-            if (!fIntersections->debugGlobalState()
-                    || !fIntersections->debugGlobalState()->debugSkipAssert()) {
+            if (!fIntersections->globalState()
+                    || !fIntersections->globalState()->debugSkipAssert()) {
                 SkDEBUGCODE(SkDPoint conicPt = fConic.ptAtT(conicT));
                 SkDEBUGCODE(SkDPoint linePt = fLine->ptAtT(lineT));
                 SkASSERT(conicPt.approximatelyDEqual(linePt));
diff --git a/src/pathops/SkDCubicLineIntersection.cpp b/src/pathops/SkDCubicLineIntersection.cpp
index fd060de..ceedce1 100644
--- a/src/pathops/SkDCubicLineIntersection.cpp
+++ b/src/pathops/SkDCubicLineIntersection.cpp
@@ -122,6 +122,7 @@
         double adj = fLine[1].fX - fLine[0].fX;
         double opp = fLine[1].fY - fLine[0].fY;
         SkDCubic c;
+        SkDEBUGCODE(c.fDebugGlobalState = fIntersections->globalState());
         for (int n = 0; n < 4; ++n) {
             c[n].fX = (fCubic[n].fY - fLine[0].fY) * adj - (fCubic[n].fX - fLine[0].fX) * opp;
         }
diff --git a/src/pathops/SkDLineIntersection.cpp b/src/pathops/SkDLineIntersection.cpp
index 71e2a06..082e298 100644
--- a/src/pathops/SkDLineIntersection.cpp
+++ b/src/pathops/SkDLineIntersection.cpp
@@ -152,7 +152,7 @@
                         continue;
                     }
                     SkASSERT(a[iA] != b[nearer]);
-                    SkASSERT(iA == (bNearA[nearer] > 0.5));
+                    SkOPASSERT(iA == (bNearA[nearer] > 0.5));
                     insertNear(iA, nearer, a[iA], b[nearer]);
                     aNearB[iA] = -1;
                     bNearA[nearer] = -1;
diff --git a/src/pathops/SkIntersections.h b/src/pathops/SkIntersections.h
index abc10e1..d5d217c 100644
--- a/src/pathops/SkIntersections.h
+++ b/src/pathops/SkIntersections.h
@@ -104,7 +104,7 @@
     }
 
 #ifdef SK_DEBUG
-    SkOpGlobalState* debugGlobalState() { return fDebugGlobalState; }
+    SkOpGlobalState* globalState() const { return fDebugGlobalState; }
 #endif
 
     bool hasT(double t) const {
@@ -308,9 +308,9 @@
     void cleanUpParallelLines(bool parallel);
     void computePoints(const SkDLine& line, int used);
 
-    SkDPoint fPt[12];  // FIXME: since scans store points as SkPoint, this should also
+    SkDPoint fPt[13];  // FIXME: since scans store points as SkPoint, this should also
     SkDPoint fPt2[2];  // used by nearly same to store alternate intersection point
-    double fT[2][12];
+    double fT[2][13];
     uint16_t fIsCoincident[2];  // bit set for each curve's coincident T
     bool fNearlySame[2];  // true if end points nearly match
     unsigned char fUsed;
diff --git a/src/pathops/SkOpAngle.cpp b/src/pathops/SkOpAngle.cpp
index 99f93dd..1223ac1 100644
--- a/src/pathops/SkOpAngle.cpp
+++ b/src/pathops/SkOpAngle.cpp
@@ -152,7 +152,7 @@
         // FIXME : once this is verified to work, remove one opposite angle call
         SkDEBUGCODE(bool lrOpposite = lh->oppositePlanes(rh));
         bool ltOpposite = lh->oppositePlanes(this);
-        SkASSERT(lrOpposite != ltOpposite);
+        SkOPASSERT(lrOpposite != ltOpposite);
         return COMPARE_RESULT(8, ltOpposite);
     } else if (ltOrder == 1 && trOrder == 0) {
         SkASSERT(lrOrder < 0);
diff --git a/src/pathops/SkOpCoincidence.cpp b/src/pathops/SkOpCoincidence.cpp
index aa5f5bf..d16f6f8 100755
--- a/src/pathops/SkOpCoincidence.cpp
+++ b/src/pathops/SkOpCoincidence.cpp
@@ -128,11 +128,12 @@
 // A coincident span is unordered if the pairs of points in the main and opposite curves'
 // t values do not ascend or descend. For instance, if a tightly arced quadratic is
 // coincident with another curve, it may intersect it out of order.
-bool SkCoincidentSpans::ordered() const {
+bool SkCoincidentSpans::ordered(bool* result) const {
     const SkOpSpanBase* start = this->coinPtTStart()->span();
     const SkOpSpanBase* end = this->coinPtTEnd()->span();
     const SkOpSpanBase* next = start->upCast()->next();
     if (next == end) {
+        *result = true;
         return true;
     }
     bool flipped = this->flipped();
@@ -141,21 +142,24 @@
     do {
         const SkOpPtT* opp = next->contains(oppSeg);
         if (!opp) {
-            SkASSERT(0);  // may assert if coincident span isn't fully processed
-            continue;
+            SkOPOBJASSERT(start, 0);  // may assert if coincident span isn't fully processed
+            return false;
         }
         if ((oppLastT > opp->fT) != flipped) {
-            return false;
+            *result = false;
+            return true;
         }
         oppLastT = opp->fT;
         if (next == end) {
             break;
         }
         if (!next->upCastable()) {
-            return false;
+            *result = false;
+            return true;
         }
         next = next->upCast()->next();
     } while (true);
+    *result = true;
     return true;
 }
 
@@ -234,7 +238,7 @@
     coinPtTEnd = coinPtTEnd->span()->ptT();
     oppPtTStart = oppPtTStart->span()->ptT();
     oppPtTEnd = oppPtTEnd->span()->ptT();
-    SkASSERT(coinPtTStart->fT < coinPtTEnd->fT);
+    SkOPASSERT(coinPtTStart->fT < coinPtTEnd->fT);
     SkASSERT(oppPtTStart->fT != oppPtTEnd->fT);
     SkOPASSERT(!coinPtTStart->deleted());
     SkOPASSERT(!coinPtTEnd->deleted());
@@ -754,7 +758,7 @@
     // save head so that walker can iterate over old data unperturbed
     // addifmissing adds to head freely then add saved head in the end
         const SkOpPtT* ocs = outer->coinPtTStart();
-        SkASSERT(!ocs->deleted());
+        FAIL_IF(ocs->deleted());
         const SkOpSegment* outerCoin = ocs->segment();
         SkASSERT(!outerCoin->done());  // if it's done, should have already been removed from list
         const SkOpPtT* oos = outer->oppPtTStart();
@@ -772,9 +776,9 @@
             const SkOpPtT* ics = inner->coinPtTStart();
             FAIL_IF(ics->deleted());
             const SkOpSegment* innerCoin = ics->segment();
-            SkASSERT(!innerCoin->done());
+            FAIL_IF(innerCoin->done());
             const SkOpPtT* ios = inner->oppPtTStart();
-            SkASSERT(!ios->deleted());
+            FAIL_IF(ios->deleted());
             const SkOpSegment* innerOpp = ios->segment();
             SkASSERT(!innerOpp->done());
             SkOpSegment* innerCoinWritable = const_cast<SkOpSegment*>(innerCoin);
@@ -855,9 +859,11 @@
     }
     const SkOpPtT* s2 = overS->find(seg2);
     const SkOpPtT* e2 = overE->find(seg2);
+    FAIL_IF(!e2);
     if (!s2->starter(e2)->span()->upCast()->windValue()) {
         s2 = overS->find(seg2o);
         e2 = overE->find(seg2o);
+        FAIL_IF(!s2);
         if (!s2->starter(e2)->span()->upCast()->windValue()) {
             return true;
         }
@@ -956,11 +962,11 @@
 }
 
 // walk span sets in parallel, moving winding from one to the other
-void SkOpCoincidence::apply(DEBUG_COIN_DECLARE_ONLY_PARAMS()) {
+bool SkOpCoincidence::apply(DEBUG_COIN_DECLARE_ONLY_PARAMS()) {
     DEBUG_SET_PHASE();
     SkCoincidentSpans* coin = fHead;
     if (!coin) {
-        return;
+        return true;
     }
     do {
         SkOpSpan* start = coin->coinPtTStartWritable()->span()->upCast();
@@ -1055,6 +1061,7 @@
 #endif
             start->setWindValue(windValue);
             start->setOppValue(oppValue);
+            FAIL_IF(oWindValue == -1);
             oStart->setWindValue(oWindValue);
             oStart->setOppValue(oOppValue);
             if (!windValue && !oppValue) {
@@ -1076,6 +1083,7 @@
             oStart = oNext->upCast();
         } while (true);
     } while ((coin = coin->next()));
+    return true;
 }
 
 // Please keep this in sync with debugRelease()
@@ -1272,7 +1280,7 @@
         SkOpSpanBase* startBase = coin->coinPtTStartWritable()->span();
         FAIL_IF(!startBase->upCastable());
         SkOpSpan* start = startBase->upCast();
-        SkASSERT(!start->deleted());
+        FAIL_IF(start->deleted());
         SkOpSpanBase* end = coin->coinPtTEndWritable()->span();
         SkOPASSERT(!end->deleted());
         SkOpSpanBase* oStart = coin->oppPtTStartWritable()->span();
@@ -1291,7 +1299,8 @@
         const SkOpSegment* oSegment = oStart->segment();
         SkOpSpanBase* next = start;
         SkOpSpanBase* oNext = oStart;
-        bool ordered = coin->ordered();
+        bool ordered;
+        FAIL_IF(!coin->ordered(&ordered));
         while ((next = next->upCast()->next()) != end) {
             FAIL_IF(!next->upCastable());
             SkAssertResult(next->upCast()->insertCoincidence(oSegment, flipped, ordered));
diff --git a/src/pathops/SkOpCoincidence.h b/src/pathops/SkOpCoincidence.h
index e2188be..af84870 100644
--- a/src/pathops/SkOpCoincidence.h
+++ b/src/pathops/SkOpCoincidence.h
@@ -73,7 +73,7 @@
     // to a new span pair
     SkOpPtT* oppPtTStartWritable() const { return const_cast<SkOpPtT*>(fOppPtTStart); }
     SkOpPtT* oppPtTEndWritable() const { return const_cast<SkOpPtT*>(fOppPtTEnd); }
-    bool ordered() const;
+    bool ordered(bool* result) const;
 
     void set(SkCoincidentSpans* next, const SkOpPtT* coinPtTStart, const SkOpPtT* coinPtTEnd,
             const SkOpPtT* oppPtTStart, const SkOpPtT* oppPtTEnd);
@@ -108,7 +108,7 @@
     }
 
     void setOppPtTStart(const SkOpPtT* ptT) {
-        SkASSERT(ptT == ptT->span()->ptT());
+        SkOPASSERT(ptT == ptT->span()->ptT());
         SkOPASSERT(!fOppPtTEnd || ptT->fT != fOppPtTEnd->fT);
         SkASSERT(!fOppPtTEnd || fOppPtTEnd->segment() == ptT->segment());
         fOppPtTStart = ptT;
@@ -150,7 +150,7 @@
     bool addEndMovedSpans(DEBUG_COIN_DECLARE_ONLY_PARAMS());
     bool addExpanded(DEBUG_COIN_DECLARE_ONLY_PARAMS());
     bool addMissing(bool* added  DEBUG_COIN_DECLARE_PARAMS());
-    void apply(DEBUG_COIN_DECLARE_ONLY_PARAMS());
+    bool apply(DEBUG_COIN_DECLARE_ONLY_PARAMS());
     bool contains(const SkOpPtT* coinPtTStart, const SkOpPtT* coinPtTEnd,
                   const SkOpPtT* oppPtTStart, const SkOpPtT* oppPtTEnd) const;
     void correctEnds(DEBUG_COIN_DECLARE_ONLY_PARAMS());
diff --git a/src/pathops/SkOpSegment.cpp b/src/pathops/SkOpSegment.cpp
index 6012d83..439392f 100644
--- a/src/pathops/SkOpSegment.cpp
+++ b/src/pathops/SkOpSegment.cpp
@@ -169,18 +169,18 @@
     path->deferredMove(start->ptT());
     switch (verb) {
         case SkPath::kLine_Verb:
-            path->deferredLine(end->ptT());
+            FAIL_IF(!path->deferredLine(end->ptT()));
             break;
         case SkPath::kQuad_Verb:
-            path->quadTo(curvePart.fCurve.fQuad.fPts[1].asSkPoint(), end->ptT());
+            path->quadTo(curvePart.fCurve.fQuad[1].asSkPoint(), end->ptT());
             break;
         case SkPath::kConic_Verb:
-            path->conicTo(curvePart.fCurve.fConic.fPts[1].asSkPoint(), end->ptT(),
+            path->conicTo(curvePart.fCurve.fConic[1].asSkPoint(), end->ptT(),
                     curvePart.fCurve.fConic.fWeight);
             break;
         case SkPath::kCubic_Verb:
-            path->cubicTo(curvePart.fCurve.fCubic.fPts[1].asSkPoint(),
-                    curvePart.fCurve.fCubic.fPts[2].asSkPoint(), end->ptT());
+            path->cubicTo(curvePart.fCurve.fCubic[1].asSkPoint(),
+                    curvePart.fCurve.fCubic[2].asSkPoint(), end->ptT());
             break;
         default:
             SkASSERT(0);
@@ -225,6 +225,7 @@
         return true;
     }
     this->globalState()->resetAllocatedOpSpan();
+    FAIL_IF(!between(0, newT, 1));
     SkOpPtT* newPtT = this->addT(newT);
     *startOver |= this->globalState()->allocatedOpSpan();
     if (!newPtT) {
diff --git a/src/pathops/SkPathOpsCommon.cpp b/src/pathops/SkPathOpsCommon.cpp
index a1cd7bb..7387249 100644
--- a/src/pathops/SkPathOpsCommon.cpp
+++ b/src/pathops/SkPathOpsCommon.cpp
@@ -318,7 +318,9 @@
     do {
         SkOpCoincidence* pairs = overlaps.isEmpty() ? coincidence : &overlaps;
         // adjust the winding value to account for coincident edges
-        pairs->apply(DEBUG_ITER_ONLY_PARAMS(SAFETY_COUNT - safetyHatch));  
+        if (!pairs->apply(DEBUG_ITER_ONLY_PARAMS(SAFETY_COUNT - safetyHatch))) {
+            return false;
+        } 
         // For each coincident pair that overlaps another, when the receivers (the 1st of the pair)
         // are different, construct a new pair to resolve their mutual span
         if (!pairs->findOverlaps(&overlaps  DEBUG_ITER_PARAMS(SAFETY_COUNT - safetyHatch))) {
diff --git a/src/pathops/SkPathOpsConic.cpp b/src/pathops/SkPathOpsConic.cpp
index dd52321..82f3a7b 100644
--- a/src/pathops/SkPathOpsConic.cpp
+++ b/src/pathops/SkPathOpsConic.cpp
@@ -156,7 +156,8 @@
     double bx = 2 * dx - (ax + cx) / 2;
     double by = 2 * dy - (ay + cy) / 2;
     double bz = 2 * dz - (az + cz) / 2;
-    SkDConic dst = {{{{ax / az, ay / az}, {bx / bz, by / bz}, {cx / cz, cy / cz}}},
+    SkDConic dst = {{{{ax / az, ay / az}, {bx / bz, by / bz}, {cx / cz, cy / cz}}
+            SkDEBUGPARAMS(fPts.fDebugGlobalState) },
             SkDoubleToScalar(bz / sqrt(az * cz)) };
     return dst;
 }
diff --git a/src/pathops/SkPathOpsConic.h b/src/pathops/SkPathOpsConic.h
index 4cbe147..4236279 100644
--- a/src/pathops/SkPathOpsConic.h
+++ b/src/pathops/SkPathOpsConic.h
@@ -31,15 +31,23 @@
         fPts.debugInit();
     }
 
+    void debugSet(const SkDPoint* pts, SkScalar weight);
+
     SkDConic flip() const {
-        SkDConic result = {{{fPts[2], fPts[1], fPts[0]}}, fWeight};
+        SkDConic result = {{{fPts[2], fPts[1], fPts[0]}
+                SkDEBUGPARAMS(fPts.fDebugGlobalState) }, fWeight};
         return result;
     }
 
+#ifdef SK_DEBUG
+    SkOpGlobalState* globalState() const { return fPts.globalState(); }
+#endif
+
     static bool IsConic() { return true; }
 
-    const SkDConic& set(const SkPoint pts[kPointCount], SkScalar weight) {
-        fPts.set(pts);
+    const SkDConic& set(const SkPoint pts[kPointCount], SkScalar weight
+            SkDEBUGPARAMS(SkOpGlobalState* state = nullptr)) {
+        fPts.set(pts  SkDEBUGPARAMS(state));
         fWeight = weight;
         return *this;
     }
@@ -117,6 +125,7 @@
     void dump() const;
     void dumpID(int id) const;
     void dumpInner() const;
+
 };
 
 
diff --git a/src/pathops/SkPathOpsCubic.cpp b/src/pathops/SkPathOpsCubic.cpp
index bdae492..eaf9062 100644
--- a/src/pathops/SkPathOpsCubic.cpp
+++ b/src/pathops/SkPathOpsCubic.cpp
@@ -36,7 +36,7 @@
     double calcDist = calcPos - axisIntercept;
     do {
         double priorT = t - step;
-        SkASSERT(priorT >= min);
+        SkOPASSERT(priorT >= min);
         SkDPoint lessPt = ptAtT(priorT);
         if (approximately_equal_half(lessPt.fX, cubicAtT.fX)
                 && approximately_equal_half(lessPt.fY, cubicAtT.fY)) {
diff --git a/src/pathops/SkPathOpsCubic.h b/src/pathops/SkPathOpsCubic.h
index 16bca79..f868fbe 100644
--- a/src/pathops/SkPathOpsCubic.h
+++ b/src/pathops/SkPathOpsCubic.h
@@ -58,6 +58,8 @@
         sk_bzero(fPts, sizeof(fPts));
     }
 
+    void debugSet(const SkDPoint* pts);
+
     void dump() const;  // callable from the debugger when the implementation code is linked in
     void dumpID(int id) const;
     void dumpInner() const;
@@ -72,6 +74,11 @@
     }
 
     int findMaxCurvature(double tValues[]) const;
+
+#ifdef SK_DEBUG
+    SkOpGlobalState* globalState() const { return fDebugGlobalState; }
+#endif
+
     bool hullIntersects(const SkDCubic& c2, bool* isLinear) const;
     bool hullIntersects(const SkDConic& c, bool* isLinear) const;
     bool hullIntersects(const SkDQuad& c2, bool* isLinear) const;
@@ -98,11 +105,14 @@
      */
     int verticalIntersect(double xIntercept, double roots[3]) const;
 
-    const SkDCubic& set(const SkPoint pts[kPointCount]) {
+// add debug only global pointer so asserts can be skipped by fuzzers
+    const SkDCubic& set(const SkPoint pts[kPointCount]
+            SkDEBUGPARAMS(SkOpGlobalState* state = nullptr)) {
         fPts[0] = pts[0];
         fPts[1] = pts[1];
         fPts[2] = pts[2];
         fPts[3] = pts[3];
+        SkDEBUGCODE(fDebugGlobalState = state);
         return *this;
     }
 
@@ -125,8 +135,8 @@
     SkDQuad toQuad() const;
 
     static const int gPrecisionUnit;
-
     SkDPoint fPts[kPointCount];
+    SkDEBUGCODE(SkOpGlobalState* fDebugGlobalState);
 };
 
 /* Given the set [0, 1, 2, 3], and two of the four members, compute an XOR mask
diff --git a/src/pathops/SkPathOpsDebug.cpp b/src/pathops/SkPathOpsDebug.cpp
index a0fcff5..476fafb 100644
--- a/src/pathops/SkPathOpsDebug.cpp
+++ b/src/pathops/SkPathOpsDebug.cpp
@@ -691,8 +691,8 @@
 }
 #endif
 
+#include "SkPathOpsConic.h"
 #include "SkPathOpsCubic.h"
-#include "SkPathOpsQuad.h"
 
 SkDCubic SkDQuad::debugToCubic() const {
     SkDCubic cubic;
@@ -706,6 +706,21 @@
     return cubic;
 }
 
+void SkDQuad::debugSet(const SkDPoint* pts) {
+    memcpy(fPts, pts, sizeof(fPts));
+    SkDEBUGCODE(fDebugGlobalState = nullptr);
+}
+
+void SkDCubic::debugSet(const SkDPoint* pts) {
+    memcpy(fPts, pts, sizeof(fPts));
+    SkDEBUGCODE(fDebugGlobalState = nullptr);
+}
+
+void SkDConic::debugSet(const SkDPoint* pts, SkScalar weight) {
+    fPts.debugSet(pts);
+    fWeight = weight;
+}
+
 void SkDRect::debugInit() {
     fLeft = fTop = fRight = fBottom = SK_ScalarNaN;
 }
@@ -1595,6 +1610,7 @@
 // for each coincident pair, match the spans
 // if the spans don't match, add the mssing pt to the segment and loop it in the opposite span
 void SkOpCoincidence::debugAddExpanded(SkPathOpsDebug::GlitchLog* log) const {
+//    DEBUG_SET_PHASE();
     const SkCoincidentSpans* coin = this->fHead;
     if (!coin) {
         return;
@@ -1639,14 +1655,15 @@
                         walk = walk->upCast()->next();
                     } while (!(walkOpp = walk->ptT()->contains(oSeg))
                             && walk != coin->coinPtTEnd()->span());
+                    FAIL_IF(!walkOpp, coin);
                     nextT = walk->t();
                     oNextT = walkOpp->fT;
                 }
                 // use t ranges to guess which one is missing
-                double startRange = coin->coinPtTEnd()->fT - startPtT->fT;
+                double startRange = nextT - priorT;
                 FAIL_IF(!startRange, coin);
-                double startPart = (test->t() - startPtT->fT) / startRange;
-                double oStartRange = coin->oppPtTEnd()->fT - oStartPtT->fT;
+                double startPart = (test->t() - priorT) / startRange;
+                double oStartRange = oNextT - oPriorT;
                 FAIL_IF(!oStartRange, coin);
                 double oStartPart = (oTest->t() - oStartPtT->fT) / oStartRange;
                 FAIL_IF(startPart == oStartPart, coin);
@@ -2029,7 +2046,8 @@
         const SkOpSegment* oSegment = oStart->segment();
         const SkOpSpanBase* next = start;
         const SkOpSpanBase* oNext = oStart;
-        bool ordered = coin->ordered();
+        bool ordered;
+        FAIL_IF(!coin->ordered(&ordered), coin);
         while ((next = next->upCast()->next()) != end) {
             FAIL_IF(!next->upCastable(), coin);
             if (next->upCast()->debugInsertCoincidence(log, oSegment, flipped, ordered), false) {
diff --git a/src/pathops/SkPathOpsQuad.h b/src/pathops/SkPathOpsQuad.h
index 32cfe58..34740d6 100644
--- a/src/pathops/SkPathOpsQuad.h
+++ b/src/pathops/SkPathOpsQuad.h
@@ -40,17 +40,21 @@
         sk_bzero(fPts, sizeof(fPts));
     }
 
+    void debugSet(const SkDPoint* pts);
+
     SkDQuad flip() const {
-        SkDQuad result = {{fPts[2], fPts[1], fPts[0]}};
+        SkDQuad result = {{fPts[2], fPts[1], fPts[0]}  SkDEBUGPARAMS(fDebugGlobalState) };
         return result;
     }
 
     static bool IsConic() { return false; }
 
-    const SkDQuad& set(const SkPoint pts[kPointCount]) {
+    const SkDQuad& set(const SkPoint pts[kPointCount]
+            SkDEBUGPARAMS(SkOpGlobalState* state = nullptr)) {
         fPts[0] = pts[0];
         fPts[1] = pts[1];
         fPts[2] = pts[2];
+        SkDEBUGCODE(fDebugGlobalState = state);
         return *this;
     }
 
@@ -63,6 +67,10 @@
     SkDVector dxdyAtT(double t) const;
     static int FindExtrema(const double src[], double tValue[1]);
 
+#ifdef SK_DEBUG
+    SkOpGlobalState* globalState() const { return fDebugGlobalState; }
+#endif
+
     /**
      *  Return the number of valid roots (0 < root < 1) for this cubic intersecting the
      *  specified horizontal line.
@@ -106,8 +114,7 @@
     void dumpID(int id) const;
     void dumpInner() const;
 
-private:
-//  static double Tangent(const double* quadratic, double t);  // uncalled
+    SkDEBUGCODE(SkOpGlobalState* fDebugGlobalState);
 };
 
 #endif
diff --git a/src/pathops/SkPathOpsRect.h b/src/pathops/SkPathOpsRect.h
index d4e5f54..1efbb8c 100644
--- a/src/pathops/SkPathOpsRect.h
+++ b/src/pathops/SkPathOpsRect.h
@@ -64,6 +64,10 @@
     }
 
     void setBounds(const SkDQuad& curve, const SkDQuad& sub, double tStart, double tEnd);
+
+    bool valid() const {
+        return fLeft <= fRight && fTop <= fBottom;
+    }
 };
 
 #endif
diff --git a/src/pathops/SkPathOpsTSect.cpp b/src/pathops/SkPathOpsTSect.cpp
index 3e7817c..9bff5af 100644
--- a/src/pathops/SkPathOpsTSect.cpp
+++ b/src/pathops/SkPathOpsTSect.cpp
@@ -9,54 +9,54 @@
 
 int SkIntersections::intersect(const SkDQuad& quad1, const SkDQuad& quad2) {
     SkTSect<SkDQuad, SkDQuad> sect1(quad1 
-        SkDEBUGPARAMS(debugGlobalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(1));
+        SkDEBUGPARAMS(globalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(1));
     SkTSect<SkDQuad, SkDQuad> sect2(quad2 
-        SkDEBUGPARAMS(debugGlobalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(2));
+        SkDEBUGPARAMS(globalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(2));
     SkTSect<SkDQuad, SkDQuad>::BinarySearch(&sect1, &sect2, this);
     return used();
 }
 
 int SkIntersections::intersect(const SkDConic& conic, const SkDQuad& quad) {
     SkTSect<SkDConic, SkDQuad> sect1(conic 
-        SkDEBUGPARAMS(debugGlobalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(1));
+        SkDEBUGPARAMS(globalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(1));
     SkTSect<SkDQuad, SkDConic> sect2(quad 
-        SkDEBUGPARAMS(debugGlobalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(2));
+        SkDEBUGPARAMS(globalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(2));
     SkTSect<SkDConic, SkDQuad>::BinarySearch(&sect1, &sect2, this);
     return used();
 }
 
 int SkIntersections::intersect(const SkDConic& conic1, const SkDConic& conic2) {
     SkTSect<SkDConic, SkDConic> sect1(conic1 
-        SkDEBUGPARAMS(debugGlobalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(1));
+        SkDEBUGPARAMS(globalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(1));
     SkTSect<SkDConic, SkDConic> sect2(conic2 
-        SkDEBUGPARAMS(debugGlobalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(2));
+        SkDEBUGPARAMS(globalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(2));
     SkTSect<SkDConic, SkDConic>::BinarySearch(&sect1, &sect2, this);
     return used();
 }
 
 int SkIntersections::intersect(const SkDCubic& cubic, const SkDQuad& quad) {
     SkTSect<SkDCubic, SkDQuad> sect1(cubic 
-        SkDEBUGPARAMS(debugGlobalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(1));
+        SkDEBUGPARAMS(globalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(1));
     SkTSect<SkDQuad, SkDCubic> sect2(quad 
-        SkDEBUGPARAMS(debugGlobalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(2));
+        SkDEBUGPARAMS(globalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(2));
     SkTSect<SkDCubic, SkDQuad>::BinarySearch(&sect1, &sect2, this);
     return used();
 }
 
 int SkIntersections::intersect(const SkDCubic& cubic, const SkDConic& conic) {
     SkTSect<SkDCubic, SkDConic> sect1(cubic 
-        SkDEBUGPARAMS(debugGlobalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(1));
+        SkDEBUGPARAMS(globalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(1));
     SkTSect<SkDConic, SkDCubic> sect2(conic 
-        SkDEBUGPARAMS(debugGlobalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(2));
+        SkDEBUGPARAMS(globalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(2));
     SkTSect<SkDCubic, SkDConic>::BinarySearch(&sect1, &sect2, this);
     return used();
 }
 
 int SkIntersections::intersect(const SkDCubic& cubic1, const SkDCubic& cubic2) {
     SkTSect<SkDCubic, SkDCubic> sect1(cubic1 
-        SkDEBUGPARAMS(debugGlobalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(1));
+        SkDEBUGPARAMS(globalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(1));
     SkTSect<SkDCubic, SkDCubic> sect2(cubic2 
-        SkDEBUGPARAMS(debugGlobalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(2));
+        SkDEBUGPARAMS(globalState())  PATH_OPS_DEBUG_T_SECT_PARAMS(2));
     SkTSect<SkDCubic, SkDCubic>::BinarySearch(&sect1, &sect2, this);
     return used();
 }
diff --git a/src/pathops/SkPathOpsTSect.h b/src/pathops/SkPathOpsTSect.h
index f22322b..51ea44a 100644
--- a/src/pathops/SkPathOpsTSect.h
+++ b/src/pathops/SkPathOpsTSect.h
@@ -137,7 +137,7 @@
 
     int hullsIntersect(SkTSpan<OppCurve, TCurve>* span, bool* start, bool* oppStart);
     void init(const TCurve& );
-    void initBounds(const TCurve& );
+    bool initBounds(const TCurve& );
 
     bool isBounded() const {
         return fBounded != nullptr;
@@ -317,7 +317,7 @@
     void removeSpans(SkTSpan<TCurve, OppCurve>* span, SkTSect<OppCurve, TCurve>* opp);
     SkTSpan<TCurve, OppCurve>* spanAtT(double t, SkTSpan<TCurve, OppCurve>** priorSpan);
     SkTSpan<TCurve, OppCurve>* tail();
-    void trim(SkTSpan<TCurve, OppCurve>* span, SkTSect<OppCurve, TCurve>* opp);
+    bool trim(SkTSpan<TCurve, OppCurve>* span, SkTSect<OppCurve, TCurve>* opp);
     void unlinkSpan(SkTSpan<TCurve, OppCurve>* span);
     bool updateBounded(SkTSpan<TCurve, OppCurve>* first, SkTSpan<TCurve, OppCurve>* last,
                        SkTSpan<OppCurve, TCurve>* oppFirst);
@@ -351,7 +351,7 @@
         const SkDPoint& cPt, const OppCurve& c2) {
     SkDVector dxdy = c1.dxdyAtT(t);
     SkDLine perp = {{ cPt, {cPt.fX + dxdy.fY, cPt.fY - dxdy.fX} }};
-    SkIntersections i;
+    SkIntersections i  SkDEBUGCODE((c1.globalState()));
     int used = i.intersectRay(c2, perp);
     // only keep closest
     if (used == 0 || used == 3) {
@@ -565,7 +565,7 @@
 }
 
 template<typename TCurve, typename OppCurve>
-void SkTSpan<TCurve, OppCurve>::initBounds(const TCurve& c) {
+bool SkTSpan<TCurve, OppCurve>::initBounds(const TCurve& c) {
     fPart = c.subDivide(fStartT, fEndT);
     fBounds.setBounds(fPart);
     fCoinStart.init();
@@ -579,6 +579,7 @@
         SkDebugf("");  // for convenient breakpoints
     }
 #endif
+    return fBounds.valid();
 }
 
 template<typename TCurve, typename OppCurve>
@@ -1206,6 +1207,7 @@
         }
     } else {
         SkDEBUGCODE(coinStart = first->fStartT);
+        FAIL_IF(!oppFirst);
         SkDEBUGCODE(oppStartT = oppMatched ? oppFirst->fStartT : oppFirst->fEndT);
     }
     // FIXME: incomplete : if we're not at the end, find end of coin
@@ -1286,7 +1288,7 @@
             work->validatePerpT(work->fCoinStart.perpT());
             work->validatePerpPt(work->fCoinStart.perpT(), work->fCoinStart.perpPt());
 #endif
-            SkASSERT(work->hasOppT(work->fCoinStart.perpT()));
+            SkOPASSERT(work->hasOppT(work->fCoinStart.perpT()));
             if (!work->fCoinEnd.isMatch()) {
                 break;
             }
@@ -1400,7 +1402,8 @@
 int SkTSect<TCurve, OppCurve>::linesIntersect(SkTSpan<TCurve, OppCurve>* span,
         SkTSect<OppCurve, TCurve>* opp,
         SkTSpan<OppCurve, TCurve>* oppSpan, SkIntersections* i) {
-    SkIntersections thisRayI, oppRayI;
+    SkIntersections thisRayI  SkDEBUGCODE((span->fDebugGlobalState));
+    SkIntersections oppRayI  SkDEBUGCODE((span->fDebugGlobalState));
     SkDLine thisLine = {{ span->fPart[0], span->fPart[TCurve::kPointLast] }};
     SkDLine oppLine = {{ oppSpan->fPart[0], oppSpan->fPart[OppCurve::kPointLast] }};
     int loopCount = 0;
@@ -1810,9 +1813,9 @@
 /* Each span has a range of opposite spans it intersects. After the span is split in two,
     adjust the range to its new size */
 template<typename TCurve, typename OppCurve>
-void SkTSect<TCurve, OppCurve>::trim(SkTSpan<TCurve, OppCurve>* span,
+bool SkTSect<TCurve, OppCurve>::trim(SkTSpan<TCurve, OppCurve>* span,
         SkTSect<OppCurve, TCurve>* opp) {
-    span->initBounds(fCurve);
+    FAIL_IF(!span->initBounds(fCurve));
     const SkTSpanBounded<OppCurve, TCurve>* testBounded = span->fBounded;
     while (testBounded) {
         SkTSpan<OppCurve, TCurve>* test = testBounded->fBounded;
@@ -1826,7 +1829,7 @@
             if (sects == 2) {
                 span->initBounds(fCurve);
                 this->removeAllBut(test, span, opp);
-                return;
+                return true;
             }
         } else {
             if (span->removeBounded(test)) {
@@ -1838,6 +1841,7 @@
         }
         testBounded = next;
     }
+    return true;
 }
 
 template<typename TCurve, typename OppCurve>
@@ -2112,7 +2116,7 @@
     SkDEBUGCODE(sect1->fOppSect = sect2);
     SkDEBUGCODE(sect2->fOppSect = sect1);
     intersections->reset();
-    intersections->setMax(TCurve::kMaxIntersections + 3);  // give extra for slop
+    intersections->setMax(TCurve::kMaxIntersections + 4);  // give extra for slop
     SkTSpan<TCurve, OppCurve>* span1 = sect1->fHead;
     SkTSpan<OppCurve, TCurve>* span2 = sect2->fHead;
     int oppSect, sect = sect1->intersects(span1, sect2, span2, &oppSect);
@@ -2151,8 +2155,14 @@
             if (!half1->split(largest1, &sect1->fHeap)) {
                 break;
             }
-            sect1->trim(largest1, sect2);
-            sect1->trim(half1, sect2);
+            if (!sect1->trim(largest1, sect2)) {
+                SkOPOBJASSERT(intersections, 0);
+                return;
+            }
+            if (!sect1->trim(half1, sect2)) {
+                SkOPOBJASSERT(intersections, 0);
+                return;
+            }
         } else {
             if (largest2->fCollapsed) {
                 break;
@@ -2163,8 +2173,14 @@
             if (!half2->split(largest2, &sect2->fHeap)) {
                 break;
             }
-            sect2->trim(largest2, sect1);
-            sect2->trim(half2, sect1);
+            if (!sect2->trim(largest2, sect1)) {
+                SkOPOBJASSERT(intersections, 0);
+                return;
+            }
+            if (!sect2->trim(half2, sect1)) {
+                SkOPOBJASSERT(intersections, 0);
+                return;
+            }
         }
         sect1->validate();
         sect2->validate();
@@ -2250,28 +2266,28 @@
         // if the final iteration contains an end (0 or 1),
         if (sect1->fRemovedStartT && !(zeroOneSet & kZeroS1Set)) {
             SkTCoincident<TCurve, OppCurve> perp;   // intersect perpendicular with opposite curve
-            perp.setPerp(sect1->fCurve, 0, sect1->fCurve.fPts[0], sect2->fCurve);
+            perp.setPerp(sect1->fCurve, 0, sect1->fCurve[0], sect2->fCurve);
             if (perp.isMatch()) {
                 intersections->insert(0, perp.perpT(), perp.perpPt());
             }
         }
         if (sect1->fRemovedEndT && !(zeroOneSet & kOneS1Set)) {
             SkTCoincident<TCurve, OppCurve> perp;
-            perp.setPerp(sect1->fCurve, 1, sect1->fCurve.fPts[TCurve::kPointLast], sect2->fCurve);
+            perp.setPerp(sect1->fCurve, 1, sect1->fCurve[TCurve::kPointLast], sect2->fCurve);
             if (perp.isMatch()) {
                 intersections->insert(1, perp.perpT(), perp.perpPt());
             }
         }
         if (sect2->fRemovedStartT && !(zeroOneSet & kZeroS2Set)) {
             SkTCoincident<OppCurve, TCurve> perp;
-            perp.setPerp(sect2->fCurve, 0, sect2->fCurve.fPts[0], sect1->fCurve);
+            perp.setPerp(sect2->fCurve, 0, sect2->fCurve[0], sect1->fCurve);
             if (perp.isMatch()) {
                 intersections->insert(perp.perpT(), 0, perp.perpPt());
             }
         }
         if (sect2->fRemovedEndT && !(zeroOneSet & kOneS2Set)) {
             SkTCoincident<OppCurve, TCurve> perp;
-            perp.setPerp(sect2->fCurve, 1, sect2->fCurve.fPts[OppCurve::kPointLast], sect1->fCurve);
+            perp.setPerp(sect2->fCurve, 1, sect2->fCurve[OppCurve::kPointLast], sect1->fCurve);
             if (perp.isMatch()) {
                 intersections->insert(perp.perpT(), 1, perp.perpPt());
             }
@@ -2365,7 +2381,7 @@
         }
         intersections->setCoincident(index);
     }
-    SkASSERT(intersections->used() <= TCurve::kMaxIntersections);
+    SkOPOBJASSERT(intersections, intersections->used() <= TCurve::kMaxIntersections);
 }
 
 #endif
diff --git a/src/pathops/SkPathOpsTypes.h b/src/pathops/SkPathOpsTypes.h
index 786eb22..e390b4b 100644
--- a/src/pathops/SkPathOpsTypes.h
+++ b/src/pathops/SkPathOpsTypes.h
@@ -221,8 +221,8 @@
 #define SkOPASSERT(cond) SkASSERT((this->globalState() && \
         this->globalState()->debugSkipAssert()) || (cond))
 #endif
-#define SkOPOBJASSERT(obj, cond) SkASSERT((obj->debugGlobalState() && \
-        obj->debugGlobalState()->debugSkipAssert()) || (cond))
+#define SkOPOBJASSERT(obj, cond) SkASSERT((obj->globalState() && \
+        obj->globalState()->debugSkipAssert()) || (cond))
 #else
 #define SkOPASSERT(cond)
 #define SkOPOBJASSERT(obj, cond)
diff --git a/src/pathops/SkPathWriter.cpp b/src/pathops/SkPathWriter.cpp
index 1f6dddd..c94809e 100644
--- a/src/pathops/SkPathWriter.cpp
+++ b/src/pathops/SkPathWriter.cpp
@@ -48,23 +48,26 @@
     fCurrent.cubicTo(pt1, pt2, pt3->fPt);
 }
 
-void SkPathWriter::deferredLine(const SkOpPtT* pt) {
+bool SkPathWriter::deferredLine(const SkOpPtT* pt) {
     SkASSERT(fFirstPtT);
     SkASSERT(fDefer[0]);
     if (fDefer[0] == pt) {
         // FIXME: why we're adding a degenerate line? Caller should have preflighted this.
-        return;
+        return true;
     }
     if (pt->contains(fDefer[0])) {
         // FIXME: why we're adding a degenerate line?
-        return;
+        return true;
     }
-    SkASSERT(!this->matchedLast(pt));
+    if (this->matchedLast(pt)) {
+        return false;
+    }
     if (fDefer[1] && this->changedSlopes(pt)) {
         this->lineTo();
         fDefer[0] = fDefer[1];
     }
     fDefer[1] = pt;
+    return true;
 }
 
 void SkPathWriter::deferredMove(const SkOpPtT* pt) {
diff --git a/src/pathops/SkPathWriter.h b/src/pathops/SkPathWriter.h
index bd13c71..5dd1bf6 100644
--- a/src/pathops/SkPathWriter.h
+++ b/src/pathops/SkPathWriter.h
@@ -23,7 +23,7 @@
     void assemble();
     void conicTo(const SkPoint& pt1, const SkOpPtT* pt2, SkScalar weight);
     void cubicTo(const SkPoint& pt1, const SkPoint& pt2, const SkOpPtT* pt3);
-    void deferredLine(const SkOpPtT* pt);
+    bool deferredLine(const SkOpPtT* pt);
     void deferredMove(const SkOpPtT* pt);
     void finishContour();
     bool hasMove() const { return !fFirstPtT; }
diff --git a/tests/PathOpsAngleIdeas.cpp b/tests/PathOpsAngleIdeas.cpp
index 9d1b599..a408a3c 100755
--- a/tests/PathOpsAngleIdeas.cpp
+++ b/tests/PathOpsAngleIdeas.cpp
@@ -77,7 +77,7 @@
     double s = r * SK_ScalarTanPIOver8;
     double m = r * SK_ScalarRoot2Over2;
     // construct circle from quads
-    const SkDQuad circle[8] = {{{{ r,  0}, { r, -s}, { m, -m}}},
+    const QuadPts circle[8] = {{{{ r,  0}, { r, -s}, { m, -m}}},
                                 {{{ m, -m}, { s, -r}, { 0, -r}}},
                                 {{{ 0, -r}, {-s, -r}, {-m, -m}}},
                                 {{{-m, -m}, {-r, -s}, {-r,  0}}},
@@ -86,7 +86,9 @@
                                 {{{ 0,  r}, { s,  r}, { m,  m}}},
                                 {{{ m,  m}, { r,  s}, { r,  0}}}};
     for (int octant = 0; octant < 8; ++octant) {
-        double t = testArc(reporter, quad, circle[octant], octant);
+        SkDQuad cQuad;
+        cQuad.debugSet(circle[octant].fPts);
+        double t = testArc(reporter, quad, cQuad, octant);
         if (t < 0) {
             continue;
         }
@@ -332,6 +334,9 @@
             rStep /= 2;
         } while (rStep > FLT_EPSILON);
         if (bestCCW < 0) {
+            if (bestR >= maxRadius) {
+                SkDebugf("");
+            }
             REPORTER_ASSERT(reporter, bestR < maxRadius);
             return false;
         }
@@ -555,12 +560,15 @@
 DEF_TEST(PathOpsAngleOverlapHullsOne, reporter) {
     SkChunkAlloc allocator(4096);
 //    gPathOpsAngleIdeasVerbose = true;
-    const SkDQuad quads[] = {
+    const QuadPts quads[] = {
 {{{939.4808349609375, 914.355224609375}, {-357.7921142578125, 590.842529296875}, {736.8936767578125, -350.717529296875}}},
 {{{939.4808349609375, 914.355224609375}, {-182.85418701171875, 634.4552001953125}, {-509.62615966796875, 576.1182861328125}}}
     };
     for (int index = 0; index < (int) SK_ARRAY_COUNT(quads); index += 2) {
-        testQuadAngles(reporter, quads[index], quads[index + 1], 0, &allocator);
+        SkDQuad quad0, quad1;
+        quad0.debugSet(quads[index].fPts);
+        quad1.debugSet(quads[index + 1].fPts);
+        testQuadAngles(reporter, quad0, quad1, 0, &allocator);
     }
 }
 
@@ -573,23 +581,26 @@
     for (int index = 0; index < 100000; ++index) {
         if (index % 1000 == 999) SkDebugf(".");
         SkDPoint origin = {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)};
-        SkDQuad quad1 = {{origin, {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)},
+        QuadPts quad1 = {{origin, {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)},
             {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)}}};
-        if (quad1[0] == quad1[2]) {
+        if (quad1.fPts[0] == quad1.fPts[2]) {
             continue;
         }
-        SkDQuad quad2 = {{origin, {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)},
+        QuadPts quad2 = {{origin, {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)},
             {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)}}};
-        if (quad2[0] == quad2[2]) {
+        if (quad2.fPts[0] == quad2.fPts[2]) {
             continue;
         }
         SkIntersections i;
-        i.intersect(quad1, quad2);
+        SkDQuad q1, q2;
+        q1.debugSet(quad1.fPts);
+        q2.debugSet(quad2.fPts);
+        i.intersect(q1, q2);
         REPORTER_ASSERT(reporter, i.used() >= 1);
         if (i.used() > 1) {
             continue;
         }
-        testQuadAngles(reporter, quad1, quad2, index, &allocator);
+        testQuadAngles(reporter, q1, q2, index, &allocator);
     }
 }
 
@@ -603,29 +614,32 @@
     SkDEBUGCODE(int smallIndex);
     for (int index = 0; index < 100000; ++index) {
         SkDPoint origin = {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)};
-        SkDQuad quad1 = {{origin, {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)},
+        QuadPts quad1 = {{origin, {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)},
             {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)}}};
-        if (quad1[0] == quad1[2]) {
+        if (quad1.fPts[0] == quad1.fPts[2]) {
             continue;
         }
-        SkDQuad quad2 = {{origin, {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)},
+        QuadPts quad2 = {{origin, {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)},
             {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)}}};
-        if (quad2[0] == quad2[2]) {
+        if (quad2.fPts[0] == quad2.fPts[2]) {
             continue;
         }
+        SkDQuad q1, q2;
+        q1.debugSet(quad1.fPts);
+        q2.debugSet(quad2.fPts);
         SkIntersections i;
-        i.intersect(quad1, quad2);
+        i.intersect(q1, q2);
         REPORTER_ASSERT(reporter, i.used() >= 1);
         if (i.used() > 1) {
             continue;
         }
         TRange lowerRange, upperRange;
-        bool result = bruteMinT(reporter, quad1, quad2, &lowerRange, &upperRange);
+        bool result = bruteMinT(reporter, q1, q2, &lowerRange, &upperRange);
         REPORTER_ASSERT(reporter, result);
         double min = SkTMin(upperRange.t1, upperRange.t2);
         if (smaller > min) {
-            small[0] = quad1;
-            small[1] = quad2;
+            small[0] = q1;
+            small[1] = q2;
             SkDEBUGCODE(smallIndex = index);
             smaller = min;
         }
@@ -637,7 +651,7 @@
 
 DEF_TEST(PathOpsAngleBruteTOne, reporter) {
 //    gPathOpsAngleIdeasVerbose = true;
-    const SkDQuad quads[] = {
+    const QuadPts qPts[] = {
 {{{-770.8492431640625, 948.2369384765625}, {-853.37066650390625, 972.0301513671875}, {-200.62042236328125, -26.7174072265625}}},
 {{{-770.8492431640625, 948.2369384765625}, {513.602783203125, 578.8681640625}, {960.641357421875, -813.69757080078125}}},
 {{{563.8267822265625, -107.4566650390625}, {-44.67724609375, -136.57452392578125}, {492.3856201171875, -268.79644775390625}}},
@@ -646,6 +660,10 @@
 {{{598.857421875, 846.345458984375}, {715.7142333984375, 955.3599853515625}, {-919.9478759765625, 691.611328125}}},
     };
     TRange lowerRange, upperRange;
+    SkDQuad quads[SK_ARRAY_COUNT(qPts)];
+    for (int index = 0; index < (int) SK_ARRAY_COUNT(qPts); ++index) {
+        quads[index].debugSet(qPts[index].fPts);
+    }
     bruteMinT(reporter, quads[0], quads[1], &lowerRange, &upperRange);
     bruteMinT(reporter, quads[2], quads[3], &lowerRange, &upperRange);
     bruteMinT(reporter, quads[4], quads[5], &lowerRange, &upperRange);
@@ -666,7 +684,7 @@
 the largest length to determine how stable the curve is vis-a-vis the initial tangent.
 */
 
-static const SkDQuad extremeTests[][2] = {
+static const QuadPts extremeTests[][2] = {
     {
         {{{-708.0077926931004,-154.61669472244046},
             {-707.9234268635319,-154.30459999551294},
@@ -793,8 +811,11 @@
     }
     double maxR = SK_ScalarMax;
     for (int index = 0; index < (int) SK_ARRAY_COUNT(extremeTests); ++index) {
-        const SkDQuad& quad1 = extremeTests[index][0];
-        const SkDQuad& quad2 = extremeTests[index][1];
+        const QuadPts& qu1 = extremeTests[index][0];
+        const QuadPts& qu2 = extremeTests[index][1];
+        SkDQuad quad1, quad2;
+        quad1.debugSet(qu1.fPts);
+        quad2.debugSet(qu2.fPts);
         if (gPathOpsAngleIdeasVerbose) {
             SkDebugf("%s %d\n", __FUNCTION__, index);
         }
diff --git a/tests/PathOpsAngleTest.cpp b/tests/PathOpsAngleTest.cpp
index fe39d40..d5285c8 100644
--- a/tests/PathOpsAngleTest.cpp
+++ b/tests/PathOpsAngleTest.cpp
@@ -81,7 +81,9 @@
         SkDPoint qPt2 = line.ptAtT(t3);
         qPt.fX += qPt2.fY;
         qPt.fY -= qPt2.fX;
-        SkDQuad quad = {{line[0], dPt, qPt}};
+        QuadPts q = {{line[0], dPt, qPt}};
+        SkDQuad quad;
+        quad.debugSet(q.fPts);
         // binary search for maximum movement of quad[1] towards test that still has 1 intersection
         double moveT = 0.5f;
         double deltaT = moveT / 2;
@@ -223,7 +225,7 @@
 };
 
 struct CircleData {
-    const SkDCubic fPts;
+    const CubicPts fPts;
     const int fPtCount;
     SkPoint fShortPts[4];
 };
@@ -266,7 +268,7 @@
 }
 
 struct IntersectData {
-    const SkDCubic fPts;
+    const CubicPts fPts;
     const int fPtCount;
     double fTStart;
     double fTEnd;
diff --git a/tests/PathOpsConicIntersectionTest.cpp b/tests/PathOpsConicIntersectionTest.cpp
index e22ad6b..41c0acb 100644
--- a/tests/PathOpsConicIntersectionTest.cpp
+++ b/tests/PathOpsConicIntersectionTest.cpp
@@ -16,7 +16,7 @@
 
  */
 
-static const SkDConic testSet[] = {
+static const ConicPts testSet[] = {
     {{{{306.588013,-227.983994}, {212.464996,-262.242004}, {95.5512009,58.9763985}}}, 0.707107008f},
     {{{{377.218994,-141.981003}, {40.578701,-201.339996}, {23.1854992,-102.697998}}}, 0.707107008f},
 
@@ -295,11 +295,14 @@
 }
 #endif
 
-static void oneOff(skiatest::Reporter* reporter, const SkDConic& c1, const SkDConic& c2,
+static void oneOff(skiatest::Reporter* reporter, const ConicPts& conic1, const ConicPts& conic2,
         bool coin) {
 #if DEBUG_VISUALIZE_CONICS
     writeFrames();
 #endif
+    SkDConic c1, c2;
+    c1.debugSet(conic1.fPts.fPts, conic1.fWeight);
+    c2.debugSet(conic2.fPts.fPts, conic2.fWeight);
     chopBothWays(c1, 0.5, "c1");
     chopBothWays(c2, 0.5, "c2");
 #if DEBUG_VISUALIZE_CONICS
@@ -330,8 +333,8 @@
 }
 
 static void oneOff(skiatest::Reporter* reporter, int outer, int inner) {
-    const SkDConic& c1 = testSet[outer];
-    const SkDConic& c2 = testSet[inner];
+    const ConicPts& c1 = testSet[outer];
+    const ConicPts& c2 = testSet[inner];
     oneOff(reporter, c1, c2, false);
 }
 
diff --git a/tests/PathOpsConicLineIntersectionTest.cpp b/tests/PathOpsConicLineIntersectionTest.cpp
index ecc4a47..c3d4a2a 100644
--- a/tests/PathOpsConicLineIntersectionTest.cpp
+++ b/tests/PathOpsConicLineIntersectionTest.cpp
@@ -14,7 +14,7 @@
 #include "Test.h"
 
 static struct lineConic {
-    SkDConic conic;
+    ConicPts conic;
     SkDLine line;
     int result;
     SkDPoint expected[2];
@@ -57,7 +57,7 @@
 }
 
 static struct oneLineConic {
-    SkDConic conic;
+    ConicPts conic;
     SkDLine line;
 } oneOffs[] = {
     {{{{{30.6499996,25.6499996}, {30.6499996,20.6499996}, {25.6499996,20.6499996}}}, 0.707107008f},
@@ -69,7 +69,9 @@
 static void testOneOffs(skiatest::Reporter* reporter) {
     bool flipped = false;
     for (size_t index = 0; index < oneOffs_count; ++index) {
-        const SkDConic& conic = oneOffs[index].conic;
+        const ConicPts& c = oneOffs[index].conic;
+        SkDConic  conic;
+        conic.debugSet(c.fPts.fPts, c.fWeight);
         SkASSERT(ValidConic(conic));
         const SkDLine& line = oneOffs[index].line;
         SkASSERT(ValidLine(line));
@@ -96,7 +98,9 @@
 DEF_TEST(PathOpsConicLineIntersection, reporter) {
     for (size_t index = 0; index < lineConicTests_count; ++index) {
         int iIndex = static_cast<int>(index);
-        const SkDConic& conic = lineConicTests[index].conic;
+        const ConicPts& c = lineConicTests[index].conic;
+        SkDConic conic;
+        conic.debugSet(c.fPts.fPts, c.fWeight);
         SkASSERT(ValidConic(conic));
         const SkDLine& line = lineConicTests[index].line;
         SkASSERT(ValidLine(line));
diff --git a/tests/PathOpsConicQuadIntersectionTest.cpp b/tests/PathOpsConicQuadIntersectionTest.cpp
index 5996cf8..99411dc 100644
--- a/tests/PathOpsConicQuadIntersectionTest.cpp
+++ b/tests/PathOpsConicQuadIntersectionTest.cpp
@@ -12,8 +12,8 @@
 #include "Test.h"
 
 static struct conicQuad {
-    SkDConic conic;
-    SkDQuad quad;
+    ConicPts conic;
+    QuadPts quad;
 } conicQuadTests[] = {
    {{{{{494.348663,224.583771}, {494.365143,224.633194}, {494.376404,224.684067}}}, 0.998645842f},
     {{{494.30481,224.474213}, {494.334961,224.538284}, {494.355774,224.605927}}}},
@@ -25,9 +25,13 @@
 static const int conicQuadTests_count = (int) SK_ARRAY_COUNT(conicQuadTests);
 
 static void conicQuadIntersection(skiatest::Reporter* reporter, int index) {
-    const SkDConic& conic = conicQuadTests[index].conic;
+    const ConicPts& c = conicQuadTests[index].conic;
+    SkDConic conic;
+    conic.debugSet(c.fPts.fPts, c.fWeight);
     SkASSERT(ValidConic(conic));
-    const SkDQuad& quad = conicQuadTests[index].quad;
+    const QuadPts& q = conicQuadTests[index].quad;
+    SkDQuad quad;
+    quad.debugSet(q.fPts);
     SkASSERT(ValidQuad(quad));
     SkReduceOrder reduce1;
     SkReduceOrder reduce2;
diff --git a/tests/PathOpsCubicConicIntersectionTest.cpp b/tests/PathOpsCubicConicIntersectionTest.cpp
index fae1233..d792463 100644
--- a/tests/PathOpsCubicConicIntersectionTest.cpp
+++ b/tests/PathOpsCubicConicIntersectionTest.cpp
@@ -12,8 +12,8 @@
 #include "Test.h"
 
 static struct cubicConic {
-    SkDCubic cubic;
-    SkDConic conic;
+    CubicPts cubic;
+    ConicPts conic;
 } cubicConicTests[] = {
     {{{{188.60000610351562, 2041.5999755859375}, {188.60000610351562, 2065.39990234375},
         {208, 2084.800048828125}, {231.80000305175781, 2084.800048828125}}},
@@ -29,9 +29,13 @@
 static const int cubicConicTests_count = (int) SK_ARRAY_COUNT(cubicConicTests);
 
 static void cubicConicIntersection(skiatest::Reporter* reporter, int index) {
-    const SkDCubic& cubic = cubicConicTests[index].cubic;
+    const CubicPts& cu = cubicConicTests[index].cubic;
+    SkDCubic cubic;
+    cubic.debugSet(cu.fPts);
     SkASSERT(ValidCubic(cubic));
-    const SkDConic& conic = cubicConicTests[index].conic;
+    const ConicPts& co = cubicConicTests[index].conic;
+    SkDConic conic;
+    conic.debugSet(co.fPts.fPts, co.fWeight);
     SkASSERT(ValidConic(conic));
     SkReduceOrder reduce1;
     SkReduceOrder reduce2;
diff --git a/tests/PathOpsCubicIntersectionTest.cpp b/tests/PathOpsCubicIntersectionTest.cpp
index 07852bc..e69aff8 100644
--- a/tests/PathOpsCubicIntersectionTest.cpp
+++ b/tests/PathOpsCubicIntersectionTest.cpp
@@ -19,11 +19,14 @@
 static void standardTestCases(skiatest::Reporter* reporter) {
     for (size_t index = firstCubicIntersectionTest; index < tests_count; ++index) {
         int iIndex = static_cast<int>(index);
-        const SkDCubic& cubic1 = tests[index][0];
-        const SkDCubic& cubic2 = tests[index][1];
+        const CubicPts& cubic1 = tests[index][0];
+        const CubicPts& cubic2 = tests[index][1];
+        SkDCubic c1, c2;
+        c1.debugSet(cubic1.fPts);
+        c2.debugSet(cubic2.fPts);
         SkReduceOrder reduce1, reduce2;
-        int order1 = reduce1.reduce(cubic1, SkReduceOrder::kNo_Quadratics);
-        int order2 = reduce2.reduce(cubic2, SkReduceOrder::kNo_Quadratics);
+        int order1 = reduce1.reduce(c1, SkReduceOrder::kNo_Quadratics);
+        int order2 = reduce2.reduce(c2, SkReduceOrder::kNo_Quadratics);
         const bool showSkipped = false;
         if (order1 < 4) {
             if (showSkipped) {
@@ -38,7 +41,7 @@
             continue;
         }
         SkIntersections tIntersections;
-        tIntersections.intersect(cubic1, cubic2);
+        tIntersections.intersect(c1, c2);
         if (!tIntersections.used()) {
             if (showSkipped) {
                 SkDebugf("%s [%d] no intersection\n", __FUNCTION__, iIndex);
@@ -53,9 +56,9 @@
         }
         for (int pt = 0; pt < tIntersections.used(); ++pt) {
             double tt1 = tIntersections[0][pt];
-            SkDPoint xy1 = cubic1.ptAtT(tt1);
+            SkDPoint xy1 = c1.ptAtT(tt1);
             double tt2 = tIntersections[1][pt];
-            SkDPoint xy2 = cubic2.ptAtT(tt2);
+            SkDPoint xy2 = c2.ptAtT(tt2);
             if (!xy1.approximatelyEqual(xy2)) {
                 SkDebugf("%s [%d,%d] x!= t1=%g (%g,%g) t2=%g (%g,%g)\n",
                     __FUNCTION__, (int)index, pt, tt1, xy1.fX, xy1.fY, tt2, xy2.fX, xy2.fY);
@@ -66,7 +69,7 @@
     }
 }
 
-static const SkDCubic testSet[] = {
+static const CubicPts testSet[] = {
 // FIXME: uncommenting these two will cause this to fail
 // this results in two curves very nearly but not exactly coincident
 #if 0
@@ -164,7 +167,7 @@
 
 const int testSetCount = (int) SK_ARRAY_COUNT(testSet);
 
-static const SkDCubic newTestSet[] = {
+static const CubicPts newTestSet[] = {
 { { { 130.0427549999999997, 11417.41309999999976 },{ 130.2331240000000037, 11418.3192999999992 },{ 131.0370790000000056, 11419 },{ 132, 11419 } } },
 { { { 132, 11419 },{ 130.8954319999999996, 11419 },{ 130, 11418.10449999999946 },{ 130, 11417 } } },
     
@@ -381,10 +384,13 @@
 };
 
 const int newTestSetCount = (int) SK_ARRAY_COUNT(newTestSet);
-static void oneOff(skiatest::Reporter* reporter, const SkDCubic& cubic1, const SkDCubic& cubic2,
+static void oneOff(skiatest::Reporter* reporter, const CubicPts& cubic1, const CubicPts& cubic2,
         bool coin) {
-    SkASSERT(ValidCubic(cubic1));
-    SkASSERT(ValidCubic(cubic2));
+    SkDCubic c1, c2;
+    c1.debugSet(cubic1.fPts);
+    c2.debugSet(cubic2.fPts);
+    SkASSERT(ValidCubic(c1));
+    SkASSERT(ValidCubic(c2));
 #if ONE_OFF_DEBUG
     SkDebugf("computed quadratics given\n");
     SkDebugf("  {{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}},\n",
@@ -395,7 +401,7 @@
         cubic2[2].fX, cubic2[2].fY, cubic2[3].fX, cubic2[3].fY);
 #endif
     SkIntersections intersections;
-    intersections.intersect(cubic1, cubic2);
+    intersections.intersect(c1, c2);
 #if DEBUG_T_SECT_DUMP == 3
     SkDebugf("</div>\n\n");
     SkDebugf("<script type=\"text/javascript\">\n\n");
@@ -412,9 +418,9 @@
     SkDPoint xy1, xy2;
     for (int pt3 = 0; pt3 < intersections.used(); ++pt3) {
         tt1 = intersections[0][pt3];
-        xy1 = cubic1.ptAtT(tt1);
+        xy1 = c1.ptAtT(tt1);
         tt2 = intersections[1][pt3];
-        xy2 = cubic2.ptAtT(tt2);
+        xy2 = c2.ptAtT(tt2);
         const SkDPoint& iPt = intersections.pt(pt3);
 #if ONE_OFF_DEBUG
         SkDebugf("%s t1=%1.9g (%1.9g, %1.9g) (%1.9g, %1.9g) (%1.9g, %1.9g) t2=%1.9g\n",
@@ -429,20 +435,20 @@
 }
 
 static void oneOff(skiatest::Reporter* reporter, int outer, int inner) {
-    const SkDCubic& cubic1 = testSet[outer];
-    const SkDCubic& cubic2 = testSet[inner];
+    const CubicPts& cubic1 = testSet[outer];
+    const CubicPts& cubic2 = testSet[inner];
     oneOff(reporter, cubic1, cubic2, false);
 }
 
 static void newOneOff(skiatest::Reporter* reporter, int outer, int inner) {
-    const SkDCubic& cubic1 = newTestSet[outer];
-    const SkDCubic& cubic2 = newTestSet[inner];
+    const CubicPts& cubic1 = newTestSet[outer];
+    const CubicPts& cubic2 = newTestSet[inner];
     oneOff(reporter, cubic1, cubic2, false);
 }
 
 static void testsOneOff(skiatest::Reporter* reporter, int index) {
-    const SkDCubic& cubic1 = tests[index][0];
-    const SkDCubic& cubic2 = tests[index][1];
+    const CubicPts& cubic1 = tests[index][0];
+    const CubicPts& cubic2 = tests[index][1];
     oneOff(reporter, cubic1, cubic2, false);
 }
 
@@ -468,12 +474,12 @@
     unsigned seed = 0;
 #endif
     for (int test = 0; test < tests; ++test) {
-        SkDCubic cubic1, cubic2;
+        CubicPts cubic1, cubic2;
         for (int i = 0; i < 4; ++i) {
-            cubic1[i].fX = static_cast<double>(SK_RAND(seed)) / RAND_MAX * 100;
-            cubic1[i].fY = static_cast<double>(SK_RAND(seed)) / RAND_MAX * 100;
-            cubic2[i].fX = static_cast<double>(SK_RAND(seed)) / RAND_MAX * 100;
-            cubic2[i].fY = static_cast<double>(SK_RAND(seed)) / RAND_MAX * 100;
+            cubic1.fPts[i].fX = static_cast<double>(SK_RAND(seed)) / RAND_MAX * 100;
+            cubic1.fPts[i].fY = static_cast<double>(SK_RAND(seed)) / RAND_MAX * 100;
+            cubic2.fPts[i].fX = static_cast<double>(SK_RAND(seed)) / RAND_MAX * 100;
+            cubic2.fPts[i].fY = static_cast<double>(SK_RAND(seed)) / RAND_MAX * 100;
         }
     #if DEBUG_CRASH
         char str[1024];
@@ -486,15 +492,18 @@
                 cubic2[3].fX, cubic2[3].fY);
     #endif
         SkDRect rect1, rect2;
-        rect1.setBounds(cubic1);
-        rect2.setBounds(cubic2);
+        SkDCubic c1, c2;
+        c1.debugSet(cubic1.fPts);
+        c2.debugSet(cubic2.fPts);
+        rect1.setBounds(c1);
+        rect2.setBounds(c2);
         bool boundsIntersect = rect1.fLeft <= rect2.fRight && rect2.fLeft <= rect2.fRight
                 && rect1.fTop <= rect2.fBottom && rect2.fTop <= rect1.fBottom;
         if (test == -1) {
             SkDebugf("ready...\n");
         }
         SkIntersections intersections2;
-        int newIntersects = intersections2.intersect(cubic1, cubic2);
+        int newIntersects = intersections2.intersect(c1, c2);
         if (!boundsIntersect && newIntersects) {
     #if DEBUG_CRASH
             SkDebugf("%s %d unexpected intersection boundsIntersect=%d "
@@ -505,9 +514,9 @@
         }
         for (int pt = 0; pt < intersections2.used(); ++pt) {
             double tt1 = intersections2[0][pt];
-            SkDPoint xy1 = cubic1.ptAtT(tt1);
+            SkDPoint xy1 = c1.ptAtT(tt1);
             double tt2 = intersections2[1][pt];
-            SkDPoint xy2 = cubic2.ptAtT(tt2);
+            SkDPoint xy2 = c2.ptAtT(tt2);
             REPORTER_ASSERT(reporter, xy1.approximatelyEqual(xy2));
         }
         reporter->bumpTestCount();
@@ -516,17 +525,20 @@
 
 static void intersectionFinder(int index0, int index1, double t1Seed, double t2Seed,
         double t1Step, double t2Step) {
-    const SkDCubic& cubic1 = newTestSet[index0];
-    const SkDCubic& cubic2 = newTestSet[index1];
+    const CubicPts& cubic1 = newTestSet[index0];
+    const CubicPts& cubic2 = newTestSet[index1];
     SkDPoint t1[3], t2[3];
     bool toggle = true;
+    SkDCubic c1, c2;
+    c1.debugSet(cubic1.fPts);
+    c2.debugSet(cubic2.fPts);
     do {
-        t1[0] = cubic1.ptAtT(t1Seed - t1Step);
-        t1[1] = cubic1.ptAtT(t1Seed);
-        t1[2] = cubic1.ptAtT(t1Seed + t1Step);
-        t2[0] = cubic2.ptAtT(t2Seed - t2Step);
-        t2[1] = cubic2.ptAtT(t2Seed);
-        t2[2] = cubic2.ptAtT(t2Seed + t2Step);
+        t1[0] = c1.ptAtT(t1Seed - t1Step);
+        t1[1] = c1.ptAtT(t1Seed);
+        t1[2] = c1.ptAtT(t1Seed + t1Step);
+        t2[0] = c2.ptAtT(t2Seed - t2Step);
+        t2[1] = c2.ptAtT(t2Seed);
+        t2[2] = c2.ptAtT(t2Seed + t2Step);
         double dist[3][3];
         dist[1][1] = t1[1].distance(t2[1]);
         int best_i = 1, best_j = 1;
@@ -567,38 +579,38 @@
     double t22 = t2Seed + t2Step * 2;
     SkDPoint test;
     while (!approximately_zero(t1Step)) {
-        test = cubic1.ptAtT(t10);
+        test = c1.ptAtT(t10);
         t10 += t1[1].approximatelyEqual(test) ? -t1Step : t1Step;
         t1Step /= 2;
     }
     t1Step = 0.1;
     while (!approximately_zero(t1Step)) {
-        test = cubic1.ptAtT(t12);
+        test = c1.ptAtT(t12);
         t12 -= t1[1].approximatelyEqual(test) ? -t1Step : t1Step;
         t1Step /= 2;
     }
     while (!approximately_zero(t2Step)) {
-        test = cubic2.ptAtT(t20);
+        test = c2.ptAtT(t20);
         t20 += t2[1].approximatelyEqual(test) ? -t2Step : t2Step;
         t2Step /= 2;
     }
     t2Step = 0.1;
     while (!approximately_zero(t2Step)) {
-        test = cubic2.ptAtT(t22);
+        test = c2.ptAtT(t22);
         t22 -= t2[1].approximatelyEqual(test) ? -t2Step : t2Step;
         t2Step /= 2;
     }
 #if ONE_OFF_DEBUG
     SkDebugf("%s t1=(%1.9g<%1.9g<%1.9g) t2=(%1.9g<%1.9g<%1.9g)\n", __FUNCTION__,
         t10, t1Seed, t12, t20, t2Seed, t22);
-    SkDPoint p10 = cubic1.ptAtT(t10);
-    SkDPoint p1Seed = cubic1.ptAtT(t1Seed);
-    SkDPoint p12 = cubic1.ptAtT(t12);
+    SkDPoint p10 = c1.ptAtT(t10);
+    SkDPoint p1Seed = c1.ptAtT(t1Seed);
+    SkDPoint p12 = c1.ptAtT(t12);
     SkDebugf("%s p1=(%1.9g,%1.9g)<(%1.9g,%1.9g)<(%1.9g,%1.9g)\n", __FUNCTION__,
         p10.fX, p10.fY, p1Seed.fX, p1Seed.fY, p12.fX, p12.fY);
-    SkDPoint p20 = cubic2.ptAtT(t20);
-    SkDPoint p2Seed = cubic2.ptAtT(t2Seed);
-    SkDPoint p22 = cubic2.ptAtT(t22);
+    SkDPoint p20 = c2.ptAtT(t20);
+    SkDPoint p2Seed = c2.ptAtT(t2Seed);
+    SkDPoint p22 = c2.ptAtT(t22);
     SkDebugf("%s p2=(%1.9g,%1.9g)<(%1.9g,%1.9g)<(%1.9g,%1.9g)\n", __FUNCTION__,
         p20.fX, p20.fY, p2Seed.fX, p2Seed.fY, p22.fX, p22.fY);
 #endif
@@ -614,7 +626,7 @@
     intersectionFinder(0, 1, 0.865213351, 0.865208087, t1Step, t2Step);
 }
 
-static const SkDCubic selfSet[] = {
+static const CubicPts selfSet[] = {
     {{{2, 3}, {0, 4}, {3, 2}, {5, 3}}},
     {{{3, 6}, {2, 3}, {4, 0}, {3, 2}}},
     {{{0, 2}, {2, 3}, {5, 1}, {3, 2}}},
@@ -628,10 +640,10 @@
 int selfSetCount = (int) SK_ARRAY_COUNT(selfSet);
 
 static void selfOneOff(skiatest::Reporter* reporter, int index) {
-    const SkDCubic& cubic = selfSet[index];
+    const CubicPts& cubic = selfSet[index];
     SkPoint c[4];
     for (int i = 0; i < 4; ++i) {
-        c[i] = cubic[i].asSkPoint();
+        c[i] = cubic.fPts[i].asSkPoint();
     }
     SkScalar loopT;
     SkScalar d[3];
@@ -662,7 +674,7 @@
     }
 }
 
-static const SkDCubic coinSet[] = {
+static const CubicPts coinSet[] = {
     {{{72.350448608398438, 27.966041564941406}, {72.58441162109375, 27.861515045166016},
         {72.818222045898437, 27.756658554077148}, {73.394996643066406, 27.49799919128418}}},
     {{{73.394996643066406, 27.49799919128418}, {72.818222045898437, 27.756658554077148},
@@ -684,8 +696,8 @@
 static int coinSetCount = (int) SK_ARRAY_COUNT(coinSet);
 
 static void coinOneOff(skiatest::Reporter* reporter, int index) {
-    const SkDCubic& cubic1 = coinSet[index];
-    const SkDCubic& cubic2 = coinSet[index + 1];
+    const CubicPts& cubic1 = coinSet[index];
+    const CubicPts& cubic2 = coinSet[index + 1];
     oneOff(reporter, cubic1, cubic2, true);
 }
 
diff --git a/tests/PathOpsCubicIntersectionTestData.cpp b/tests/PathOpsCubicIntersectionTestData.cpp
index 7f725ef..58dbfde 100644
--- a/tests/PathOpsCubicIntersectionTestData.cpp
+++ b/tests/PathOpsCubicIntersectionTestData.cpp
@@ -14,7 +14,7 @@
 static const double N = -FLT_EPSILON / 2;
 static const double M = -FLT_EPSILON / 3;
 
-const SkDCubic pointDegenerates[] = {
+const CubicPts pointDegenerates[] = {
     {{{0, 0}, {0, 0}, {0, 0}, {0, 0}}},
     {{{1, 1}, {1, 1}, {1, 1}, {1, 1}}},
     {{{1 + FLT_EPSILON_HALF, 1}, {1, 1 + FLT_EPSILON_HALF}, {1, 1}, {1, 1}}},
@@ -45,7 +45,7 @@
 
 const size_t pointDegenerates_count = SK_ARRAY_COUNT(pointDegenerates);
 
-const SkDCubic notPointDegenerates[] = {
+const CubicPts notPointDegenerates[] = {
     {{{1 + FLT_EPSILON * 8, 1}, {1, FLT_EPSILON * 8}, {1, 1}, {1, 1}}},
     {{{1 + FLT_EPSILON * 8, 1}, {1 - FLT_EPSILON * 8, 1}, {1, 1}, {1, 1}}}
 };
@@ -54,7 +54,7 @@
         SK_ARRAY_COUNT(notPointDegenerates);
 
 // from http://www.truetex.com/bezint.htm
-const SkDCubic tests[][2] = {
+const CubicPts tests[][2] = {
     {  // intersects in one place (data gives bezier clip fits
      {{{0, 45},
       {6.0094158284751593, 51.610357411322688},
@@ -109,7 +109,7 @@
 
 const size_t tests_count = SK_ARRAY_COUNT(tests);
 
-const SkDCubic lines[] = {
+const CubicPts lines[] = {
     {{{0, 0}, {0, 0}, {0, 0}, {1, 0}}},  // 0: horizontal
     {{{1, 0}, {0, 0}, {0, 0}, {0, 0}}},
     {{{1, 0}, {2, 0}, {3, 0}, {4, 0}}},
@@ -145,7 +145,7 @@
 const size_t lines_count = SK_ARRAY_COUNT(lines);
 
 // 'not a line' tries to fool the line detection code
-const SkDCubic notLines[] = {
+const CubicPts notLines[] = {
     {{{0, 0}, {0, 0}, {0, 1}, {1, 0}}},
     {{{0, 0}, {0, 1}, {0, 0}, {1, 0}}},
     {{{0, 0}, {0, 1}, {1, 0}, {0, 0}}},
@@ -159,7 +159,7 @@
 static const double E = FLT_EPSILON * 8;
 static const double F = FLT_EPSILON * 8;
 
-const SkDCubic modEpsilonLines[] = {
+const CubicPts modEpsilonLines[] = {
     {{{0, E}, {0, 0}, {0, 0}, {1, 0}}},  // horizontal
     {{{0, 0}, {0, E}, {1, 0}, {0, 0}}},
     {{{0, 0}, {1, 0}, {0, E}, {0, 0}}},
@@ -202,7 +202,7 @@
 
 const size_t modEpsilonLines_count = SK_ARRAY_COUNT(modEpsilonLines);
 
-const SkDCubic lessEpsilonLines[] = {
+const CubicPts lessEpsilonLines[] = {
     {{{0, D}, {0, 0}, {0, 0}, {1, 0}}},  // horizontal
     {{{1, 0}, {0, 0}, {0, 0}, {0, D}}},
     {{{1, D}, {2, 0}, {3, 0}, {4, 0}}},
@@ -238,7 +238,7 @@
 
 const size_t lessEpsilonLines_count = SK_ARRAY_COUNT(lessEpsilonLines);
 
-const SkDCubic negEpsilonLines[] = {
+const CubicPts negEpsilonLines[] = {
     {{{0, N}, {0, 0}, {0, 0}, {1, 0}}},  // horizontal
     {{{1, 0}, {0, 0}, {0, 0}, {0, N}}},
     {{{1, N}, {2, 0}, {3, 0}, {4, 0}}},
diff --git a/tests/PathOpsCubicIntersectionTestData.h b/tests/PathOpsCubicIntersectionTestData.h
index e37d571..4c9894c 100644
--- a/tests/PathOpsCubicIntersectionTestData.h
+++ b/tests/PathOpsCubicIntersectionTestData.h
@@ -4,18 +4,18 @@
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
-#include "SkPathOpsCubic.h"
+#include "PathOpsTestCommon.h"
 
-extern const SkDCubic pointDegenerates[];
-extern const SkDCubic notPointDegenerates[];
-extern const SkDCubic tests[][2];
-extern SkDCubic hexTests[][2];
+extern const CubicPts pointDegenerates[];
+extern const CubicPts notPointDegenerates[];
+extern const CubicPts tests[][2];
+extern CubicPts hexTests[][2];
 
-extern const SkDCubic lines[];
-extern const SkDCubic notLines[];
-extern const SkDCubic modEpsilonLines[];
-extern const SkDCubic lessEpsilonLines[];
-extern const SkDCubic negEpsilonLines[];
+extern const CubicPts lines[];
+extern const CubicPts notLines[];
+extern const CubicPts modEpsilonLines[];
+extern const CubicPts lessEpsilonLines[];
+extern const CubicPts negEpsilonLines[];
 
 extern const size_t pointDegenerates_count;
 extern const size_t notPointDegenerates_count;
diff --git a/tests/PathOpsCubicLineIntersectionIdeas.cpp b/tests/PathOpsCubicLineIntersectionIdeas.cpp
index b23dd0c..1555475 100644
--- a/tests/PathOpsCubicLineIntersectionIdeas.cpp
+++ b/tests/PathOpsCubicLineIntersectionIdeas.cpp
@@ -16,7 +16,7 @@
 static bool gPathOpsCubicLineIntersectionIdeasVerbose = false;
 
 static struct CubicLineFailures {
-    SkDCubic c;
+    CubicPts c;
     double t;
     SkDPoint p;
 } cubicLineFailures[] = {
@@ -145,13 +145,15 @@
     double largestR2 = 0;
     for (int index = 0; index < 1000000000; ++index) {
         SkDPoint origin = {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)};
-        SkDCubic cubic = {{origin,
+        CubicPts cuPts = {{origin,
                 {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)},
                 {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)},
                 {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)}
         }};
         // construct a line at a known intersection
         double t = ran.nextRangeF(0, 1);
+        SkDCubic cubic;
+        cubic.debugSet(cuPts.fPts);
         SkDPoint pt = cubic.ptAtT(t);
         // skip answers with no intersections (although note the bug!) or two, or more
         // see if the line / cubic has a fun range of roots
@@ -248,7 +250,9 @@
 }
 
 static double testOneFailure(const CubicLineFailures& failure) {
-    const SkDCubic& cubic = failure.c;
+    const CubicPts& c = failure.c;
+    SkDCubic cubic;
+    cubic.debugSet(c.fPts);
     const SkDPoint& pt = failure.p;
     double A, B, C, D;
     SkDCubic::Coefficients(&cubic[0].fY, &A, &B, &C, &D);
diff --git a/tests/PathOpsCubicLineIntersectionTest.cpp b/tests/PathOpsCubicLineIntersectionTest.cpp
index a2b870d..a6ae5e6 100644
--- a/tests/PathOpsCubicLineIntersectionTest.cpp
+++ b/tests/PathOpsCubicLineIntersectionTest.cpp
@@ -12,7 +12,7 @@
 #include "Test.h"
 
 struct lineCubic {
-    SkDCubic cubic;
+    CubicPts cubic;
     SkDLine line;
 };
 
@@ -25,7 +25,9 @@
 static const size_t failLineCubicTests_count = SK_ARRAY_COUNT(failLineCubicTests);
 
 static void testFail(skiatest::Reporter* reporter, int iIndex) {
-    const SkDCubic& cubic = failLineCubicTests[iIndex].cubic;
+    const CubicPts& cuPts = failLineCubicTests[iIndex].cubic;
+    SkDCubic cubic;
+    cubic.debugSet(cuPts.fPts);
     SkASSERT(ValidCubic(cubic));
     const SkDLine& line = failLineCubicTests[iIndex].line;
     SkASSERT(ValidLine(line));
@@ -123,7 +125,9 @@
 }
 
 static void testOne(skiatest::Reporter* reporter, int iIndex) {
-    const SkDCubic& cubic = lineCubicTests[iIndex].cubic;
+    const CubicPts& cuPts = lineCubicTests[iIndex].cubic;
+    SkDCubic cubic;
+    cubic.debugSet(cuPts.fPts);
     SkASSERT(ValidCubic(cubic));
     const SkDLine& line = lineCubicTests[iIndex].line;
     SkASSERT(ValidLine(line));
@@ -188,7 +192,9 @@
 DEF_TEST(PathOpsCubicLineIntersectionOneOff, reporter) {
     int iIndex = 0;
     testOne(reporter, iIndex);
-    const SkDCubic& cubic = lineCubicTests[iIndex].cubic;
+    const CubicPts& cuPts = lineCubicTests[iIndex].cubic;
+    SkDCubic cubic;
+    cubic.debugSet(cuPts.fPts);
     const SkDLine& line = lineCubicTests[iIndex].line;
     SkIntersections i;
     i.intersect(cubic, line);
diff --git a/tests/PathOpsCubicQuadIntersectionTest.cpp b/tests/PathOpsCubicQuadIntersectionTest.cpp
index 98665af..87c7e13 100644
--- a/tests/PathOpsCubicQuadIntersectionTest.cpp
+++ b/tests/PathOpsCubicQuadIntersectionTest.cpp
@@ -13,8 +13,8 @@
 #include "Test.h"
 
 static struct quadCubic {
-    SkDCubic cubic;
-    SkDQuad quad;
+    CubicPts cubic;
+    QuadPts quad;
 } quadCubicTests[] = {
     {{{{945.08099365234375, 747.1619873046875}, {982.5679931640625, 747.1619873046875}, {1013.6290283203125, 719.656005859375}, {1019.1910400390625, 683.72601318359375}}},
      {{{945, 747}, {976.0660400390625, 747}, {998.03302001953125, 725.03302001953125}}}},
@@ -53,9 +53,13 @@
 
 static void cubicQuadIntersection(skiatest::Reporter* reporter, int index) {
     int iIndex = static_cast<int>(index);
-    const SkDCubic& cubic = quadCubicTests[index].cubic;
+    const CubicPts& c = quadCubicTests[index].cubic;
+    SkDCubic cubic;
+    cubic.debugSet(c.fPts);
     SkASSERT(ValidCubic(cubic));
-    const SkDQuad& quad = quadCubicTests[index].quad;
+    const QuadPts& q = quadCubicTests[index].quad;
+    SkDQuad quad;
+    quad.debugSet(q.fPts);
     SkASSERT(ValidQuad(quad));
     SkReduceOrder reduce1;
     SkReduceOrder reduce2;
diff --git a/tests/PathOpsCubicReduceOrderTest.cpp b/tests/PathOpsCubicReduceOrderTest.cpp
index 6b5cd9b..89a263c 100644
--- a/tests/PathOpsCubicReduceOrderTest.cpp
+++ b/tests/PathOpsCubicReduceOrderTest.cpp
@@ -105,7 +105,9 @@
             ? firstTestIndex : SK_MaxS32;
 #endif
     for (index = firstPointDegeneratesTest; index < pointDegenerates_count; ++index) {
-        const SkDCubic& cubic = pointDegenerates[index];
+        const CubicPts& c = pointDegenerates[index];
+        SkDCubic cubic;
+        cubic.debugSet(c.fPts);
         SkASSERT(ValidCubic(cubic));
         order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
         if (order != 1) {
@@ -114,7 +116,9 @@
         }
     }
     for (index = firstNotPointDegeneratesTest; index < notPointDegenerates_count; ++index) {
-        const SkDCubic& cubic = notPointDegenerates[index];
+        const CubicPts& c = notPointDegenerates[index];
+        SkDCubic cubic;
+        cubic.debugSet(c.fPts);
         SkASSERT(ValidCubic(cubic));
         order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
         if (order == 1) {
@@ -124,7 +128,9 @@
         }
     }
     for (index = firstLinesTest; index < lines_count; ++index) {
-        const SkDCubic& cubic = lines[index];
+        const CubicPts& c = lines[index];
+        SkDCubic cubic;
+        cubic.debugSet(c.fPts);
         SkASSERT(ValidCubic(cubic));
         order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
         if (order != 2) {
@@ -133,7 +139,9 @@
         }
     }
     for (index = firstNotLinesTest; index < notLines_count; ++index) {
-        const SkDCubic& cubic = notLines[index];
+        const CubicPts& c = notLines[index];
+        SkDCubic cubic;
+        cubic.debugSet(c.fPts);
         SkASSERT(ValidCubic(cubic));
         order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
         if (order == 2) {
@@ -142,7 +150,9 @@
        }
     }
     for (index = firstModEpsilonTest; index < modEpsilonLines_count; ++index) {
-        const SkDCubic& cubic = modEpsilonLines[index];
+        const CubicPts& c = modEpsilonLines[index];
+        SkDCubic cubic;
+        cubic.debugSet(c.fPts);
         SkASSERT(ValidCubic(cubic));
         order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
         if (order == 2) {
@@ -151,7 +161,9 @@
         }
     }
     for (index = firstLessEpsilonTest; index < lessEpsilonLines_count; ++index) {
-        const SkDCubic& cubic = lessEpsilonLines[index];
+        const CubicPts& c = lessEpsilonLines[index];
+        SkDCubic cubic;
+        cubic.debugSet(c.fPts);
         SkASSERT(ValidCubic(cubic));
         order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
         if (order != 2) {
@@ -161,7 +173,9 @@
         }
     }
     for (index = firstNegEpsilonTest; index < negEpsilonLines_count; ++index) {
-        const SkDCubic& cubic = negEpsilonLines[index];
+        const CubicPts& c = negEpsilonLines[index];
+        SkDCubic cubic;
+        cubic.debugSet(c.fPts);
         SkASSERT(ValidCubic(cubic));
         order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
         if (order != 2) {
@@ -170,7 +184,9 @@
         }
     }
     for (index = firstQuadraticPointTest; index < quadraticPoints_count; ++index) {
-        const SkDQuad& quad = quadraticPoints[index];
+        const QuadPts& q = quadraticPoints[index];
+        SkDQuad quad;
+        quad.debugSet(q.fPts);
         SkASSERT(ValidQuad(quad));
         SkDCubic cubic = quad.debugToCubic();
         order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
@@ -180,7 +196,9 @@
         }
     }
     for (index = firstQuadraticLineTest; index < quadraticLines_count; ++index) {
-        const SkDQuad& quad = quadraticLines[index];
+        const QuadPts& q = quadraticLines[index];
+        SkDQuad quad;
+        quad.debugSet(q.fPts);
         SkASSERT(ValidQuad(quad));
         SkDCubic cubic = quad.debugToCubic();
         order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
@@ -190,7 +208,9 @@
         }
     }
     for (index = firstQuadraticModLineTest; index < quadraticModEpsilonLines_count; ++index) {
-        const SkDQuad& quad = quadraticModEpsilonLines[index];
+        const QuadPts& q = quadraticModEpsilonLines[index];
+        SkDQuad quad;
+        quad.debugSet(q.fPts);
         SkASSERT(ValidQuad(quad));
         SkDCubic cubic = quad.debugToCubic();
         order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
diff --git a/tests/PathOpsDCubicTest.cpp b/tests/PathOpsDCubicTest.cpp
index 4b5e7b4..b8c08df 100644
--- a/tests/PathOpsDCubicTest.cpp
+++ b/tests/PathOpsDCubicTest.cpp
@@ -8,7 +8,7 @@
 #include "SkPathOpsCubic.h"
 #include "Test.h"
 
-static const SkDCubic hullTests[] = {
+static const CubicPts hullTests[] = {
 {{{2.6250000819563866, 2.3750000223517418}, {2.833333432674408, 2.3333333432674408}, {3.1111112236976624, 2.3333333134651184}, {3.4074075222015381, 2.3333332538604736}}},
 };
 
@@ -16,7 +16,9 @@
 
 DEF_TEST(PathOpsCubicHull, reporter) {
     for (size_t index = 0; index < hullTests_count; ++index) {
-        const SkDCubic& cubic = hullTests[index];
+        const CubicPts& c = hullTests[index];
+        SkDCubic cubic;
+        cubic.debugSet(c.fPts);
         char order[4];
         cubic.convexHull(order);
     }
diff --git a/tests/PathOpsDRectTest.cpp b/tests/PathOpsDRectTest.cpp
index 70d39d1..fa52e78 100644
--- a/tests/PathOpsDRectTest.cpp
+++ b/tests/PathOpsDRectTest.cpp
@@ -11,7 +11,7 @@
 #include "SkPathOpsRect.h"
 #include "Test.h"
 
-static const SkDQuad quadTests[] = {
+static const QuadPts quadTests[] = {
     {{{1, 1}, {2, 1}, {0, 2}}},
     {{{0, 0}, {1, 1}, {3, 1}}},
     {{{2, 0}, {1, 1}, {2, 2}}},
@@ -19,7 +19,7 @@
     {{{0, 0}, {0, 1}, {1, 1}}},
 };
 
-static const SkDCubic cubicTests[] = {
+static const CubicPts cubicTests[] = {
     {{{2, 0}, {3, 1}, {2, 2}, {1, 1}}},
     {{{3, 1}, {2, 2}, {1, 1}, {2, 0}}},
     {{{3, 0}, {2, 1}, {3, 2}, {1, 1}}},
@@ -45,7 +45,9 @@
     size_t index;
     SkDRect rect, rect2;
     for (index = 0; index < quadTests_count; ++index) {
-        const SkDQuad& quad = quadTests[index];
+        const QuadPts& q = quadTests[index];
+        SkDQuad quad;
+        quad.debugSet(q.fPts);
         SkASSERT(ValidQuad(quad));
         setRawBounds(quad, &rect);
         rect2.setBounds(quad);
@@ -57,7 +59,9 @@
         REPORTER_ASSERT(reporter, rect.contains(rightBottom));
     }
     for (index = 0; index < cubicTests_count; ++index) {
-        const SkDCubic& cubic = cubicTests[index];
+        const CubicPts& c = cubicTests[index];
+        SkDCubic cubic;
+        cubic.debugSet(c.fPts);
         SkASSERT(ValidCubic(cubic));
         setRawBounds(cubic, &rect);
         rect2.setBounds(cubic);
diff --git a/tests/PathOpsLineParametetersTest.cpp b/tests/PathOpsLineParametetersTest.cpp
index aab1f7a..66a4be2 100644
--- a/tests/PathOpsLineParametetersTest.cpp
+++ b/tests/PathOpsLineParametetersTest.cpp
@@ -9,7 +9,7 @@
 #include "Test.h"
 
 // tests to verify that distance calculations are coded correctly
-static const SkDCubic tests[] = {
+static const CubicPts tests[] = {
     {{{0, 0}, {1, 1}, {2, 2}, {0, 3}}},
     {{{0, 0}, {1, 1}, {2, 2}, {3, 0}}},
     {{{0, 0}, {5, 0}, {-2, 4}, {3, 4}}},
@@ -40,7 +40,9 @@
 DEF_TEST(PathOpsLineParameters, reporter) {
     for (size_t index = 0; index < tests_count; ++index) {
         SkLineParameters lineParameters;
-        const SkDCubic& cubic = tests[index];
+        const CubicPts& c = tests[index];
+        SkDCubic cubic;
+        cubic.debugSet(c.fPts);
         SkASSERT(ValidCubic(cubic));
         lineParameters.cubicEndPoints(cubic, 0, 3);
         double denormalizedDistance[2];
diff --git a/tests/PathOpsOpTest.cpp b/tests/PathOpsOpTest.cpp
index 84f2310..fa569a4 100644
--- a/tests/PathOpsOpTest.cpp
+++ b/tests/PathOpsOpTest.cpp
@@ -3589,8 +3589,11 @@
 #include "SkPathOpsCubic.h"
 
 static void loop1asQuad(skiatest::Reporter* reporter, const char* filename) {
-    SkDCubic c1 = {{{0,1}, {1,5}, {-5.66666651f,3.33333349f}, {8.83333302f,2.33333349f}}};
-    SkDCubic c2 = {{{1,5}, {-5.66666651f,3.33333349f}, {8.83333302f,2.33333349f}, {0,1}}};
+    CubicPts cubic1 = {{{0,1}, {1,5}, {-5.66666651f,3.33333349f}, {8.83333302f,2.33333349f}}};
+    CubicPts cubic2 = {{{1,5}, {-5.66666651f,3.33333349f}, {8.83333302f,2.33333349f}, {0,1}}};
+    SkDCubic c1, c2;
+    c1.debugSet(cubic1.fPts);
+    c2.debugSet(cubic2.fPts);
     double c1InflectionTs[2], c2InflectionTs[2];
     SkDEBUGCODE(int c1InfTCount =) c1.findInflections(c1InflectionTs);
     SkASSERT(c1InfTCount == 2);
diff --git a/tests/PathOpsQuadIntersectionTest.cpp b/tests/PathOpsQuadIntersectionTest.cpp
index be3d5a8..cb35944 100644
--- a/tests/PathOpsQuadIntersectionTest.cpp
+++ b/tests/PathOpsQuadIntersectionTest.cpp
@@ -14,9 +14,13 @@
 static void standardTestCases(skiatest::Reporter* reporter) {
     bool showSkipped = false;
     for (size_t index = 0; index < quadraticTests_count; ++index) {
-        const SkDQuad& quad1 = quadraticTests[index][0];
+        const QuadPts& q1 = quadraticTests[index][0];
+        SkDQuad quad1;
+        quad1.debugSet(q1.fPts);
         SkASSERT(ValidQuad(quad1));
-        const SkDQuad& quad2 = quadraticTests[index][1];
+        const QuadPts& q2 = quadraticTests[index][1];
+        SkDQuad quad2;
+        quad2.debugSet(q2.fPts);
         SkASSERT(ValidQuad(quad2));
         SkReduceOrder reduce1, reduce2;
         int order1 = reduce1.reduce(quad1);
@@ -52,7 +56,7 @@
     }
 }
 
-static const SkDQuad testSet[] = {
+static const QuadPts testSet[] = {
 {{{-0.001019871095195412636, -0.008523519150912761688}, {-0.005396408028900623322, -0.005396373569965362549}, {-0.02855382487177848816, -0.02855364233255386353}}},
 {{{-0.004567248281091451645, -0.01482933573424816132}, {-0.01142475008964538574, -0.01140109263360500336}, {-0.02852955088019371033, -0.02847047336399555206}}},
 
@@ -326,9 +330,13 @@
 const size_t testSetCount = SK_ARRAY_COUNT(testSet);
 
 static void oneOffTest1(skiatest::Reporter* reporter, size_t outer, size_t inner) {
-    const SkDQuad& quad1 = testSet[outer];
+    const QuadPts& q1 = testSet[outer];
+    SkDQuad quad1;
+    quad1.debugSet(q1.fPts);
     SkASSERT(ValidQuad(quad1));
-    const SkDQuad& quad2 = testSet[inner];
+    const QuadPts& q2 = testSet[inner];
+    SkDQuad quad2;
+    quad2.debugSet(q2.fPts);
     SkASSERT(ValidQuad(quad2));
     SkIntersections intersections;
     intersections.intersect(quad1, quad2);
@@ -358,7 +366,7 @@
     }
 }
 
-static const SkDQuad coincidentTestSet[] = {
+static const QuadPts coincidentTestSet[] = {
     {{{4914.9990234375, 1523}, {4942.75146484375, 1523}, {4962.375, 1542.6239013671875}}},
     {{{4962.3759765625, 1542.6239013671875}, {4942.75244140625, 1523}, {4915, 1523}}},
 #if 0
@@ -374,9 +382,13 @@
 static const int coincidentTestSetCount = (int) SK_ARRAY_COUNT(coincidentTestSet);
 
 static void coincidentTestOne(skiatest::Reporter* reporter, int test1, int test2) {
-    const SkDQuad& quad1 = coincidentTestSet[test1];
+    const QuadPts& q1 = coincidentTestSet[test1];
+    SkDQuad quad1;
+    quad1.debugSet(q1.fPts);
     SkASSERT(ValidQuad(quad1));
-    const SkDQuad& quad2 = coincidentTestSet[test2];
+    const QuadPts& q2 = coincidentTestSet[test2];
+    SkDQuad quad2;
+    quad2.debugSet(q2.fPts);
     SkASSERT(ValidQuad(quad2));
     SkIntersections intersections2;
     intersections2.intersect(quad1, quad2);
@@ -398,9 +410,11 @@
 }
 
 static void intersectionFinder(int test1, int test2) {
-    const SkDQuad& quad1 = testSet[test1];
-    const SkDQuad& quad2 = testSet[test2];
-
+    const QuadPts& q1 = testSet[test1];
+    const QuadPts& q2 = testSet[test2];
+    SkDQuad quad1, quad2;
+    quad1.debugSet(q1.fPts);
+    quad2.debugSet(q2.fPts);
     double t1Seed = 0.5;
     double t2Seed = 0.8;
     double t1Step = 0.1;
@@ -521,8 +535,12 @@
         int outer = 0;
         int inner = outer + 1;
         do {
-            const SkDQuad& quad1 = testSet[outer];
-            const SkDQuad& quad2 = testSet[inner];
+            const QuadPts& q1 = testSet[outer];
+            SkDQuad quad1;
+            quad1.debugSet(q1.fPts);
+            const QuadPts& q2 = testSet[inner];
+            SkDQuad quad2;
+            quad2.debugSet(q2.fPts);
             (void) intersections.intersect(quad1, quad2);
             REPORTER_ASSERT(reporter, intersections.used() >= 0);  // make sure code isn't tossed
             inner += 2;
@@ -531,8 +549,11 @@
     }
     for (int x = 0; x < 100; ++x) {
         for (size_t test = 0; test < quadraticTests_count; ++test) {
-            const SkDQuad& quad1 = quadraticTests[test][0];
-            const SkDQuad& quad2 = quadraticTests[test][1];
+            const QuadPts& q1 = quadraticTests[test][0];
+            const QuadPts& q2 = quadraticTests[test][1];
+            SkDQuad quad1, quad2;
+            quad1.debugSet(q1.fPts);
+            quad2.debugSet(q2.fPts);
             (void) intersections.intersect(quad1, quad2);
             REPORTER_ASSERT(reporter, intersections.used() >= 0);  // make sure code isn't tossed
         }
diff --git a/tests/PathOpsQuadIntersectionTestData.cpp b/tests/PathOpsQuadIntersectionTestData.cpp
index f51f951..537b509 100644
--- a/tests/PathOpsQuadIntersectionTestData.cpp
+++ b/tests/PathOpsQuadIntersectionTestData.cpp
@@ -7,7 +7,7 @@
 
 #include "PathOpsQuadIntersectionTestData.h"
 
-const SkDQuad quadraticPoints[] = {
+const QuadPts quadraticPoints[] = {
     {{{0, 0}, {1, 0}, {0, 0}}},
     {{{0, 0}, {0, 1}, {0, 0}}},
     {{{0, 0}, {1, 1}, {0, 0}}},
@@ -16,7 +16,7 @@
 
 const size_t quadraticPoints_count = SK_ARRAY_COUNT(quadraticPoints);
 
-const SkDQuad quadraticLines[] = {
+const QuadPts quadraticLines[] = {
     {{{0, 0}, {0, 0}, {1, 0}}},
     {{{1, 0}, {0, 0}, {0, 0}}},
     {{{1, 0}, {2, 0}, {3, 0}}},
@@ -49,7 +49,7 @@
 static const double J = FLT_EPSILON * 32;
 static const double K = FLT_EPSILON * 32;  // INVESTIGATE: why are larger multiples necessary?
 
-const SkDQuad quadraticModEpsilonLines[] = {
+const QuadPts quadraticModEpsilonLines[] = {
     {{{0, F}, {0, 0}, {1, 0}}},
     {{{0, 0}, {1, 0}, {0, F}}},
     {{{1, 0}, {0, F}, {0, 0}}},
@@ -82,7 +82,7 @@
 const size_t quadraticModEpsilonLines_count =
         SK_ARRAY_COUNT(quadraticModEpsilonLines);
 
-const SkDQuad quadraticTests[][2] = {
+const QuadPts quadraticTests[][2] = {
     {  // one intersection
      {{{0, 0},
       {0, 1},
diff --git a/tests/PathOpsQuadIntersectionTestData.h b/tests/PathOpsQuadIntersectionTestData.h
index 3090fc9..be46a33 100644
--- a/tests/PathOpsQuadIntersectionTestData.h
+++ b/tests/PathOpsQuadIntersectionTestData.h
@@ -4,12 +4,12 @@
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
-#include "SkPathOpsQuad.h"
+#include "PathOpsTestCommon.h"
 
-extern const SkDQuad quadraticLines[];
-extern const SkDQuad quadraticPoints[];
-extern const SkDQuad quadraticModEpsilonLines[];
-extern const SkDQuad quadraticTests[][2];
+extern const QuadPts quadraticLines[];
+extern const QuadPts quadraticPoints[];
+extern const QuadPts quadraticModEpsilonLines[];
+extern const QuadPts quadraticTests[][2];
 
 extern const size_t quadraticLines_count;
 extern const size_t quadraticPoints_count;
diff --git a/tests/PathOpsQuadLineIntersectionTest.cpp b/tests/PathOpsQuadLineIntersectionTest.cpp
index 6a9e497..f24b2e4 100644
--- a/tests/PathOpsQuadLineIntersectionTest.cpp
+++ b/tests/PathOpsQuadLineIntersectionTest.cpp
@@ -13,7 +13,7 @@
 #include "Test.h"
 
 static struct lineQuad {
-    SkDQuad quad;
+    QuadPts quad;
     SkDLine line;
     int result;
     SkDPoint expected[2];
@@ -56,7 +56,7 @@
 }
 
 static struct oneLineQuad {
-    SkDQuad quad;
+    QuadPts quad;
     SkDLine line;
 } oneOffs[] = {
     {{{{97.9337616,100}, {88,112.94265}, {88,130}}},
@@ -79,7 +79,9 @@
 static void testOneOffs(skiatest::Reporter* reporter) {
     bool flipped = false;
     for (size_t index = 0; index < oneOffs_count; ++index) {
-        const SkDQuad& quad = oneOffs[index].quad;
+        const QuadPts& q = oneOffs[index].quad;
+        SkDQuad quad;
+        quad.debugSet(q.fPts);
         SkASSERT(ValidQuad(quad));
         const SkDLine& line = oneOffs[index].line;
         SkASSERT(ValidLine(line));
@@ -106,7 +108,9 @@
 DEF_TEST(PathOpsQuadLineIntersection, reporter) {
     for (size_t index = 0; index < lineQuadTests_count; ++index) {
         int iIndex = static_cast<int>(index);
-        const SkDQuad& quad = lineQuadTests[index].quad;
+        const QuadPts& q = lineQuadTests[index].quad;
+        SkDQuad quad;
+        quad.debugSet(q.fPts);
         SkASSERT(ValidQuad(quad));
         const SkDLine& line = lineQuadTests[index].line;
         SkASSERT(ValidLine(line));
diff --git a/tests/PathOpsQuadLineIntersectionThreadedTest.cpp b/tests/PathOpsQuadLineIntersectionThreadedTest.cpp
index 7766cfe..a82ac28 100644
--- a/tests/PathOpsQuadLineIntersectionThreadedTest.cpp
+++ b/tests/PathOpsQuadLineIntersectionThreadedTest.cpp
@@ -5,6 +5,7 @@
  * found in the LICENSE file.
  */
 #include "PathOpsExtendedTest.h"
+#include "PathOpsTestCommon.h"
 #include "PathOpsThreadedCommon.h"
 #include "SkIntersections.h"
 #include "SkPathOpsLine.h"
@@ -79,8 +80,10 @@
     int by = state.fB >> 2;
     int cx = state.fC & 0x03;
     int cy = state.fC >> 2;
-    SkDQuad quad = {{{(double) ax, (double) ay}, {(double) bx, (double) by},
+    QuadPts q = {{{(double) ax, (double) ay}, {(double) bx, (double) by},
             {(double) cx, (double) cy}}};
+    SkDQuad quad;
+    quad.debugSet(q.fPts);
     SkReduceOrder reducer;
     int order = reducer.reduce(quad);
     if (order < 3) {
diff --git a/tests/PathOpsQuadReduceOrderTest.cpp b/tests/PathOpsQuadReduceOrderTest.cpp
index dd2c493..4f62026 100644
--- a/tests/PathOpsQuadReduceOrderTest.cpp
+++ b/tests/PathOpsQuadReduceOrderTest.cpp
@@ -10,7 +10,7 @@
 #include "SkReduceOrder.h"
 #include "Test.h"
 
-static const SkDQuad testSet[] = {
+static const QuadPts testSet[] = {
     {{{1, 1}, {2, 2}, {1, 1.000003}}},
     {{{1, 0}, {2, 6}, {3, 0}}}
 };
@@ -19,7 +19,9 @@
 
 static void oneOffTest(skiatest::Reporter* reporter) {
     for (size_t index = 0; index < testSetCount; ++index) {
-        const SkDQuad& quad = testSet[index];
+        const QuadPts& q = testSet[index];
+        SkDQuad quad;
+        quad.debugSet(q.fPts);
         SkReduceOrder reducer;
         SkDEBUGCODE(int result = ) reducer.reduce(quad);
         SkASSERT(result == 3);
@@ -47,14 +49,18 @@
             : SK_MaxS32;
 
     for (index = firstQuadraticLineTest; index < quadraticLines_count; ++index) {
-        const SkDQuad& quad = quadraticLines[index];
+        const QuadPts& q = quadraticLines[index];
+        SkDQuad quad;
+        quad.debugSet(q.fPts);
         order = reducer.reduce(quad);
         if (order != 2) {
             SkDebugf("[%d] line quad order=%d\n", (int) index, order);
         }
     }
     for (index = firstQuadraticModLineTest; index < quadraticModEpsilonLines_count; ++index) {
-        const SkDQuad& quad = quadraticModEpsilonLines[index];
+        const QuadPts& q = quadraticModEpsilonLines[index];
+        SkDQuad quad;
+        quad.debugSet(q.fPts);
         order = reducer.reduce(quad);
         if (order != 2 && order != 3) {  // FIXME: data probably is not good
             SkDebugf("[%d] line mod quad order=%d\n", (int) index, order);
diff --git a/tests/PathOpsTestCommon.h b/tests/PathOpsTestCommon.h
index c5ebbd1..ba64d93 100644
--- a/tests/PathOpsTestCommon.h
+++ b/tests/PathOpsTestCommon.h
@@ -12,6 +12,21 @@
 
 struct SkPathOpsBounds;
 
+struct QuadPts {
+    static const int kPointCount = 3;
+    SkDPoint fPts[kPointCount];
+};
+
+struct ConicPts {
+    QuadPts fPts;
+    SkScalar fWeight;
+};
+
+struct CubicPts {
+    static const int kPointCount = 4;
+    SkDPoint fPts[kPointCount];
+};
+
 void CubicPathToQuads(const SkPath& cubicPath, SkPath* quadPath);
 void CubicPathToSimple(const SkPath& cubicPath, SkPath* simplePath);
 void CubicToQuads(const SkDCubic& cubic, double precision, SkTArray<SkDQuad, true>& quads);
diff --git a/tests/PathOpsThreeWayTest.cpp b/tests/PathOpsThreeWayTest.cpp
index 6a93bfb..b86ff65 100644
--- a/tests/PathOpsThreeWayTest.cpp
+++ b/tests/PathOpsThreeWayTest.cpp
@@ -4,6 +4,7 @@
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
+#include "PathOpsTestCommon.h"
 #include "SkIntersections.h"
 #include "SkTDArray.h"
 #include "Test.h"
@@ -12,7 +13,7 @@
 
 struct Curve {
     int ptCount;
-    SkDCubic curve;  // largest can hold lines / quads/ cubics
+    CubicPts curve;  // largest can hold lines / quads/ cubics
 };
 
 static const Curve testSet0[] = {  // extracted from skpClip2
@@ -49,16 +50,19 @@
             const Curve& iTest = testSet.tests[inner];
             SkIntersections* i = combos.append();
             sk_bzero(i, sizeof(SkIntersections));
-            SkDLine oLine = {{ oTest.curve[0], oTest.curve[1] }};
-            SkDLine iLine = {{ iTest.curve[0], iTest.curve[1] }};
+            SkDLine oLine = {{ oTest.curve.fPts[0], oTest.curve.fPts[1] }};
+            SkDLine iLine = {{ iTest.curve.fPts[0], iTest.curve.fPts[1] }};
+            SkDCubic iCurve, oCurve;
+            iCurve.debugSet(iTest.curve.fPts);
+            oCurve.debugSet(oTest.curve.fPts);
             if (oTest.ptCount == 1 && iTest.ptCount == 1) {
                 i->intersect(oLine, iLine);
             } else if (oTest.ptCount == 1 && iTest.ptCount == 4) {
-                i->intersect(iTest.curve, oLine);
+                i->intersect(iCurve, oLine);
             } else if (oTest.ptCount == 4 && iTest.ptCount == 1) {
-                i->intersect(oTest.curve, iLine);
+                i->intersect(oCurve, iLine);
             } else if (oTest.ptCount == 4 && iTest.ptCount == 4) {
-                i->intersect(oTest.curve, iTest.curve);
+                i->intersect(oCurve, iCurve);
             } else {
                 SkASSERT(0);
             }
diff --git a/tests/StrokerTest.cpp b/tests/StrokerTest.cpp
index 68792d9..7b9a340 100755
--- a/tests/StrokerTest.cpp
+++ b/tests/StrokerTest.cpp
@@ -8,6 +8,7 @@
 #include "PathOpsCubicIntersectionTestData.h"
 #include "PathOpsQuadIntersectionTestData.h"
 #include "SkCommonFlags.h"
+#include "SkPathOpsCubic.h"
 #include "SkPaint.h"
 #include "SkPath.h"
 #include "SkRandom.h"
@@ -49,10 +50,12 @@
     pathTest(path);
 }
 
-static void cubicSetTest(const SkDCubic* dCubic, size_t count) {
+static void cubicSetTest(const CubicPts* dCubic, size_t count) {
     skiatest::Timer timer;
     for (size_t index = 0; index < count; ++index) {
-        const SkDCubic& d = dCubic[index];
+        const CubicPts& dPts = dCubic[index];
+        SkDCubic d;
+        d.debugSet(dPts.fPts);
         SkPoint c[4] = { {(float) d[0].fX, (float) d[0].fY}, {(float) d[1].fX, (float) d[1].fY},
                          {(float) d[2].fX, (float) d[2].fY}, {(float) d[3].fX, (float) d[3].fY} };
         cubicTest(c);
@@ -62,11 +65,13 @@
     }
 }
 
-static void cubicPairSetTest(const SkDCubic dCubic[][2], size_t count) {
+static void cubicPairSetTest(const CubicPts dCubic[][2], size_t count) {
     skiatest::Timer timer;
     for (size_t index = 0; index < count; ++index) {
         for (int pair = 0; pair < 2; ++pair) {
-            const SkDCubic& d = dCubic[index][pair];
+            const CubicPts& dPts = dCubic[index][pair];
+            SkDCubic d;
+            d.debugSet(dPts.fPts);
             SkPoint c[4] = { {(float) d[0].fX, (float) d[0].fY}, {(float) d[1].fX, (float) d[1].fY},
                              {(float) d[2].fX, (float) d[2].fY}, {(float) d[3].fX, (float) d[3].fY} };
             cubicTest(c);
@@ -77,10 +82,12 @@
     }
 }
 
-static void quadSetTest(const SkDQuad* dQuad, size_t count) {
+static void quadSetTest(const QuadPts* dQuad, size_t count) {
     skiatest::Timer timer;
     for (size_t index = 0; index < count; ++index) {
-        const SkDQuad& d = dQuad[index];
+        const QuadPts& dPts = dQuad[index];
+        SkDQuad d;
+        d.debugSet(dPts.fPts);
         SkPoint c[3] = { {(float) d[0].fX, (float) d[0].fY}, {(float) d[1].fX, (float) d[1].fY},
                          {(float) d[2].fX, (float) d[2].fY}  };
         quadTest(c);
@@ -90,11 +97,13 @@
     }
 }
 
-static void quadPairSetTest(const SkDQuad dQuad[][2], size_t count) {
+static void quadPairSetTest(const QuadPts dQuad[][2], size_t count) {
     skiatest::Timer timer;
     for (size_t index = 0; index < count; ++index) {
         for (int pair = 0; pair < 2; ++pair) {
-            const SkDQuad& d = dQuad[index][pair];
+            const QuadPts& dPts = dQuad[index][pair];
+            SkDQuad d;
+            d.debugSet(dPts.fPts);
             SkPoint c[3] = { {(float) d[0].fX, (float) d[0].fY}, {(float) d[1].fX, (float) d[1].fY},
                              {(float) d[2].fX, (float) d[2].fY}  };
             quadTest(c);