Commit Graph

2 Commits

Author SHA1 Message Date
Kevin Lubick
641bf8745d [PathKit] Add more Path2D functionality and move some methods to be members
Adds arc, arcTo, rect and Path2D names for quadTo, cubicTo, close.

Adds conic verb support (approximated with 2 quads).

Breaking changes:
Some functions have been moved to be member functions:
PathKit.Simplify(path) -> path.simplify()
PathKit.ToCanvas(path, ctx) -> path.toCanvas(ctx)
PathKit.ToSVGString(path) -> path.toSVGString()
PathKit.ToPath2D(path) -> path.toPath2D()
PathKit.ToCmds(path) -> path.toCmds()
PathKit.ResolveBuilder(builder) -> builder.resolve()
PathKit.GetBoundaryPathFromRegion(region) -> region.getBoundaryPath()

Pathkit.ApplyPathOp(pathOne, pathTwo, op) still exists, but there's
now also pathOne.op(pathTwo, op) for cases when that's easier.

As per custom with version 0.x.y projects, I'm bumping the
minor version (in npm) for these breaking changes instead of the
major version (which will happen when we are version >= 1.0.0).

This also has some small improvements to the output code size.
The biggest jump was from enabling the closure compiler on the
helper JS, which trimmed it down by about 40%. Using the closure
compiler requires the JRE on the bots, which prompted the emsdk-base
image change.

Bug: skia:8216
Change-Id: I40902d23380093c34d1679df0255bcb0eaa77b01
Reviewed-on: https://skia-review.googlesource.com/145420
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-08-06 19:07:12 +00:00
Kevin Lubick
e1b36fe3e5 Productionize PathKit
- Remove some old API with VerbArgs that we didn't really like.
 - move from experimental/wasm -> experimental/pathkit and rename
wasm_main.cpp to pathkit_wasm_bindings (more descriptive).
 - Make compile.sh nicer to use (with some form of command line args).
 - Use MODULARIZE=1 to make this play nicer with other WASM libraries
and easier to import.
 - Add seperate ToCanvas() API
 - Move Region stuff behind the PATHKIT_TESTING flag (saves 100k on
binary size).
 - Add npm package for wasm version.  asm.js version should also be
supported for older browsers.
 - Remove shell.html, which was largely too complicated. Replace it with
example.html, which is more succinct and demos the more relevant APIs.

See https://www.npmjs.com/package/experimental-pathkit-wasm

Bug: skia:8216
Change-Id: I15f14dd8acd77331729998ae3e30d73e4b006761
Reviewed-on: https://skia-review.googlesource.com/144790
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-08-02 16:31:23 +00:00