Local matrix support for RP gradients

Change-Id: Id2cef26e0f91f14a0f1370fabe5ca15af9a4c07c
Reviewed-on: https://skia-review.googlesource.com/15317
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 03048db..3be6c1b 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -352,13 +352,13 @@
     const SkMatrix& ctm, const SkPaint& paint,
     const SkMatrix* localM) const
 {
-    // Local matrix not supported currently.  Remove once we have a generic RP wrapper.
-    if (localM || !getLocalMatrix().isIdentity()) {
-        return false;
-    }
-
     SkMatrix matrix;
-    if (!ctm.invert(&matrix)) {
+    if (!this->computeTotalInverse(ContextRec(paint,
+                                              ctm,
+                                              localM,
+                                              ContextRec::kPM4f_DstType, // doesn't matter here
+                                              dstCS),
+                                   &matrix)) {
         return false;
     }