fix pathops handling of tiny wrapback quads and cubics

If a quad or cubic reverses on itself, path ops breaks
it in two. It determines the type of curve remaining,
but needs to replace near-zero with zero first.

TBR=reed@google.com
Bug:790731
Change-Id: I3a1afa14fff064ca874b5abc768ec1ec5c2cf22f
Reviewed-on: https://skia-review.googlesource.com/79400
Commit-Queue: Cary Clark <caryclark@google.com>
Reviewed-by: Cary Clark <caryclark@skia.org>
diff --git a/src/pathops/SkOpEdgeBuilder.cpp b/src/pathops/SkOpEdgeBuilder.cpp
index c1224c3..572942d 100644
--- a/src/pathops/SkOpEdgeBuilder.cpp
+++ b/src/pathops/SkOpEdgeBuilder.cpp
@@ -215,6 +215,9 @@
                         if (!SkScalarsAreFinite(&pair[0].fX, SK_ARRAY_COUNT(pair) * 2)) {
                             return false;
                         }
+                        for (unsigned index = 0; index < SK_ARRAY_COUNT(pair); ++index) {
+                            force_small_to_zero(&pair[index]);
+                        }
                         SkPoint cStorage[2][2];
                         SkPath::Verb v1 = SkReduceOrder::Quad(&pair[0], cStorage[0]);
                         SkPath::Verb v2 = SkReduceOrder::Quad(&pair[2], cStorage[1]);
diff --git a/src/pathops/SkPathOpsCubic.cpp b/src/pathops/SkPathOpsCubic.cpp
index 5c672fa..33229fa 100644
--- a/src/pathops/SkPathOpsCubic.cpp
+++ b/src/pathops/SkPathOpsCubic.cpp
@@ -713,7 +713,10 @@
     const double* dCubic = &fPts[0].fX;
     SkScalar* cubic = &pts[0].fX;
     for (int index = 0; index < kPointCount * 2; ++index) {
-        *cubic++ = SkDoubleToScalar(*dCubic++);
+        cubic[index] = SkDoubleToScalar(dCubic[index]);
+        if (SkScalarAbs(cubic[index]) < FLT_EPSILON_ORDERABLE_ERR) {
+            cubic[index] = 0;
+        }
     }
     return SkScalarsAreFinite(&pts->fX, kPointCount * 2);
 }