fix hair fuzz

If the end and control points of a quad, conic, or cubic are the same,
adjust all of them when stretching the curve to account for a square
or round end cap. If all of the points are the same, move all but the
last.

Enlarge the clip check to account for the cap.

The clip bug was detected by ASAN.

R=reed@google.com, msarett@google.com
BUG=571214
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1547483003

Review URL: https://codereview.chromium.org/1547483003
diff --git a/gm/strokes.cpp b/gm/strokes.cpp
index f2abb0b..261db9c 100644
--- a/gm/strokes.cpp
+++ b/gm/strokes.cpp
@@ -236,6 +236,38 @@
     canvas->drawPath(path, paint);
 }
 
+DEF_SIMPLE_GM(quadcap, canvas, 200, 200) {
+    SkPaint p;
+    p.setAntiAlias(true);
+    p.setStyle(SkPaint::kStroke_Style);
+    p.setStrokeWidth(0);
+    SkPath path;
+    SkPoint pts[] = {{105.738571f,13.126318f},
+            {105.738571f,13.126318f}, 
+            {123.753784f,1.f}};
+    SkVector tangent = pts[1] - pts[2];
+    tangent.normalize();
+    SkPoint pts2[3];
+    memcpy(pts2, pts, sizeof(pts));
+    const SkScalar capOutset = SK_ScalarPI / 8;
+    pts2[0].fX += tangent.fX * capOutset;
+    pts2[0].fY += tangent.fY * capOutset;
+    pts2[1].fX += tangent.fX * capOutset;
+    pts2[1].fY += tangent.fY * capOutset;
+    pts2[2].fX += -tangent.fX * capOutset;
+    pts2[2].fY += -tangent.fY * capOutset;
+    path.moveTo(pts2[0]);
+    path.quadTo(pts2[1], pts2[2]);
+    canvas->drawPath(path, p);
+
+    path.reset();
+    path.moveTo(pts[0]);
+    path.quadTo(pts[1], pts[2]);
+    p.setStrokeCap(SkPaint::kRound_Cap);
+    canvas->translate(30, 0);
+    canvas->drawPath(path, p);
+}
+
 class Strokes2GM : public skiagm::GM {
     SkPath fPath;
 protected: