[canvaskit] Add drawVertices API
This also does some clean up to how we name enums - the caps felt a bit
obnoxious. CAPS are reserved now for constants (like colors).
Small bug fix with leaking memory on discrete path effects
This also adds a few more things from PathKit
Bug: skia:
Change-Id: Iad7e21ac36d35a36a8b255dc82b1dcc886344db1
Reviewed-on: https://skia-review.googlesource.com/c/166804
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Reed <reed@google.com>
diff --git a/modules/pathkit/pathkit_wasm_bindings.cpp b/modules/pathkit/pathkit_wasm_bindings.cpp
index d69e6dd..c8d821f 100644
--- a/modules/pathkit/pathkit_wasm_bindings.cpp
+++ b/modules/pathkit/pathkit_wasm_bindings.cpp
@@ -38,6 +38,7 @@
using SkPathOrNull = emscripten::val;
// Self-documenting for when we return a string
using JSString = emscripten::val;
+using JSArray = emscripten::val;
// =================================================================================
// Creating/Exporting Paths with cmd arrays
@@ -53,11 +54,11 @@
}
}
-emscripten::val EMSCRIPTEN_KEEPALIVE ToCmds(const SkPath& path) {
- emscripten::val cmds = emscripten::val::array();
+JSArray EMSCRIPTEN_KEEPALIVE ToCmds(const SkPath& path) {
+ JSArray cmds = emscripten::val::array();
VisitPath(path, [&cmds](SkPath::Verb verb, const SkPoint pts[4], SkPath::RawIter iter) {
- emscripten::val cmd = emscripten::val::array();
+ JSArray cmd = emscripten::val::array();
switch (verb) {
case SkPath::kMove_Verb:
cmd.call<void>("push", MOVE, pts[0].x(), pts[0].y());