[canvaskit] Save a copy on CPU backend by using RasterDirect
Draw directly into an unpremul buffer (which is what Canvas's
get/putImageData is) and it speeds up Skottie animation by
about 3x.
Bug: skia:
Change-Id: Ie131276e3a675e0e5a35190da93f34d7469624e4
Reviewed-on: https://skia-review.googlesource.com/c/173644
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/experimental/canvaskit/externs.js b/experimental/canvaskit/externs.js
index 6f2527b..5e2d724 100644
--- a/experimental/canvaskit/externs.js
+++ b/experimental/canvaskit/externs.js
@@ -58,6 +58,7 @@
_MakeSkDashPathEffect: function() {},
_MakeSkVertices: function() {},
_MakeTwoPointConicalGradientShader: function() {},
+ _getRasterDirectSurface: function() {},
_getRasterN32PremulSurface: function() {},
_getWebGLSurface: function() {},
@@ -227,6 +228,13 @@
YELLOW: {},
CYAN: {},
BLACK: {},
+ WHITE: {},
+
+ AlphaType: {
+ Opaque: {},
+ Premul: {},
+ Unpremul: {},
+ },
BlendMode: {
Clear: {},
@@ -272,6 +280,20 @@
Intersect: {},
},
+ ColorType: {
+ Alpha_8: {},
+ RGB_565: {},
+ ARGB_4444: {},
+ RGBA_8888: {},
+ RGB_888x: {},
+ BGRA_8888: {},
+ RGBA_1010102: {},
+ RGB_101010x: {},
+ Gray_8: {},
+ RGBA_F16: {},
+ RGBA_F32: {},
+ },
+
FillType: {
Winding: {},
EvenOdd: {},