SkMatrix::Rotate()

Change-Id: I66794fffcb2e368277aedfe39e4f390292e1df39
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291777
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h
index 76f998b..2d66946 100644
--- a/include/core/SkMatrix.h
+++ b/include/core/SkMatrix.h
@@ -87,6 +87,20 @@
     static SkMatrix SK_WARN_UNUSED_RESULT Translate(SkVector t) { return Translate(t.x(), t.y()); }
     static SkMatrix SK_WARN_UNUSED_RESULT Translate(SkIVector t) { return Translate(t.x(), t.y()); }
 
+    /** Sets SkMatrix to rotate by |deg| about a pivot point at (0, 0).
+
+        @param deg  rotation angle in degrees (positive rotates clockwise)
+        @return     SkMatrix with rotation
+    */
+    static SkMatrix SK_WARN_UNUSED_RESULT RotateDeg(SkScalar deg) {
+        SkMatrix m;
+        m.setRotate(deg);
+        return m;
+    }
+    static SkMatrix SK_WARN_UNUSED_RESULT RotateRad(SkScalar rad) {
+        return RotateDeg(SkRadiansToDegrees(rad));
+    }
+
 #ifdef SK_SUPPORT_LEGACY_MATRIX_FACTORIES
     // DEPRECATED
     static SkMatrix SK_WARN_UNUSED_RESULT MakeTrans(SkScalar dx, SkScalar dy) {
diff --git a/modules/skottie/src/Transform.cpp b/modules/skottie/src/Transform.cpp
index a7f44f6..7548233 100644
--- a/modules/skottie/src/Transform.cpp
+++ b/modules/skottie/src/Transform.cpp
@@ -41,14 +41,11 @@
 }
 
 SkMatrix TransformAdapter2D::totalMatrix() const {
-    SkMatrix t = SkMatrix::Translate(-fAnchorPoint.x, -fAnchorPoint.y);
-
-    t.postScale(fScale.x / 100, fScale.y / 100); // 100% based
-    t.postRotate(fRotation + fOrientation);
-    t.postTranslate(fPosition.x, fPosition.y);
     // TODO: skew
-
-    return t;
+    return SkMatrix::Translate(fPosition.x, fPosition.y)
+         * SkMatrix::RotateDeg(fRotation + fOrientation)
+         * SkMatrix::Scale    (fScale.x / 100, fScale.y / 100) // 100% based
+         * SkMatrix::Translate(-fAnchorPoint.x, -fAnchorPoint.y);
 }
 
 SkPoint TransformAdapter2D::getAnchorPoint() const {