sk_sp versions of newWithColorFilter and newWithLocalMatrix

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

Review URL: https://codereview.chromium.org/1782703002
diff --git a/gm/colorfilterimagefilter.cpp b/gm/colorfilterimagefilter.cpp
index b0f67bf..fa33a9c 100644
--- a/gm/colorfilterimagefilter.cpp
+++ b/gm/colorfilterimagefilter.cpp
@@ -212,7 +212,7 @@
         for (int x = -1; x < filters.count(); ++x) {
             SkColorFilter* filter = x >= 0 ? filters[x] : nullptr;
 
-            paint.setShader(shader->newWithColorFilter(filter))->unref();
+            paint.setShader(shader->makeWithColorFilter(filter));
             canvas->drawRect(r, paint);
             canvas->translate(150, 0);
         }
diff --git a/gm/perlinnoise.cpp b/gm/perlinnoise.cpp
index 7e6f70e..92f0f96 100644
--- a/gm/perlinnoise.cpp
+++ b/gm/perlinnoise.cpp
@@ -154,7 +154,7 @@
 
         SkMatrix lm;
         lm.setScale(2, 2);
-        paint.setShader(paint.getShader()->newWithLocalMatrix(lm))->unref();
+        paint.setShader(paint.getShader()->makeWithLocalMatrix(lm));
         r.fRight += r.width();
         r.fBottom += r.height();
 
diff --git a/include/core/SkShader.h b/include/core/SkShader.h
index 3e40936..0bcb98a 100644
--- a/include/core/SkShader.h
+++ b/include/core/SkShader.h
@@ -323,13 +323,13 @@
      *  Return a shader that will apply the specified localMatrix to this shader.
      *  The specified matrix will be applied before any matrix associated with this shader.
      */
-    SkShader* newWithLocalMatrix(const SkMatrix&) const;
+    sk_sp<SkShader> makeWithLocalMatrix(const SkMatrix&) const;
 
     /**
      *  Create a new shader that produces the same colors as invoking this shader and then applying
      *  the colorfilter.
      */
-    SkShader* newWithColorFilter(SkColorFilter*) const;
+    sk_sp<SkShader> makeWithColorFilter(SkColorFilter*) const;
 
     //////////////////////////////////////////////////////////////////////////
     //  Factory methods for stock shaders
@@ -359,6 +359,13 @@
     static SkShader* CreateComposeShader(SkShader* dst, SkShader* src, SkXfermode* xfer);
     static SkShader* CreatePictureShader(const SkPicture* src, TileMode tmx, TileMode tmy,
                                          const SkMatrix* localMatrix, const SkRect* tile);
+
+    SkShader* newWithLocalMatrix(const SkMatrix& matrix) const {
+        return this->makeWithLocalMatrix(matrix).release();
+    }
+    SkShader* newWithColorFilter(SkColorFilter* filter) const {
+        return this->makeWithColorFilter(filter).release();
+    }
 #endif
 
     /**
diff --git a/samplecode/SamplePatch.cpp b/samplecode/SamplePatch.cpp
index c9ecb70..3ce350a 100644
--- a/samplecode/SamplePatch.cpp
+++ b/samplecode/SamplePatch.cpp
@@ -289,14 +289,12 @@
         if (true) {
             SkMatrix m;
             m.setSkew(1, 0);
-            SkShader* s = paint.getShader()->newWithLocalMatrix(m);
-            paint.setShader(s)->unref();
+            paint.setShader(paint.getShader()->makeWithLocalMatrix(m));
         }
         if (true) {
             SkMatrix m;
             m.setRotate(fAngle);
-            SkShader* s = paint.getShader()->newWithLocalMatrix(m);
-            paint.setShader(s)->unref();
+            paint.setShader(paint.getShader()->makeWithLocalMatrix(m));
         }
         patch.setBounds(fSize1.fX, fSize1.fY);
         drawpatches(canvas, paint, nu, nv, &patch);
diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp
index 9fcab9c..04897e3 100644
--- a/src/core/SkBlitter.cpp
+++ b/src/core/SkBlitter.cpp
@@ -867,8 +867,8 @@
 
     if (cf) {
         SkASSERT(shader);
-        shader = shader->newWithColorFilter(cf);
-        paint.writable()->setShader(shader)->unref();
+        paint.writable()->setShader(shader->makeWithColorFilter(cf));
+        shader = paint->getShader();
         // blitters should ignore the presence/absence of a filter, since
         // if there is one, the shader will take care of it.
     }
diff --git a/src/core/SkColorFilterShader.cpp b/src/core/SkColorFilterShader.cpp
index f5a3b9c..2e426a1 100644
--- a/src/core/SkColorFilterShader.cpp
+++ b/src/core/SkColorFilterShader.cpp
@@ -137,10 +137,10 @@
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-SkShader* SkShader::newWithColorFilter(SkColorFilter* filter) const {
+sk_sp<SkShader> SkShader::makeWithColorFilter(SkColorFilter* filter) const {
     SkShader* base = const_cast<SkShader*>(this);
     if (!filter) {
-        return SkRef(base);
+        return sk_ref_sp(base);
     }
-    return new SkColorFilterShader(base, filter);
+    return sk_make_sp<SkColorFilterShader>(base, filter);
 }
diff --git a/src/core/SkLocalMatrixShader.cpp b/src/core/SkLocalMatrixShader.cpp
index 42b378d..ddd6114 100644
--- a/src/core/SkLocalMatrixShader.cpp
+++ b/src/core/SkLocalMatrixShader.cpp
@@ -14,7 +14,7 @@
     if (!baseShader) {
         return nullptr;
     }
-    return baseShader->newWithLocalMatrix(lm);
+    return baseShader->makeWithLocalMatrix(lm).release();
 }
 
 void SkLocalMatrixShader::flatten(SkWriteBuffer& buffer) const {
@@ -47,9 +47,9 @@
 }
 #endif
 
-SkShader* SkShader::newWithLocalMatrix(const SkMatrix& localMatrix) const {
+sk_sp<SkShader> SkShader::makeWithLocalMatrix(const SkMatrix& localMatrix) const {
     if (localMatrix.isIdentity()) {
-        return SkRef(const_cast<SkShader*>(this));
+        return sk_ref_sp(const_cast<SkShader*>(this));
     }
 
     const SkMatrix* lm = &localMatrix;
@@ -63,5 +63,5 @@
         baseShader = proxy.get();
     }
 
-    return new SkLocalMatrixShader(baseShader, *lm);
+    return sk_make_sp<SkLocalMatrixShader>(baseShader, *lm);
 }
diff --git a/tests/SkColor4fTest.cpp b/tests/SkColor4fTest.cpp
index 62eed21..0b5a4e0 100644
--- a/tests/SkColor4fTest.cpp
+++ b/tests/SkColor4fTest.cpp
@@ -125,8 +125,7 @@
 
 static sk_sp<SkShader> make_cf_sh() {
     SkAutoTUnref<SkColorFilter> filter(make_mx_cf());
-    sk_sp<SkShader> shader(make_color_sh());
-    return sk_sp<SkShader>(shader->newWithColorFilter(filter));
+    return make_color_sh()->makeWithColorFilter(filter);
 }
 
 static bool compare_spans(const SkPM4f span4f[], const SkPMColor span4b[], int count,