Reland of "switch patheffects over to sk_sp (patchset #5 id:80001 of https://codereview.chromium.org/1813553005/ )"

This reverts commit f28ad894272018fd2855e3f77ea1236ea0cce1c0.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1813123003

TBR=

Review URL: https://codereview.chromium.org/1813123003
diff --git a/samplecode/SamplePathEffects.cpp b/samplecode/SamplePathEffects.cpp
index a162cf3..10715f3 100644
--- a/samplecode/SamplePathEffects.cpp
+++ b/samplecode/SamplePathEffects.cpp
@@ -26,9 +26,10 @@
     4, 0, 0, -4, 8, -4, 12, 0, 8, 4, 0, 4
 };
 
-static SkPathEffect* make_pe(int flags, SkScalar phase) {
-    if (flags == 1)
-        return SkCornerPathEffect::Create(SkIntToScalar(CORNER_RADIUS));
+static sk_sp<SkPathEffect> make_pe(int flags, SkScalar phase) {
+    if (flags == 1) {
+        return SkCornerPathEffect::Make(SkIntToScalar(CORNER_RADIUS));
+    }
 
     SkPath  path;
     path.moveTo(SkIntToScalar(gXY[0]), SkIntToScalar(gXY[1]));
@@ -37,36 +38,30 @@
     path.close();
     path.offset(SkIntToScalar(-6), 0);
 
-    SkPathEffect* outer = SkPath1DPathEffect::Create(path, 12, phase,
-                                                     SkPath1DPathEffect::kRotate_Style);
+    auto outer = SkPath1DPathEffect::Make(path, 12, phase, SkPath1DPathEffect::kRotate_Style);
 
     if (flags == 2)
         return outer;
 
-    SkPathEffect* inner = SkCornerPathEffect::Create(SkIntToScalar(CORNER_RADIUS));
+    auto inner = SkCornerPathEffect::Make(SkIntToScalar(CORNER_RADIUS));
 
-    SkPathEffect* pe = SkComposePathEffect::Create(outer, inner);
-    outer->unref();
-    inner->unref();
-    return pe;
+    return SkComposePathEffect::Make(outer, inner);
 }
 
-static SkPathEffect* make_warp_pe(SkScalar phase) {
+static sk_sp<SkPathEffect> make_warp_pe(SkScalar phase) {
     SkPath  path;
     path.moveTo(SkIntToScalar(gXY[0]), SkIntToScalar(gXY[1]));
-    for (unsigned i = 2; i < SK_ARRAY_COUNT(gXY); i += 2)
+    for (unsigned i = 2; i < SK_ARRAY_COUNT(gXY); i += 2) {
         path.lineTo(SkIntToScalar(gXY[i]), SkIntToScalar(gXY[i+1]));
+    }
     path.close();
     path.offset(SkIntToScalar(-6), 0);
 
-    SkPathEffect* outer = SkPath1DPathEffect::Create(
+    auto outer = SkPath1DPathEffect::Make(
         path, 12, phase, SkPath1DPathEffect::kMorph_Style);
-    SkPathEffect* inner = SkCornerPathEffect::Create(SkIntToScalar(CORNER_RADIUS));
+    auto inner = SkCornerPathEffect::Make(SkIntToScalar(CORNER_RADIUS));
 
-    SkPathEffect* pe = SkComposePathEffect::Create(outer, inner);
-    outer->unref();
-    inner->unref();
-    return pe;
+    return SkComposePathEffect::Make(outer, inner);
 }
 
 ///////////////////////////////////////////////////////////
@@ -143,19 +138,19 @@
         canvas->translate(0, 50);
 
         paint.setColor(SK_ColorBLUE);
-        paint.setPathEffect(make_pe(2, fPhase))->unref();
+        paint.setPathEffect(make_pe(2, fPhase));
         canvas->drawPath(fPath, paint);
 
         canvas->translate(0, 50);
 
         paint.setARGB(0xFF, 0, 0xBB, 0);
-        paint.setPathEffect(make_pe(3, fPhase))->unref();
+        paint.setPathEffect(make_pe(3, fPhase));
         canvas->drawPath(fPath, paint);
 
         canvas->translate(0, 50);
 
         paint.setARGB(0xFF, 0, 0, 0);
-        paint.setPathEffect(make_warp_pe(fPhase))->unref();
+        paint.setPathEffect(make_warp_pe(fPhase));
         TestRastBuilder testRastBuilder;
         paint.setRasterizer(testRastBuilder.detachRasterizer())->unref();
         canvas->drawPath(fPath, paint);