[PathKit] Add various path effects
API Changes (nothing should be breaking):
- Exposes conic, although all output formats (SVG, Canvas) need conics
to be approximated with quads. Tests have been added to verify this
happens.
- Add .dash(), .trim(), .stroke() and examples for them.
- Expose Stroke enums (StrokeJoin, StrokeCap)
Adds tests for the cubic part and clean up a few spacing things.
There are some changes to the C++ code to simplify the build -
otherwise, I need to appease the linker and add add in a bunch
of files that may or may not get optimized out. Best make them
not even be compiled, just to make sure.
Bug: skia:8216
Change-Id: I1da3aaab1891f14a5b3dc01bb6523b4fd9a87b04
Reviewed-on: https://skia-review.googlesource.com/146650
Reviewed-by: Florin Malita <fmalita@chromium.org>
diff --git a/experimental/pathkit/tests/pathops.spec.js b/experimental/pathkit/tests/pathops.spec.js
index c9a3d54..3a9228e 100644
--- a/experimental/pathkit/tests/pathops.spec.js
+++ b/experimental/pathkit/tests/pathops.spec.js
@@ -77,12 +77,12 @@
var PathKit = null;
var PATHOP_MAP = {};
var FILLTYPE_MAP = {};
- const LoadPathKit = new Promise(function(resolve, reject){
+ const LoadPathKit = new Promise(function(resolve, reject) {
if (PathKit) {
resolve();
} else {
PathKitInit({
- locateFile: (file) => '/base/npm-wasm/bin/test/'+file,
+ locateFile: (file) => '/pathkit/'+file,
}).then((_PathKit) => {
PathKit = _PathKit;
PATHOP_MAP = {
@@ -152,6 +152,9 @@
// Do a tolerant match.
let diff = diffPaths(expected, combined);
if (test.expectMatch === 'yes'){
+ // Check fill type
+ expect(combined.getFillType().value).toEqual(getFillType(test.fillTypeOut).value);
+ // diff should be null if the paths are identical (modulo rounding)
if (diff) {
expect(`[${testName}] ${diff}`).toBe('');
addSVG('[PathOps] ' + testName, expected, combined, diff);
@@ -202,6 +205,9 @@
// Do a tolerant match.
let diff = diffPaths(expected, simplified);
if (test.expectMatch === 'yes'){
+ // Check fill type
+ expect(simplified.getFillType().value).toEqual(getFillType(test.fillTypeOut).value);
+ // diff should be null if the paths are identical (modulo rounding)
if (diff) {
expect(`[${testName}] ${diff}`).toBe('');
addSVG('[Simplify] ' + testName, expected, simplified, diff);
@@ -223,4 +229,4 @@
});
});
});
-});
\ No newline at end of file
+});