Commit Graph

1030 Commits

Author SHA1 Message Date
Mike Klein
60900b55f9 move skpipe to experimental
Nothing's using it except test tools.
I'd like to make that a bit clearer by getting it out of src.

Disabled the fuzzer.

Removed the bench so Android's building nanobench doesn't block this.

Bug: chromium:886713

Change-Id: I761f52c40171c27ff4b699409b32647e84684ec3
Reviewed-on: https://skia-review.googlesource.com/156240
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-09-21 17:20:25 +00:00
Kevin Lubick
1466af42a4 [canvaskit] Link demos to fiddles
This adds one more skottie example and spruces up
the demos a bit (including making the star only
respond when you hold down the mouse)

No-Try: true
Docs-Preview: https://skia.org/?cl=156141
Bug: skia:
Change-Id: Ib577d6c06bd9784f4566d506150c451beadf1f1c
Reviewed-on: https://skia-review.googlesource.com/156141
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-09-21 16:49:24 +00:00
Kevin Lubick
217056c048 [CanvasKit] Implement some basic Canvas/Surface things.
drawText is having issues in a release build.  Skottie sometimes
asserts in debug mode. This possibly has something to do with
memory alignment - like https://skia-review.googlesource.com/c/skia/+/155980
helped fix.

Patchset 9 shows off integrating Skia drawing to
an HTML canvas using Ganesh.

To see it locally, set up https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html
and then set $EMSDK to be that directory.  Then run

   make clean
   make local-example

and navigate to http://localhost:8000/skia-wasm/example.html

Patchset 20 shows off Skottie animating directly to a Canvas.

Docs-Preview: https://skia.org/?cl=153882
Bug: skia:
Change-Id: I2ad2f4ffac00925ee901982ccbaeb7aa63b1ea23
Reviewed-on: https://skia-review.googlesource.com/153882
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-09-21 12:03:55 +00:00
Kevin Lubick
c7d057103e [PathKit] Move from experimental to modules
Add in Code of Conduct and Contributing.md as well.

Docs-Preview: https://skia.org/?cl=150901
Bug: skia:8216
Change-Id: Ia881124f653617ad0b7b91f40ba21de2c13220a6
Reviewed-on: https://skia-review.googlesource.com/150901
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2018-08-31 14:18:16 +00:00
Cary Clark
5de5233463 remove scaling from pathops
PathOps added a cheat some time ago to reduce
fuzzer bugs by scaling down very large paths,
with the hope that it would make the math more
sane.

This had the side-effect of causing small edges
to disappear altogether if the bounds is large
enough.

Removing the scaling causes a single regression to
one fuzz-generated bug. That path succeeeded with
scale by eliminating the troublesome tiny contour.

Eliminating the scale may fix the CCPR-related bug
discovered by Flutter, or at least uncover the next
bug.

I would expect more fuzzer bugs to appear with
this change; paths with large and small values will
no longer have the small values removed.

R=csmartdalton@google.com,reed@google.com,bsalomon@google.com

Bug: skia:8290
Change-Id: I3bfdb101c568e9cfa324858685eac1f9c368c291
Reviewed-on: https://skia-review.googlesource.com/150465
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-08-30 17:36:05 +00:00
Kevin Lubick
d6719cac91 [PathKit] Make pathops assertion a little more forgiving
Bug: skia:
Change-Id: I5135b8e38e955fe5dbbad8a16bf3f26c98e4e996
Reviewed-on: https://skia-review.googlesource.com/150124
Reviewed-by: Cary Clark <caryclark@google.com>
2018-08-29 13:38:50 +00:00
Kevin Lubick
1fd58fd34f [PathKit] Re-create test expectations
See https://skia-review.googlesource.com/c/skia/+/149620

