[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();
diff --git a/experimental/pathkit/tests/pathops.spec.js b/experimental/pathkit/tests/pathops.spec.js
index 39d879c..273a6a4 100644
--- a/experimental/pathkit/tests/pathops.spec.js
+++ b/experimental/pathkit/tests/pathops.spec.js
@@ -117,11 +117,6 @@
         return e;
     }
 
-    function fromCmds(cmds) {
-        let [ptr, len] = PathKit.loadCmdsTypedArray(cmds);
-        return PathKit.FromCmds(ptr, len);
-    }
-
     it('combines two paths with .op() and matches what we see from C++', function(done) {
         LoadPathKit.then(() => {
             // Test JSON created with:
@@ -135,11 +130,11 @@
                     for (testName of testNames) {
                         let test = json[testName];
 
-                        let path1 = fromCmds(test.p1);
+                        let path1 = PathKit.FromCmds(test.p1);
                         expect(path1).not.toBeNull(`path1 error when loading cmds '${test.p1}'`);
                         path1.setFillType(getFillType(test.fillType1));
 
-                        let path2 = fromCmds(test.p2);
+                        let path2 = PathKit.FromCmds(test.p2);
                         expect(path2).not.toBeNull(`path2 error when loading cmds '${test.p2}'`);
                         path2.setFillType(getFillType(test.fillType2));
 
@@ -149,7 +144,7 @@
                             expect(combined).toBeNull(`Test ${testName} should have not created output, but did`);
                         } else {
                             expect(combined).not.toBeNull();
-                            let expected = fromCmds(test.out);
+                            let expected = PathKit.FromCmds(test.out);
                             // Do a tolerant match.
                             let diff = diffPaths(expected, combined);
                             if (test.expectMatch === 'yes'){
@@ -192,7 +187,7 @@
                     for (testName of testNames) {
                         let test = json[testName];
 
-                        let path = fromCmds(test.path);
+                        let path = PathKit.FromCmds(test.path);
                         expect(path).not.toBeNull(`path1 error when loading cmds '${test.path}'`);
                         path.setFillType(getFillType(test.fillType));
 
@@ -202,7 +197,7 @@
                             expect(simplified).toBeNull(`Test ${testName} should have not created output, but did`);
                         } else {
                             expect(simplified).not.toBeNull();
-                            let expected = fromCmds(test.out);
+                            let expected = PathKit.FromCmds(test.out);
                             // Do a tolerant match.
                             let diff = diffPaths(expected, simplified);
                             if (test.expectMatch === 'yes'){
diff --git a/experimental/pathkit/tests/svg.spec.js b/experimental/pathkit/tests/svg.spec.js
index c28618b..ca3afe2 100644
--- a/experimental/pathkit/tests/svg.spec.js
+++ b/experimental/pathkit/tests/svg.spec.js
@@ -45,8 +45,7 @@
                        [PathKit.LINE_VERB, 5, 295],
                        [PathKit.LINE_VERB, 205, 5],
                        [PathKit.CLOSE_VERB]];
-            let [ptr, len] = PathKit.loadCmdsTypedArray(cmds);
-            let path = PathKit.FromCmds(ptr, len);
+            let path = PathKit.FromCmds(cmds);
 
             let svgStr = path.toSVGString();
             // We output it in terse form, which is different than Wikipedia's version
@@ -64,8 +63,7 @@
                        [PathKit.LINE_VERB, 5, 295],
                        [PathKit.LINE_VERB, "0x15e80300", "0x400004dc"], // 9.37088e-26f, 2.0003f
                        [PathKit.CLOSE_VERB]];
-            let [ptr, len] = PathKit.loadCmdsTypedArray(cmds);
-            let path = PathKit.FromCmds(ptr, len);
+            let path = PathKit.FromCmds(cmds);
 
             let svgStr = path.toSVGString();
             expect(svgStr).toEqual('M9.37088e-26 2.0003L795 5L595 295L5 295L9.37088e-26 2.0003Z');