[PathKit] Write more complete docs and clean up API to be consistent
Breaking Changes (should be minor, as it's mostly just things
for testing):
- PathKit.ApplyPathOp should have returned a new SkPath, but didn't.
It now does and is named "MakeFromOp", which makes the convention of
"Have 'make' in name, needs delete" more consistent.
- PathKit.FromCmds(arr) now only needs to take the JS Array and
will handle the TypedArrays under the hood. If clients want to deal
with TypedArrays themselves, they can use _FromCmds(ptr, len) directly.
- PathKit.MakeLTRBRect is now just PathKit.LTRBRect. The thing
returned is a normal JS Object and doesn't need delete().
As per custom with v0 apps, we are updating the minor version
to v0.3.0 to account for breaking changes.
Docs-Preview: https://skia.org/?cl=147960
Bug: skia:8216
Change-Id: Ia3626e69f3e97698fc62a6aee876af005e29ffca
Reviewed-on: https://skia-review.googlesource.com/147960
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Heather Miller <hcm@google.com>
diff --git a/experimental/pathkit/tests/path.spec.js b/experimental/pathkit/tests/path.spec.js
index e77be63..852435b 100644
--- a/experimental/pathkit/tests/path.spec.js
+++ b/experimental/pathkit/tests/path.spec.js
@@ -112,13 +112,13 @@
LoadPathKit.then(() => {
// Based on test_bounds_crbug_513799
let path = PathKit.NewPath();
- expect(path.getBounds()).toEqual(PathKit.MakeLTRBRect(0, 0, 0, 0));
+ expect(path.getBounds()).toEqual(PathKit.LTRBRect(0, 0, 0, 0));
path.moveTo(-5, -8);
- expect(path.getBounds()).toEqual(PathKit.MakeLTRBRect(-5, -8, -5, -8));
+ expect(path.getBounds()).toEqual(PathKit.LTRBRect(-5, -8, -5, -8));
path.rect(1, 2, 2, 2);
- expect(path.getBounds()).toEqual(PathKit.MakeLTRBRect(-5, -8, 3, 4));
+ expect(path.getBounds()).toEqual(PathKit.LTRBRect(-5, -8, 3, 4));
path.moveTo(1, 2);
- expect(path.getBounds()).toEqual(PathKit.MakeLTRBRect(-5, -8, 3, 4));
+ expect(path.getBounds()).toEqual(PathKit.LTRBRect(-5, -8, 3, 4));
path.delete();
done();
});
@@ -130,9 +130,9 @@
let path = PathKit.NewPath();
path.moveTo(1, 1);
path.quadraticCurveTo(4, 3, 2, 2);
- expect(path.getBounds()).toEqual(PathKit.MakeLTRBRect(1, 1, 4, 3));
+ expect(path.getBounds()).toEqual(PathKit.LTRBRect(1, 1, 4, 3));
ExpectRectsToBeEqual(path.computeTightBounds(),
- PathKit.MakeLTRBRect(1, 1,
+ PathKit.LTRBRect(1, 1,
bits2float("0x40333334"), // 2.8
bits2float("0x40155556"))); // 2.3333333
path.delete();