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,
diff --git a/docs/undocumented.bmh b/docs/undocumented.bmh
index 6161398..30c0657 100644
--- a/docs/undocumented.bmh
+++ b/docs/undocumented.bmh
@@ -7,7 +7,7 @@
  API
  BMP GIF HEIF ICO JPEG PNG WBMP WebP
  CPU
- GPU GPU-backed OpenGL Vulkan I/O MSAA 
+ GPU GPU-backed OpenGL Vulkan I/O MSAA
  PDF XPS
  RFC
  NaN NaNs
@@ -81,8 +81,8 @@
 #Substitute unhinted
 ##
 
-# this jargon requires a substitute to space the phrase. 
-#Topic Little_Endian 
+# this jargon requires a substitute to space the phrase.
+#Topic Little_Endian
 #Substitute little endian
 ##
 
@@ -90,11 +90,11 @@
 #Substitute big endian
 ##
 
-#Topic YUV_Component_Y 
+#Topic YUV_Component_Y
 #Substitute YUV component y
 ##
 
-#Topic YUV_Component_U 
+#Topic YUV_Component_U
 #Substitute YUV component u
 ##
 
@@ -106,7 +106,7 @@
 #Substitute UV mapping
 ##
 
-#Topic Multi_Sample_Anti_Aliasing 
+#Topic Multi_Sample_Anti_Aliasing
 #Substitute multi-sample anti-aliasing
 ##
 
@@ -114,43 +114,43 @@
 #Substitute GPU share group
 ##
 
-#Topic Bezier_Curve 
+#Topic Bezier_Curve
 #Substitute Bezier cruve
 ##
 
-#Topic Coons_Patch 
+#Topic Coons_Patch
 #Substitute Coons patch
 ##
 
-#Topic Cartesian_Coordinate 
+#Topic Cartesian_Coordinate
 #Substitute Cartesian coordinate
 ##
 
-#Topic Euclidean_Distance 
+#Topic Euclidean_Distance
 #Substitute Euclidean distance
 ##
 
-#Topic Euclidean_Space 
+#Topic Euclidean_Space
 #Substitute Euclidean space
 ##
 
-#Topic HTML_Gray 
+#Topic HTML_Gray
 #Substitute HTML gray
 ##
 
-#Topic HTML_Silver 
+#Topic HTML_Silver
 #Substitute HTML silver
 ##
 
-#Topic HTML_Lime 
+#Topic HTML_Lime
 #Substitute HTML lime
 ##
 
-#Topic HTML_Green 
+#Topic HTML_Green
 #Substitute HTML green
 ##
 
-#Topic HTML_Aqua 
+#Topic HTML_Aqua
 #Substitute HTML aqua
 ##
 
@@ -158,7 +158,7 @@
 #Substitute HTML fuchsia
 ##
 
-#Topic SVG_lightgray 
+#Topic SVG_lightgray
 #Substitute SVG light gray
 ##
 
@@ -787,6 +787,8 @@
 
 #Topic Vertices
 #Class SkVertices
+#Class Bone
+##
 ##
 #Subtopic Colors
 ##
diff --git a/docs/usingBookmaker.bmh b/docs/usingBookmaker.bmh
index f74db8f..4e952e2 100644
--- a/docs/usingBookmaker.bmh
+++ b/docs/usingBookmaker.bmh
@@ -147,6 +147,7 @@
 $ ./out/skia/bookmaker -a docs/status.json -e fiddle.json
 $ ~/go/bin/fiddlecli --input fiddle.json --output fiddleout.json
 $ ./out/skia/bookmaker -a docs/status.json -f fiddleout.json -r site/user/api -c
+$ ./out/skia/bookmaker -a docs/status.json -f fiddleout.json -r site/user/api
 $ ./out/skia/bookmaker -a docs/status.json -x
 $ ./out/skia/bookmaker -a docs/status.json -p
 ##