added optimizations to speed up skinning

Docs-Preview: https://skia.org/?cl=145148
Bug: skia:
Change-Id: If27722105a1e8999f6440b6fd4044cc1f327827e
Reviewed-on: https://skia-review.googlesource.com/145148
Commit-Queue: Ruiqi Mao <ruiqimao@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/docs/SkCanvas_Reference.bmh b/docs/SkCanvas_Reference.bmh
index c310b11..8ec893d 100644
--- a/docs/SkCanvas_Reference.bmh
+++ b/docs/SkCanvas_Reference.bmh
@@ -5749,8 +5749,8 @@
 
 # ------------------------------------------------------------------------------
 
-#Method void drawVertices(const SkVertices* vertices, const SkMatrix* bones, int boneCount,
-                          SkBlendMode mode, const SkPaint& paint)
+#Method void drawVertices(const SkVertices* vertices, const SkVertices::Bone bones[],
+                          int boneCount, SkBlendMode mode, const SkPaint& paint)
 
 Draws Vertices vertices, a triangle mesh, using Clip and Matrix. Bone data is used to
 deform vertices with bone weights.
@@ -5759,7 +5759,7 @@
 The first element of bones should be an object to world space transformation matrix that
 will be applied before performing mesh deformations. If no such transformation is needed,
 it should be the identity matrix.
-boneCount must be at most 100, and thus the size of bones should be at most 100.
+boneCount must be at most 80, and thus the size of bones should be at most 80.
 
 #Param  vertices  triangle mesh to draw ##
 #Param  bones     bone matrix data ##
@@ -5767,7 +5767,7 @@
 #Param  mode      combines Vertices_Colors with Shader, if both are present ##
 #Param  paint     specifies the Shader, used as Vertices texture, may be nullptr ##
 
-#Example
+#NoExample
 void draw(SkCanvas* canvas) {
     SkPaint paint;
     SkPoint points[] = { { 0, 0 }, { 250, 0 }, { 100, 100 }, { 0, 250 } };
@@ -5781,10 +5781,10 @@
                                               { 1.0f, 0.0f, 0.0f, 0.0f },
                                               { 1.0f, 0.0f, 0.0f, 0.0f },
                                               { 1.0f, 0.0f, 0.0f, 0.0f } };
-    SkMatrix bones[] = { SkMatrix::I(),
-                         SkMatrix::MakeTrans(0, 20),
-                         SkMatrix::MakeTrans(50, 50),
-                         SkMatrix::MakeTrans(20, 0) };
+    SkVertices::Bone bones[] = { {{ 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f }},
+                                 {{ 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 20.0f }},
+                                 {{ 1.0f, 0.0f, 0.0f, 1.0f, 50.0f, 50.0f }},
+                                 {{ 1.0f, 0.0f, 0.0f, 1.0f, 20.0f, 0.0f }} };
     paint.setShader(SkGradientShader::MakeLinear(points, colors, nullptr, 4,
             SkShader::kClamp_TileMode));
     auto vertices = SkVertices::MakeCopy(SkVertices::kTriangleFan_VertexMode,
@@ -5799,8 +5799,8 @@
 
 # ------------------------------------------------------------------------------
 
-#Method void drawVertices(const sk_sp<SkVertices>& vertices, const SkMatrix* bones, int boneCount,
-                          SkBlendMode mode, const SkPaint& paint)
+#Method void drawVertices(const sk_sp<SkVertices>& vertices, const SkVertices::Bone bones[],
+                          int boneCount, SkBlendMode mode, const SkPaint& paint)
 
 Draws Vertices vertices, a triangle mesh, using Clip and Matrix. Bone data is used to
 deform vertices with bone weights.
@@ -5809,7 +5809,7 @@
 The first element of bones should be an object to world space transformation matrix that
 will be applied before performing mesh deformations. If no such transformation is needed,
 it should be the identity matrix.
-boneCount must be at most 100, and thus the size of bones should be at most 100.
+boneCount must be at most 80, and thus the size of bones should be at most 80.
 
 #Param  vertices  triangle mesh to draw ##
 #Param  bones     bone matrix data ##
@@ -5817,7 +5817,7 @@
 #Param  mode      combines Vertices_Colors with Shader, if both are present ##
 #Param  paint     specifies the Shader, used as Vertices texture, may be nullptr ##
 
-#Example
+#NoExample
 void draw(SkCanvas* canvas) {
     SkPaint paint;
     SkPoint points[] = { { 0, 0 }, { 250, 0 }, { 100, 100 }, { 0, 250 } };
@@ -5831,10 +5831,10 @@
                                               { 1.0f, 0.0f, 0.0f, 0.0f },
                                               { 1.0f, 0.0f, 0.0f, 0.0f },
                                               { 1.0f, 0.0f, 0.0f, 0.0f } };
-    SkMatrix bones[] = { SkMatrix::I(),
-                         SkMatrix::MakeTrans(0, 20),
-                         SkMatrix::MakeTrans(50, 50),
-                         SkMatrix::MakeTrans(20, 0) };
+    SkVertices::Bone bones[] = { {{ 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f }},
+                                 {{ 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 20.0f }},
+                                 {{ 1.0f, 0.0f, 0.0f, 1.0f, 50.0f, 50.0f }},
+                                 {{ 1.0f, 0.0f, 0.0f, 1.0f, 20.0f, 0.0f }} };
     paint.setShader(SkGradientShader::MakeLinear(points, colors, nullptr, 4,
             SkShader::kClamp_TileMode));
     auto vertices = SkVertices::MakeCopy(SkVertices::kTriangleFan_VertexMode,