Bug: skia:
Change-Id: I2a8c88e813b5084f667d08317145866b57bbd7ab
Reviewed-on: https://skia-review.googlesource.com/149681
Reviewed-by: Ravi Mistry <rmistry@google.com>
2018-08-27 19:13:11 +00:00
Kevin Lubick
d993648fa4 [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>
2018-08-24 16:30:00 +00:00
Kevin Lubick
f14a3c059f [PathKit] Add asm.js build and test jobs
Consolidates the karma files into one for docker/asmjs/wasm and all
combinations.

The asm.js build seems to have some small imprecisions that we didn't
see as much as with WASM, probably due to JS limitations/differences
to c++'s floats.

To address these, I've marked some (5) tests in PathOps* as flaky
because they fail on Release, Debug or Test versions of the asm.js build.

Other then that, asm.js seems basically identical to the WASM.

WASM is much smaller, 416k vs 877k and seems to load faster (not
measured).

Note to reviewers:
example.html was copied from npm-wasm version, so doesn't need
further review.

Bug: skia:8216
Change-Id: Ib92b90fa6c598de85a0be319d46b25693ae5aaa4
Reviewed-on: https://skia-review.googlesource.com/148396
Reviewed-by: Stephan Altmueller <stephana@google.com>
2018-08-22 17:19:10 +00:00
Kevin Lubick
c6c48aaf2b [PathKit] Add more correctness tests to gold
Bug: skia:8216
Change-Id: I549f59f165e01ef2e827cf389a5412c123314a90
Reviewed-on: https://skia-review.googlesource.com/147817
Reviewed-by: Stephan Altmueller <stephana@google.com>
2018-08-18 02:05:10 +00:00
Kevin Lubick
c623af2e10 [PathKit] Add conic tests and re-create expectations.
Expectations changed in https://skia-review.googlesource.com/147720

Also apparently I missed a spot when adding conics.

Bug: skia:
Change-Id: I6a9b40ef4518a304bcb575a1ea9be1c900ef18d1
Reviewed-on: https://skia-review.googlesource.com/147816
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-08-17 18:55:47 +00:00
Kevin Lubick
11194ab930 [PathKit] Rework API to avoid extra copies unless explicitly called for.
Breaking Changes:
 - All method calls that mutate a path now return the same JS path
object to allow chaining (moveTo, lineTo, trim, op, simplify, etc).
Pre-existing code likely will need to have some delete() methods
removed because the path will be deleted multiple times. See
chaining.js for this code (basically, we wrote our own binding code
since the default code wasn't quite flexible enough)
 - GetCanvasFillType -> GetFillTypeString (Was in https://skia-review.googlesource.com/c/skia/+/147209)
Since Canvas and SVG use the same strings, it seemed logical to make
them share.
 - stroke() now takes a single object instead of 3 params. This object
currently can have up to 4 params, cap, join, width, miter_limit.
This object can be expanded on in future versions as more configuration
options are added.

As per custom with v0 software, we bump the minor version to 0.2.X
to indicate breaking changes in a pre-release software package.

Other changes of note:
 - Simple tests added for effects (see effects.specs.js) A follow up
CL will handle the Gold (correctness tests)
 - Simple tests added for equals and copy constructors (from https://skia-review.googlesource.com/c/skia/+/147209)
 - Added transform() to allow for arbitrary matrix transforms
 - Added SimpleMatrix as a value_array, which means users can
provide a 9 element array which will be converted to SimpleMatrix
and then SkMatrix on the C++ side.
 - Renamed helpers_externs.js to externs.js and expanded it greatly.
This was necessitated by the code written in chaining.js
 - Fixed a few bugs in previous tests (svg gold test race condition,
uncaught exception in svg reporting)

See also https://skia-review.googlesource.com/c/skia/+/147209 which
allows .moveTo .lineTo, etc to chain on the C++ SkPath.

Bug: skia:8216
Change-Id: I7450cd8b7b5377cf15c962b02d161677b62d7e15
Reviewed-on: https://skia-review.googlesource.com/147115
Reviewed-by: Mike Reed <reed@google.com>
2018-08-17 18:30:32 +00:00
Kevin Lubick
a0ba612bb2 [PathKit] Adding test infrastructure to support Gold output
To get the gold images out of the browser tests, this adds
testReporter.js and pathkit_aggregator.go.  testReporter bundles
up the output as a base64 encoded PNG and sends it over the local
network to pathkit_aggregator.  pathkit_aggregator will keep
a list of test results reported in this way and write the PNGs
to /OUT of the container (which is the swarming output directory).
Finally, after all the tests are run, the helper script "test_pathkit.sh"
makes a POST request that creates the JSON file that gold expects
(following the schema https://github.com/google/skia-buildbot/blob/master/golden/docs/INGESTION.md)

pathkit_aggregator takes many command line arguments which control
the keys that Gold needs in order to ingest and handle the data.
Of note, this creates a new set (i.e. source_type) of gold images
called "pathkit", which will distinguish it from "gm", "image", etc.

There will be at least 2 sub-sets of "pathkit" images, "canvas" and "svg",
(representing the 2 output types of PathKit).  This CL doesn't
quite handle SVG yet, as it needs a way to convert SVG to PNG in the
browser and will be addressed in a follow up CL.

A "standard" gm is sized at 600x600. This was arbitrarily picked.

Note that the functions in testReporter.js return Promises based
on the fetch requests to post the data. This eliminates the race
condition between the /report_gold_data and /dump_json since
running the karma tests won't return until all reports are done.

Other changes of note:
 - Adds go to karma-chrome-tests container.
 - renames recipe_modules/build/wasm.py -> pathkit.py to be consistent with
the name of test_pathkit.py and make for easier grepping.
 - Increases the JS test timeout to 10s (up from 5) to hopefully avoid
the flakes seen in the Debug Test.

Bug: skia:8216
Change-Id: Ic2cad54f3d19cc16601cf2e9a87798db1e6887a2
Reviewed-on: https://skia-review.googlesource.com/147042
Reviewed-by: Stephan Altmueller <stephana@google.com>
2018-08-15 19:25:42 +00:00
Kevin Lubick
084d996d5a [PathKit] Fix bindings to account for SkPath methods returning this
Bug: skia:
Change-Id: I25baf2d5d215cc950da99679649bb3da89dc0681
Reviewed-on: https://skia-review.googlesource.com/147209
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-08-15 17:35:39 +00:00
Kevin Lubick
97d6d98402 [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>
2018-08-10 20:07:47 +00:00
Kevin Lubick
644d8e7175 [PathKit] Add PathOps Op and Simplify tests imported from the C++ tests.
Because of https://skia-review.googlesource.com/c/skia/+/146165 and
https://skia-review.googlesource.com/c/skia/+/146100 we have a way
to turn PathOps tests into JSON, which has input paths (as Cmd arrays),
combination verb and expected output.

In this CL, we make tests from the JSON, compare them to the expected
output and, optionally, create SVGs to visualize the difference if any.

API changes (nothing breaking on release builds):
 - Exposes SkRect as a JS Object.  No need to call delete() on this.
 - expose path.getBounds() and path.computeTightBounds()
 - Remove SkRegion exposure (debug/test only), which was going to be
used for this purpose, but the approach in this CL works fine.
 - Add loadCmdsTypedArray(cmd) helper function to JS [see helper.js].
This was previously known as `floatTypedArrayFrom2D` in the
old shell.html, and is now exposed to avoid clients having to
implement this boilerplate by themselves.
 - Add set/getFillType - mostly for testing the difference between
a Winding and an EvenOdd path.

Bug: skia:8216
Change-Id: I2cd25ce2e1e7f285c79c596678678e62135963f0
Reviewed-on: https://skia-review.googlesource.com/146524
Reviewed-by: Cary Clark <caryclark@google.com>
2018-08-09 18:13:48 +00:00
Kevin Lubick
92c9171125 [Pathkit] Add recipe for running JS tests using Docker
This adds a few JS tests (see *.spec.test) and runs them
using Karma and a Docker image containing Karma, node, and
Chrome (currently at 68).

We only add a Debug Test here because the Release version
has some test helpers (e.g. Region) compiled out.  If those
end up not mattering for tests, we can add in a Release version.


Bug: skia:8216
Change-Id: Ica6ab3a4f21688cfa175a90d42c2254d38e8fcf1
Reviewed-on: https://skia-review.googlesource.com/145723
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
2018-08-09 14:17:28 +00:00
Mike Reed
5edcd31f2c migrating SkTDArray towards std::vector api
fix for https://skia-review.googlesource.com/c/skia/+/146140

Change from original was to include <initializer_list>

Bug: skia:
Change-Id: Ie36426fcf7ce778a95e2b656ce80a9a394a8307c
Reviewed-on: https://skia-review.googlesource.com/146160
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2018-08-08 15:51:44 +00:00
Mike Reed
f9ecb4e67e Revert "migrating SkTDArray towards std::vector api"
This reverts commit 79884be809.

Reason for revert: broke flutter build -- initializer_list?

Original change's description:
> migrating SkTDArray towards std::vector api
> 
> push -> push_back
> add some aliases to match std::vector: count, reserve, ...
> 
> Bug: skia:
> Change-Id: I1921c31d0d6e5ed3d622a0def6054c697be2d02f
> Reviewed-on: https://skia-review.googlesource.com/145884
> Reviewed-by: Mike Klein <mtklein@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=mtklein@google.com,fmalita@chromium.org,reed@google.com

Change-Id: Ib6132b725aaed7c01287e3e8c2b5a14da3d3d7e9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/146140
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-08-08 15:14:37 +00:00
Mike Reed
79884be809 migrating SkTDArray towards std::vector api
push -> push_back
add some aliases to match std::vector: count, reserve, ...

Bug: skia:
Change-Id: I1921c31d0d6e5ed3d622a0def6054c697be2d02f
Reviewed-on: https://skia-review.googlesource.com/145884
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2018-08-08 14:43:28 +00:00
Kevin Lubick
5f0e3a158a [PathKit] Made some APIs return null if things failed
This makes our calls to emscripten::val a bit more consistent.

Adds in the macro SkPathOrVal to self-document where it's really
a SkPath we are returning, but C++ doesn't realize SkPath and
emscripten::val::null() can be the same type.  Casting SkPath
via emscripten::val() is basically a no-op, since Emscripten bind
seems to be doing it under the hood anyway.

No functional changes, except when there would be a failure,
methods will return null instead of an empty SkPath.

Bug: skia:8216
Change-Id: I1fff620d5aa50ec4a57f76e706d8d005ea26605f
Reviewed-on: https://skia-review.googlesource.com/145728
Reviewed-by: Cary Clark <caryclark@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-08-07 16:41:58 +00:00
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
b3d0e3e1d9 Add Debug version of PathKit
This adds a job to build it and adds it to the npm
under /bin/debug.

The debug build is useful for clients because it
has all the debug symbols, which makes it possible to
see which WASM calls are taking the longest when using
DevTools' Performance testing.

Bug: skia:8216
Change-Id: I3068cb395f29c1de927508cf15c419f5af284eb7
Reviewed-on: https://skia-review.googlesource.com/145337
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-08-03 16:54:20 +00:00
Kevin Lubick
30cc00c642 Add job for building PathKit to WASM using Docker
This creates a new named cache docker for this and future
docker-based jobs to use, to avoid permission snafus with
the normal "work" named cache.

Remove old WASM build, which was using the janky CIPD
emsdk asset and wasn't really exercising what we needed.

Bug: skia:8216
Change-Id: I993bba38b4978ca5eebb97e5b5b21729d55a072d
Reviewed-on: https://skia-review.googlesource.com/145140
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
2018-08-03 15:08:42 +00:00
Kevin Lubick
d938887cfe Make flutter roll happy
Bug: skia:8218
Change-Id: Ia536cff2e345626e0e49682b480a0d4742a1cb3e
Reviewed-on: https://skia-review.googlesource.com/145153
Reviewed-by: Ravi Mistry <rmistry@google.com>
2018-08-02 18:22:00 +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
Kevin Lubick
92eaa3cafd Add SkFloat2Bits and Region stub
Bug: skia:
Change-Id: I5ab9a4d42e9eec6563499a09e08ed8b183ac91b2
Reviewed-on: https://skia-review.googlesource.com/141426
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-07-17 18:27:31 +00:00
Florin Malita
e1824da6b5 PathKit/WASM tweaks
The most interesting part is using variadic calls to push all verb data
in one native -> JS go.  This speeds up SkPathToVerbsArgsArray and
SkPathToCmdArray by 30-35%.

Other misc changes:

  * use SkPath::RawIter instead of Iter
  * add a VisitPath helper to cut down on boiler plate
  * use uintptr_t for pointer arguments (just in case we get to wasm64
    some day)

Change-Id: Ia0240f0e00e81db78eb1e9b48b31abbb3e33bfaf
Reviewed-on: https://skia-review.googlesource.com/140984
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-07-12 15:19:28 +00:00
Kevin Lubick
22647d0e84 Adventures with Skia, WASM and a JS API for Pathkit
See shell.html::entrypoint() for the JS side of things.

See wasm_main.cpp for the C++ side of things
(EMSCRIPTEN_BINDINGS at the bottom is what glues the two parts
together - in general the strings are for JS and the not strings
are the C++)

To build this yourself, follow the getting started instructions:
https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html

and download this patch.  Then, update compile.sh to point at your
sdk and run it (e.g. $SKIA_ROOT/experimental/wasm/compile.sh)

Then navigate a browser (e.g. Chrome) to
http://localhost:8000/out/wasm/pathkit.html

So far, can compile with compile.sh, but not really with
GN/ninja (the compilation into many object files and a link
at the end seems to mess emscripten up)


Bug: skia:
Change-Id: If6b300e2b102469e17841265c7866f1a81094d70
Reviewed-on: https://skia-review.googlesource.com/137422
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-07-11 15:38:08 +00:00
Hal Canary
c640d0dc96 Revert "Revert "SkTypes: extract SkTo""
This reverts commit fdcfb8b7c2.

> Original change's description:
> > SkTypes: extract SkTo
> >
> > Change-Id: I8de790d5013db2105ad885fa2683303d7c250b09
> > Reviewed-on: https://skia-review.googlesource.com/133620
> > Reviewed-by: Mike Klein <mtklein@google.com>

Change-Id: Ida74fbc5c21248a724a5edbf9fae18a33bcb23aa
Reviewed-on: https://skia-review.googlesource.com/134506
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2018-06-14 14:55:17 +00:00
Hal Canary
fdcfb8b7c2 Revert "SkTypes: extract SkTo"
This reverts commit 2a2f675926.

Reason for revert: this appears to be what is holding up the Chrome roll.

Original change's description:
> SkTypes: extract SkTo
>
> Change-Id: I8de790d5013db2105ad885fa2683303d7c250b09
> Reviewed-on: https://skia-review.googlesource.com/133620
> Reviewed-by: Mike Klein <mtklein@google.com>

TBR=mtklein@google.com,halcanary@google.com

No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: Iafd738aedfb679a23c061a51afe4b98a8d4cdfae
Reviewed-on: https://skia-review.googlesource.com/134504
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2018-06-13 13:45:47 +00:00
Hal Canary
2a2f675926 SkTypes: extract SkTo
Change-Id: I8de790d5013db2105ad885fa2683303d7c250b09
Reviewed-on: https://skia-review.googlesource.com/133620
Reviewed-by: Mike Klein <mtklein@google.com>
2018-06-12 15:03:21 +00:00
Florin Malita
3d856bdeee [skottie] Relocate to modules/skottie
TBR=
Change-Id: I218d251ca56578a3a7fd4fb86cba9abdc10fb3bd
Reviewed-on: https://skia-review.googlesource.com/130322
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-05-27 02:21:33 +00:00
Florin Malita
3b526b05d6 "Modularize" SkSG
* relocate all SkSG-related files under modules/sksg/
* fix various tidbits to make non-sksg builds possible
* drop obsolete SampleSGInval.cpp

Change-Id: I54e6c5bb1a09f45030fa8d607b3eb3f7cba78957
Reviewed-on: https://skia-review.googlesource.com/130025
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-05-25 17:11:52 +00:00
Florin Malita
c877a404e0 [skottie] SK_API-export public classes
TBR=
Change-Id: I14fcbf0932ff5c6de6fc4b500647f74d55d72266
Reviewed-on: https://skia-review.googlesource.com/129463
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-05-23 21:10:11 +00:00
Florin Malita
3b9effcb1d [skottie] Sanitize polystar point counts
- limit the maximum number of points
- round instead of trunc (more accurate when interpolating)
- reserve the path verb/pts space upfront

Bug: oss-fuzz:8223
Change-Id: Ib6fb83e56c05b16e292789be81f1a48a9c529211
Reviewed-on: https://skia-review.googlesource.com/128017
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-05-14 21:41:39 +00:00
Florin Malita
0cc01b753a [skottie] Guard against asset cycles
Track assets being attached, and break cycles.

Bug: oss-fuzz:8220
Change-Id: I146cf35eba8cfea487c00544fe82f89c3a859803
Reviewed-on: https://skia-review.googlesource.com/127381
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-05-11 02:40:56 +00:00
Florin Malita
2919b610f4 [skottie] Clean up AttachLayerContext
Avoid double "ind" lookups, avoid repeated AttachParentLayerMatrix
calls, hide private functions.

TBR=
Change-Id: I78f11593ffe241de3cdfabf7b3a88e8f4e62aa0c
Reviewed-on: https://skia-review.googlesource.com/127327
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-05-10 17:20:16 +00:00
Florin Malita
0c2bcce996 [skottie] Allow divide-by-zero in PolyStarAdapter::apply
This is safe because count == 0 will produce an empty path.

Bug: oss-fuzz:8213
Change-Id: Ie3b546c614ba22eef1ba16a182016c2edd0bd641
Reviewed-on: https://skia-review.googlesource.com/127323
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-05-10 15:27:45 +00:00
Mike Reed
2d46a00926 allow divide by zero
Bug: oss-fuzz:8214
Change-Id: Ieb2e61b23f88e399df3bfb284742d4604b7d27fa
Reviewed-on: https://skia-review.googlesource.com/127322
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2018-05-10 15:12:15 +00:00
Florin Malita
7ac2e3bfef [skottie] Simplify AttachOpacity
BindProperty can already check for no-op static props, so let's use it.

TBR=

Change-Id: If1c327871702b57ad9e6db9a8b112c6775cb7f53
Reviewed-on: https://skia-review.googlesource.com/127140
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-05-09 19:23:31 +00:00
Florin Malita
20880784fb [skottie] Json cleanup pass
Assorted Json tweaks:

  - more defensive internal object access
  - drop unneeded isObject checks
  - drop unneeded namespace
  - restrict the iterator to arrays

TBR=
Change-Id: I02f1c5d84c429cf5206bc2a0a7843097b92bac94
Reviewed-on: https://skia-review.googlesource.com/126930
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-05-09 16:11:45 +00:00
Florin Malita
9739d7cf2b [skottie] Null value crash in json::ValueRef::toString()
Bug: skia:7935
Change-Id: Ibe99ccbf5b8dcf889a71acf1fb52063001fd7612
Reviewed-on: https://skia-review.googlesource.com/126923
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-05-09 14:42:45 +00:00
Florin Malita
0ca7a88e64 [skottie] More defensive array indexing
Rapidjson's array [] operator asserts the index is valid (instead of
returning a null value when out-of-range) -> we must check.

Bug: skia:7918
Change-Id: Ice4a6e6670a824da0d423da4a6f92414cd0dc252
Reviewed-on: https://skia-review.googlesource.com/126441
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-05-07 15:19:39 +00:00
Florin Malita
fa7e9a813e [skottie] Switch to RapidJSON
- pull latest RapidJSON under third_party/externals/rapidjson
  (note: and older RS version is already pulled as part of angle2,
  and it is also checked in G3)

- add a thin Json porting layer (SkottieJson) to isolate RS
  idiosyncrasies

- convert Skottie to use the new helpers

- parse the DOM in-place (based on local experiments this is the
  fastest method)

Ta-da: Skottie now parses JSON ~10x faster!


Change-Id: Ida9099638f88ed025fee83055c8cd8680ee27176
Reviewed-on: https://skia-review.googlesource.com/125744
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2018-05-04 19:58:13 +00:00
Florin Malita
41dff6ef68 [skottie] Add support for round-corners geometry effects
TBR=
Change-Id: I5505561df28d5953526662d60fe2300cb112bc37
Reviewed-on: https://skia-review.googlesource.com/124769
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-05-01 14:54:14 +00:00
Florin Malita
c353ee211f [skottie] Power-reduce paths (cubicTo -> lineTo)
For straight lines, Lottie exports control points conincident with the
vertices.  We can detect this case and emit more efficient lineTo's.

One wrinkle: we can only apply this power-reduction post-interpolation
(otherwise the path verbs and point count would not be guaranteed to
match).  Hence we store explicit shape data and defer the SkPath
conversion.

TBR=

Change-Id: I7818be464eabee6096d2078440843243a55c6e98
Reviewed-on: https://skia-review.googlesource.com/124800
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-05-01 02:27:34 +00:00
Florin Malita
6eb85a1cf1 [skottie] Show load stats in SkottieSlide
TBR=
Change-Id: Ie3a1036d9a90cb16d2795134c453759aeff06e3c
Reviewed-on: https://skia-review.googlesource.com/124461
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-04-30 15:19:03 +00:00
Florin Malita
0c51c21343 [skottie] Apply opaque masks as clips
When the mask stack contains exactly one opaque mask path, we can apply as
a clip.

TBR=
Change-Id: Iadff7534bfa4925557bfbddd59529113f4958d0d
Reviewed-on: https://skia-review.googlesource.com/124000
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-04-27 15:02:12 +00:00
Florin Malita
cd05b19609 [skottie] Add support for inverse mask paths
TBR=
Change-Id: I442033b2e82777c90ee497d8a5b2310af1d2e631
Reviewed-on: https://skia-review.googlesource.com/123840
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-04-26 02:35:10 +00:00