Commit Graph

1261 Commits

Author SHA1 Message Date
Alexander Khovansky
3e11933765 [canvaskit] Exposed SkPath::arc. Exposed SkEncodedImageFormat enum. Exposed SkImage::encodeToData overload with arguments
These changes expose the arc function for SkPath. The ApplyAddArc function is a copy from the PathKit bindings.

Also exposed the PNG and JPEG formats from the SkEncodedImageFormat enum and the SkImage::encodeToData overload that accepts format and quality options. The direct binding of encodeToData was replaced with a pre-js wrapper that calls the appropriate private overload

We are working on a PostCSS conic gradient polyfill plugin and want to use the CanvasKit to generate it.
Problem is - it lacks the arc function that technically exists but isn't exposed. And it would be really great to have encodeToData with options since generated PNGs are quite large.
More details on the issue can be found here: https://github.com/jonathantneal/postcss-conic-gradient/issues/10

R=kjlubick@google.com

Bug: skia:
Change-Id: I3f1dc88ad308369fe62004080bcc196c4fbbf742
Reviewed-on: https://skia-review.googlesource.com/c/171046
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-11-15 02:52:02 +00:00
Mike Klein
54378230f8 Reland "simplify disabling effect deserialization"
This reverts commit 34d7a163a4.

Reason for revert: ok now?

Original change's description:
> Revert "simplify disabling effect deserialization"
>
> This reverts commit 5bbf790b5b.
>
> Reason for revert: flutter GN needs some love
>
> Original change's description:
> > simplify disabling effect deserialization
> >
> > Switch to a simple #define instead of conditional build targets.
> >
> > No one changes skia_enable_effects or skia_enable_effects_imagefilters,
> > so we can merge all that together back into :skia.
> >
> > Change-Id: I2985f95ee89149ddc687dc31f4c6bf35cb3a93c7
> > Reviewed-on: https://skia-review.googlesource.com/c/169220
> > Reviewed-by: Kevin Lubick <kjlubick@google.com>
> > Commit-Queue: Mike Klein <mtklein@google.com>
>
> TBR=mtklein@google.com,kjlubick@google.com
>
> Change-Id: I3b818418d303dbc6d2a926a19df64a68499f0ec3
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/169222
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

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

Cq-Include-Trybots: skia.primary:Build-Debian9-Clang-arm-Release-Flutter_Android
Change-Id: I534346c3ef3561a871f1af6df976bfee0b48014a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/169640
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-11-08 14:26:52 +00:00
Mike Klein
34d7a163a4 Revert "simplify disabling effect deserialization"
This reverts commit 5bbf790b5b.

Reason for revert: flutter GN needs some love

Original change's description:
> simplify disabling effect deserialization
> 
> Switch to a simple #define instead of conditional build targets.
> 
> No one changes skia_enable_effects or skia_enable_effects_imagefilters,
> so we can merge all that together back into :skia.
> 
> Change-Id: I2985f95ee89149ddc687dc31f4c6bf35cb3a93c7
> Reviewed-on: https://skia-review.googlesource.com/c/169220
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

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

Change-Id: I3b818418d303dbc6d2a926a19df64a68499f0ec3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/169222
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-11-07 18:52:19 +00:00
Mike Klein
5bbf790b5b simplify disabling effect deserialization
Switch to a simple #define instead of conditional build targets.

No one changes skia_enable_effects or skia_enable_effects_imagefilters,
so we can merge all that together back into :skia.

Change-Id: I2985f95ee89149ddc687dc31f4c6bf35cb3a93c7
Reviewed-on: https://skia-review.googlesource.com/c/169220
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-11-07 18:20:23 +00:00
Kevin Lubick
e5a06e7bd3 [canvaskit] Update examples after enum name change
Docs-Preview: https://skia.org/?cl=169186
Bug: skia:
Change-Id: I083a07cc44e1534f4aeedc4e25e8ed786e29f168
Reviewed-on: https://skia-review.googlesource.com/c/169186
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-11-07 15:45:14 +00:00
Kevin Lubick
e71e9ef311 [canvaskit] Add catchException everywhere
This should make the logs in the bots more actionable by showing
the error and trace.

This also fixes the API change causing mysterious red.

Bug: skia:
Change-Id: I38df2bb4557041f8bdfefcae5c8d95b58e770033
Reviewed-on: https://skia-review.googlesource.com/c/168180
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-11-05 13:07:02 +00:00
Kevin Lubick
b5ae3b5afc [canvaskit] Add drawVertices API
This also does some clean up to how we name enums - the caps felt a bit
obnoxious. CAPS are reserved now for constants (like colors).

Small bug fix with leaking memory on discrete path effects

This also adds a few more things from PathKit

Bug: skia:
Change-Id: Iad7e21ac36d35a36a8b255dc82b1dcc886344db1
Reviewed-on: https://skia-review.googlesource.com/c/166804
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2018-11-03 12:18:04 +00:00
Mike Reed
f67b1620aa add pvg experiment
Bug: skia:
Change-Id: I4b7e512e6ee8e4da4ab96924acc034355ae6b8bf
Reviewed-on: https://skia-review.googlesource.com/c/167101
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-11-02 15:35:21 +00:00
Hal Canary
a0a6fe44fc experimental/tools/generate-unicode-test-txt: update
No-Try: true
Change-Id: Ie904a1493570e7f2d50ab2e79c30951610641428
Reviewed-on: https://skia-review.googlesource.com/c/166802
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2018-10-31 17:05:54 +00:00
Kevin Lubick
134be1d9ba [canvaskit] Expose nima animation as POC
Still to come, actually exposing drawVertices, and the
other APIs needed.

Had to re-make all the jsfiddles because of an API change
in a previous CL.

Docs-Preview: https://skia.org/?cl=166444
Bug: skia:
Change-Id: I4d4825f6e7b073d6792ab8d99d5117df860d4815
Reviewed-on: https://skia-review.googlesource.com/c/166444
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-10-30 20:15:28 +00:00
Kevin Lubick
d969932474 Refactor Nima code
There were two copies of a Nima "player" and this moves them out of
samplecode/ and viewer/ to experimental/ where it is a bit more
accessible (e.g. for WebAssembly).

Bug: skia:
Change-Id: I05419a352f0d13d16b462a374578107513eb1243
Reviewed-on: https://skia-review.googlesource.com/c/166441
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-10-30 19:32:52 +00:00
Kevin Lubick
2cf29ce4db [canvaskit] Remove ReadBuffer
Takes about 20kb off uncompressed size, 8kb gzipped.

Also turns off AAA and DAA on CPU builds (already off on GPU)

Bug: skia:
Change-Id: I708038394b61cc8eb7944d5ad1a3bb494db6c719
Reviewed-on: https://skia-review.googlesource.com/c/165100
Reviewed-by: Mike Klein <mtklein@google.com>
2018-10-25 19:17:59 +00:00
Kevin Lubick
006a6f3b14 [canvaskit] Fleshing out the beginnings of a Canvas API
I can probably write most, if not all, of a Canvas API in
JS using the SkCanvas and SkPaint objects. This lets us expose
the fancier API and optionally have a more familiar API.

This is controlled at compile time, i.e. bring in the extra
JS or not.

There is still plenty of the API that needs working, but
this is meant to outlay the plans of where this is going.

Bug: skia:
Change-Id: I2e36a33c24c2bacd52811dc85508dba170ab0dd7
Reviewed-on: https://skia-review.googlesource.com/c/163490
Reviewed-by: Mike Reed <reed@google.com>
2018-10-22 18:02:09 +00:00
Kevin Lubick
9e40e6fa79 Give attribution
Bug: skia:8488
Change-Id: If96c6bb500ceb0bf4b41c9b3aaf10aa9ad301c70
Reviewed-on: https://skia-review.googlesource.com/c/164260
Reviewed-by: Heather Miller <hcm@google.com>
2018-10-22 16:55:34 +00:00
Kevin Lubick
b9d7fb9624 [canvaskit] Disable effect_deserialization
This trims about 260k uncompressed, 88k gzipped

Bug: skia:
Change-Id: I8c51a7929c0cf1387df88fcb77d90ada54c48bcb
Reviewed-on: https://skia-review.googlesource.com/c/163487
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-10-19 14:44:10 +00:00
Kevin Lubick
d04b551b4a [canvaskit] Increase timeout thresholds for perf
Especially on the very first load of the wasm binary,
this has been seen to sometimes timeout.

Bug: skia:
Change-Id: I9321eb1e2f70751a1dbbaee3c1e54d38f5bea450
Reviewed-on: https://skia-review.googlesource.com/c/163247
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-10-18 14:54:33 +00:00
Kevin Lubick
32dfdbe1af [canvaskit] Slice out SkPicture
Removes about 120k uncompressed, 40k gzipped

Bug: skia:
Change-Id: I7e0b404f18fc3c6d4ff6b01d2c9bcd657b7d5e07
Reviewed-on: https://skia-review.googlesource.com/c/163246
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-10-18 14:15:47 +00:00
Kevin Lubick
f2a146c6ad [canvaskit] Add perf jobs
Of note, the perf results reported are not directly
comparable CPU->GPU because the GPU ones are likely
emulated (no real gpu in the Docker container on an
GCE VM).

Bug: skia:
Change-Id: I52259085f4d9e22c45b67f3e8ce1211a5c6c6d3e
Reviewed-on: https://skia-review.googlesource.com/c/163126
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-10-17 19:41:16 +00:00
Kevin Lubick
f20c3493eb [canvaskit] Remove DAA and SAA from gpu build
Bug: skia:
Change-Id: If7f5eaf19fd268613ac883b268b424ca84b9be00
Reviewed-on: https://skia-review.googlesource.com/c/162660
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-10-17 14:11:51 +00:00
Kevin Lubick
5b90b84085 [canvaskit] POC working on Node.js
Basically no hoops to jump through - the same binary
that works in the browser works in Node.

Tested locally with Node 8.9.3.

This aligns the GPU and CPU APIs (that is, makeSurface)
and breaks out the GPU/CPU js interface parts into
their own files. We only need one of them and we know
which at compile time.

Bug: skia:
Change-Id: I6d141387403a792d2374cf904872c6dbc999abfb
Reviewed-on: https://skia-review.googlesource.com/c/162746
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2018-10-17 12:48:24 +00:00
Kevin Lubick
3d99b1e347 Add Correctness tests for CanvasKit
Also make a CPU only and GPU only build (although
the latter still has a lot of CPU logic).

Bug: skia:
Change-Id: I857c2300021c2adb5344865c28e4ad3e8d332954
Reviewed-on: https://skia-review.googlesource.com/c/162022
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-10-16 14:32:28 +00:00
Kevin Lubick
4bf2c26b93 Remove nvpr from CanvasKit
Saves about 20k uncompressed, 7k compressed.

Bug: skia:
Change-Id: I060c58380f3e3266bca9028ba5ba6aa17ce178dc
Reviewed-on: https://skia-review.googlesource.com/c/161942
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-10-15 14:11:29 +00:00
Mike Klein
36528e91c2 clean up SkPipe
One less SkCanvas subclass to deal with...

Change-Id: I21e81648026be5d732e8d9a28baed55015492a04
Reviewed-on: https://skia-review.googlesource.com/c/161584
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-10-12 16:50:21 +00:00
Brian Salomon
d7065e72da Revert "Revert "Add experimental API to draw a set of SkImages in one SkCanvas call.""
This reverts commit 8d5b41b553.

Bug: skia:8444
Change-Id: I29b52c6fe9475c6113ec954b7918cf591111846c
Reviewed-on: https://skia-review.googlesource.com/c/161627
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-10-12 16:09:21 +00:00
Brian Salomon
8d5b41b553 Revert "Add experimental API to draw a set of SkImages in one SkCanvas call."
This reverts commit 0a0304c426.

Reason for revert: Breaking metal

Original change's description:
> Add experimental API to draw a set of SkImages in one SkCanvas call.
> 
> The client provides a src and dst rect for each image as well as
> a bitfield that indicates whether each edge of the image should be
> antialiased. This per-edge AA is useful for tiled compositors.
> 
> Rather than take a full SkPaint this API only takes an alpha, a filter
> quality (which is pinned to kLow), and a blend mode. This is a likely
> point of future evolution.
> 
> Currently the API is only fully implemented for kSrcOver on the GPU
> backend. With other blend modes or on other backends AA will be ignored
> for images that do not have all four edge AA flags set.
> 
> BUG: skia:8444
> 
> Change-Id: I143998dda8ad6a25f64e18cd600392ba553030ac
> Reviewed-on: https://skia-review.googlesource.com/c/159062
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

TBR=mtklein@google.com,bsalomon@google.com,brianosman@google.com,reed@google.com

Change-Id: I815baaeee5de9c6722cf2b9d071a8e2f7c1b6a96
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/161622
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-10-12 14:25:06 +00:00
Brian Salomon
0a0304c426 Add experimental API to draw a set of SkImages in one SkCanvas call.
The client provides a src and dst rect for each image as well as
a bitfield that indicates whether each edge of the image should be
antialiased. This per-edge AA is useful for tiled compositors.

Rather than take a full SkPaint this API only takes an alpha, a filter
quality (which is pinned to kLow), and a blend mode. This is a likely
point of future evolution.

Currently the API is only fully implemented for kSrcOver on the GPU
backend. With other blend modes or on other backends AA will be ignored
for images that do not have all four edge AA flags set.

BUG: skia:8444

Change-Id: I143998dda8ad6a25f64e18cd600392ba553030ac
Reviewed-on: https://skia-review.googlesource.com/c/159062
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-10-12 13:14:24 +00:00
Kevin Lubick
53965c9d68 Add CPU backend for CanvasKit
This also makes the GPU and Skottie portions optional
at build time.

Bug: skia:
Change-Id: I34f494caf0e2ca35dc4767d57f79ba92b24e818f
Reviewed-on: https://skia-review.googlesource.com/c/159146
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-10-11 13:30:27 +00:00
Kevin Lubick
93faa6795b Make CCPR optional
This can reduce code size where CCPR is not supported (e.g. WebGL 1.0)

Drops 130k uncompressed, 50k compressed.

Bug: skia:
Change-Id: I8af7e681e1f3520a18e0c0d55e318dcf88206584
Reviewed-on: https://skia-review.googlesource.com/c/161041
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-10-10 20:20:01 +00:00
Kevin Lubick
e805b243f6 Tweak to compile flags
Bug: skia:
Change-Id: I067fa83e1a07b244bec71ed4f95c144dc7e2edc1
Reviewed-on: https://skia-review.googlesource.com/c/161143
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-10-10 19:10:26 +00:00
Kevin Lubick
8e9750d3c5 Add CanvasKit build
Building CanvasKit uses very similar logic to PathKit, so there
was a fair amount of copy/paste/customize.

Fixes the name of skia.js/wasm -> canvaskit.js/wasm and
adds a package.json to formally track versions.

Also move PathKit helper scripts to align better.

Docs-Preview: https://skia.org/?cl=160463
Bug: skia:
Change-Id: Ie75b30592dcc4d520dca41f6f5579006aaa8849b
Reviewed-on: https://skia-review.googlesource.com/c/160463
Reviewed-by: Eric Boren <borenet@google.com>
2018-10-09 13:56:56 +00:00
Kevin Lubick
d45c7811ef Fix text on CanvasKit
Updates example to use text (and be more mobile friendly).

Also make the compile step a bit nicer and remove SKOTTIE_HACK.

Docs-Preview: https://skia.org/?cl=158664
Bug: skia:
Change-Id: I4c465482058ad7d359729a492e29205c07f3933e
Reviewed-on: https://skia-review.googlesource.com/c/158664
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-10-02 17:58:33 +00:00
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
Kevin Lubick
f7621cb5bb Fix many return-std-move-in-c++11 warnings
Change-Id: Ib0042cf412fe3c5fa600b7ae644d16740457535e
Reviewed-on: https://skia-review.googlesource.com/121354
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-04-16 20:31:50 +00:00
Florin Malita
21d3f9016f [skottie] Harden json string parsing
TBR=
Change-Id: I538d1a86c1adc4a00deffc254c8bfde8d5d6794b
Reviewed-on: https://skia-review.googlesource.com/121324
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-04-13 15:35:42 +00:00
Hal Canary
b5680ca0d8 experimental/tools: minor code cleanup
Change-Id: I4d84dfed284aea9746808bf8a22f45e5bd9c519f
Reviewed-on: https://skia-review.googlesource.com/118597
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2018-04-05 14:16:02 +00:00
Florin Malita
a6e30f75fc [skottie] Clean up SkottieProperties
Split into Adapter and Value CUs.

No real changes, just shuffling things around.

TBR=
Change-Id: I50eaeb3950f4c59e7d7027955b3f49ca2a346e59
Reviewed-on: https://skia-review.googlesource.com/116186
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-03-23 18:09:50 +00:00
Florin Malita
69526b023c [sksg] Simplify TrimEffect
Move the Lottie-specific bits to Skottie and keep TrimEffect as a thin
SkTrimPathEffect wrapper.

TBR=

Change-Id: Iecc6624d01ba61eb96a2056ef8e9e24e731f8979
Reviewed-on: https://skia-review.googlesource.com/115923
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-03-22 16:43:05 +00:00
Heather Miller
72040d9d70 Fix go syntax for Debian compile
Bug: skia:7688
Change-Id: I5b4f9b3aba7d696d09c1c2f0634c8c866e5ba99d
Reviewed-on: https://skia-review.googlesource.com/115077
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Stephan Altmueller <stephana@google.com>
Commit-Queue: Heather Miller <hcm@google.com>
2018-03-19 20:26:46 +00:00
Florin Malita
43398a8a4a [sksg] Use SkTrimPathEffect for path trimming
Refactor TrimEffect using SkTrimPathEffect instead of SkDashPathEffect.

TBR=
Change-Id: I1415b30b58db28cb74b70fb176307634ab0774e8
Reviewed-on: https://skia-review.googlesource.com/114264
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-03-13 23:25:08 +00:00
Hal Canary
2607e3bbc3 scripts to generate [m]skps, documentation
NoTry: true
Change-Id: Ibd5244fa7099cbbe18e5f68e5a28abb52e03127d
Reviewed-on: https://skia-review.googlesource.com/114086
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2018-03-13 15:08:02 +00:00
Florin Malita
5f20fa2923 [skottie] Reduce parser verbosity
TBR=

Change-Id: I2fafa08cd86533526c829dcf3104577ebec6098f
Reviewed-on: https://skia-review.googlesource.com/112940
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-03-07 22:34:20 +00:00
Florin Malita
19f292247e [sksg] Cache transformed TrimEffect geometry
Apply the effect at revalidation time, and cache the result.

TBR=

Change-Id: I166fc0e4e2869bea51e5e45e5a2a50df2f034691
Reviewed-on: https://skia-review.googlesource.com/112801
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-03-07 22:01:20 +00:00
Florin Malita
a016be9499 [skottie] Inverted matte support
TBR=

Change-Id: I761d80d27d9a737710123a183af37135c270b8a7
Reviewed-on: https://skia-review.googlesource.com/112162
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-03-05 20:11:05 +00:00
Florin Malita
1022f74375 [skottie] Nested animation support
Extend composition layers to support referencing external .json
animations ("$"<PATH> syntax).

This is a custom extension (not supported in BM/Lottie).

Also make skottie::Animation ref-counted, to facilitate sharing.

TBR=

Change-Id: I062d031e5868d759f3930dea9b261f9b3ec81684
Reviewed-on: https://skia-review.googlesource.com/109806
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-23 19:15:26 +00:00
Florin Malita
97b3d2bcdb [sksg] Add 'plane' geometry node
SG geometry corresponding to SkCanvas::drawPaint().

TBR=

Change-Id: I3b368adda187fb92f524756496a3694c03a3113d
Reviewed-on: https://skia-review.googlesource.com/108562
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-20 17:08:53 +00:00
Florin Malita
c9649ce7d0 Guard ignored SVG attribute logging with SK_VERBOSE_SVG_PARSING
Change-Id: I01bb8c70dfcd3180aaf620f987b99ae0286cc48c
Reviewed-on: https://skia-review.googlesource.com/108160
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-16 19:13:26 +00:00
Cary Clark
48b56688e8 report ignore attr once only
bots like this one
https://chromium-swarm.appspot.com/task?id=3bb84dda02fc0e10
fill its log with this debug message, so just
write it once

R=fmalita@chromium.org
Bug: skia:
Change-Id: Ia82d89aa23c3a5984080f5d9efdc03ff18b6515e
Reviewed-on: https://skia-review.googlesource.com/108100
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-02-16 18:43:06 +00:00
Jim Van Verth
18c46b553a Delete GLFWTest
Change-Id: Ia303259e0e157d6066428183002748752fad3a7c
Reviewed-on: https://skia-review.googlesource.com/105606
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2018-02-08 22:45:20 +00:00
Florin Malita
796cda11e4 [skottie] FMA-friendlier lerp
TBR=

Change-Id: Id43e463da99bb0478c48ba48a909cead817e4498
Reviewed-on: https://skia-review.googlesource.com/103600
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-05 16:07:46 +00:00
Florin Malita
f8393c8619 [skottie] Split-position support
TBR=

Change-Id: I82433bc9a73f89956c2b25146e1521412d125945
Reviewed-on: https://skia-review.googlesource.com/102622
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-01 17:48:08 +00:00
Florin Malita
21d0e8b0a6 [skottie] Clamp SkCubicMap results to [0,1]
Looks like SkCubicMap can produce slightly out-of-range values.

That's prolly some unimportant precision artifact, but since we're
asserting t is in [0,1] down the line it'd be nice to not crash in debug.

TBR=

Change-Id: I048b691d1c0f0977556d5b25893a6dab2b9986cc
Reviewed-on: https://skia-review.googlesource.com/102480
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-31 22:47:15 +00:00
Florin Malita
51012ce332 [sksg] Initial text support
Use the new node type for SkottieSlide2 labels.

TBR=

Change-Id: Icd6a4faf1c281bd83a2331c0072d1a6ed71acc09
Reviewed-on: https://skia-review.googlesource.com/102441
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-31 22:36:05 +00:00
Florin Malita
aa71c899fd [skottie] Anti-alias masks
TBR=

Change-Id: I16eca80b515fde8ad87a79c01ffd0ea2b3e31259
Reviewed-on: https://skia-review.googlesource.com/101740
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-30 14:47:45 +00:00
Florin Malita
38ea40eb75 [skottie] Layer clip support
TBR=

Change-Id: Ibf65efc69031f8f6e19f4f28cccab29c357e704d
Reviewed-on: https://skia-review.googlesource.com/101540
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-29 21:57:44 +00:00
Florin Malita
eb87d67a83 [skottie] Time start, time stretch
Pre-compositions (only) can have their timelines adjusted via bias and
scale.

TBR=

Change-Id: I519fa1d7cf210f7f152dcabcbe004119a2cf08d9
Reviewed-on: https://skia-review.googlesource.com/101460
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-29 21:12:13 +00:00
Florin Malita
cca86f386c [skottie] Hierarchical animators
Instead of a flat animator space, introduce animator groups.

This allows us to encapsulate layer animators and only dispatch ticks
when their owning layer is active.

TBR=

Change-Id: I1fc8a55abf68a712b71969bb1a11275dbe54c236
Reviewed-on: https://skia-review.googlesource.com/101201
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-29 16:16:21 +00:00
Florin Malita
dd22cf96d3 Revert "[skottie] Cache attached assets"
This reverts commit ba3ed69a4e.

Reason for revert:

Looks like asset references can manipulate the timeline (preComps),
so we do need distinct instances for each ref.

May revisit in the future for cases where all instances share the same timeline.

Original change's description:
> [skottie] Cache attached assets
> 
> This avoids redundant instantiations for assets referenced multiple
> times.
> 
> TBR=
> 
> Change-Id: I8f61f73e695f0d567e55ef077c7d3fb344399f12
> Reviewed-on: https://skia-review.googlesource.com/101002
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Florin Malita <fmalita@chromium.org>

TBR=fmalita@chromium.org

Change-Id: I3e537ace9dfbf69a11f421992db033a0f8ad2aa9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/101220
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-29 15:42:10 +00:00
Florin Malita
5effc281c7 [skottie] Reduce parser verbosity
TBR=

Change-Id: I9a949cfb9e7625b93988d9fc251c8696ae99007a
Reviewed-on: https://skia-review.googlesource.com/101080
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-29 15:00:49 +00:00
Florin Malita
ba3ed69a4e [skottie] Cache attached assets
This avoids redundant instantiations for assets referenced multiple
times.

TBR=

Change-Id: I8f61f73e695f0d567e55ef077c7d3fb344399f12
Reviewed-on: https://skia-review.googlesource.com/101002
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-29 04:59:58 +00:00
Florin Malita
4a49068faf [skottie] Simplify layer matrix caching
Switch to SkTHashMap, unify the cache based on layer index.

TBR=

Change-Id: I7e7622571156d67b4fe5ef91ee9a9a49b089c78f
Reviewed-on: https://skia-review.googlesource.com/101001
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-28 19:47:18 +00:00
Florin Malita
75f4c40588 [skottie] Switch animators to SkTArray
TBR=

Change-Id: I8acc02f176e7dffd344456ad4cc39936e9a9618f
Reviewed-on: https://skia-review.googlesource.com/101000
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-28 17:56:28 +00:00
Florin Malita
1eb98dba2f [skottie] Add 'rz' rotation support
TBR=

Change-Id: I6dd82e5dc516faac091e5173688d2bc977e4fcaa
Reviewed-on: https://skia-review.googlesource.com/100280
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-26 20:34:00 +00:00
Florin Malita
fc807c885b [skottie] Refactor animators
Separate storage for values, cubic maps, repeated values deduplication.

TBR=

Change-Id: Ibfbcea91ef1d7b1da937b4af44079e7612d410cb
Reviewed-on: https://skia-review.googlesource.com/99981
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-26 13:13:24 +00:00
Florin Malita
cf8ed52895 [skottie] Parser cleanup
Consolidate parsing utils into their own CU.

TBR=

Change-Id: Idbf6db5220135ba91df6ebefce3a241c6ec4af15
Reviewed-on: https://skia-review.googlesource.com/99721
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-25 21:23:18 +00:00
Florin Malita
a55a591e5a [skottie] Cache the last keyframe
We can avoid searching on every tick.

TBR=

Change-Id: Ifc3ff40f1f5ec2bf865c09a8e784223aa8a96674
Reviewed-on: https://skia-review.googlesource.com/99580
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-25 00:37:11 +00:00
Florin Malita
2518a0a328 [skottie] Animator scrubbing
Use std::function and lambda closures to capture node type info.

Reduces the template degree.

TBR=

Change-Id: Id81ff3e2e1fca5c8acaaf2d0fc67e608d6f3d606
Reviewed-on: https://skia-review.googlesource.com/99261
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-24 23:53:51 +00:00
Florin Malita
2d5fb12526 [skottie] Clamp keyframe values
We can skip interpolation if |t| is out of range or the interval is
constant ("hold").

TBR=
Change-Id: I0602d36557f46592ab673201ed2b4a96d40dc461
Reviewed-on: https://skia-review.googlesource.com/99420
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-24 19:52:49 +00:00
Florin Malita
7b3415cb10 [skottie] "hold" keyframe support
TBR=

Change-Id: I5388bc5a5d24b3bbe3962b2da646719e95efe858
Reviewed-on: https://skia-review.googlesource.com/99281
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-24 16:37:20 +00:00
Florin Malita
25366fad43 [skottie] Initial mask support
TBR=

Change-Id: Ibf4baeb17f98e1ed359f04deefe2f1c09414540d
Reviewed-on: https://skia-review.googlesource.com/98840
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-23 18:59:20 +00:00
Florin Malita
ca4439f6fd [skottie] Discard orphaned geometry animators
TBR=
NOTRY=true
Change-Id: I8e4de99c8ebc3ec28509753b59a287d896e65aea
Reviewed-on: https://skia-review.googlesource.com/98705
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-01-23 16:22:38 +00:00
Florin Malita
ad335bbfaf [skottie] Improved animation params parsing
Some BM versions wrap the Bezier animation params into arrays.

TBR=
Change-Id: I376b1ed2079105066413b513c3df33a61440cf41
Reviewed-on: https://skia-review.googlesource.com/98580
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-23 04:46:45 +00:00
Florin Malita
055b0f5cb0 [skottie] Improved trim path support
|offset| is an angular value in [0..360].

TBR=
Change-Id: I10a91bec7e8f43db1f54c8b5358dd0604c974998
Reviewed-on: https://skia-review.googlesource.com/98560
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-23 04:42:45 +00:00
Florin Malita
35efaa8fd7 [sksg] Animator, Scene
Relocate some reusable logic from Skottie

TBR=
Change-Id: I8764e666c9f1127ed895ee1d16cd66d052469ac5
Reviewed-on: https://skia-review.googlesource.com/98160
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-22 18:31:17 +00:00
Florin Malita
3ba3fa72ae [sksg] Refactor inval registration
... to avoid having too many Node friends.

TBR=
Change-Id: I8f8ff570d94ea48017935066a3d51cd8265ec120
Reviewed-on: https://skia-review.googlesource.com/97980
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-22 15:50:49 +00:00
Florin Malita
07853659fa [sksg] Improved trim-path emulation
Skip zero-length trims, simplify dashing.

TBR=
Change-Id: I0b30d78a1eeb93131ba0bd915431ab21d05cc00a
Reviewed-on: https://skia-review.googlesource.com/97663
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-21 17:28:11 +00:00
Florin Malita
ee6de4b5fa [skottie] Only apply effects to non-empty geometry stacks
TBR=
Change-Id: Iaafd63c787b72cdf83b21bd39cc10d01612e435d
Reviewed-on: https://skia-review.googlesource.com/97662
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-21 16:46:51 +00:00
Florin Malita
739641580f [sksg] Skip zero-width strokes
Zero-width strokes imply hairline in Skia, but in other models (e.g.
Lottie) they are simply ignored.  The latter approach avoids
discontinuities when width -> 0, so let's make it the default for sksg.

TBR=
Change-Id: I957a873c0e6468e21372115ed18cc7316fd2e7d1
Reviewed-on: https://skia-review.googlesource.com/97661
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-21 16:13:11 +00:00
Florin Malita
16d0ad06b4 [skottie,sksg] Improved shape group semantics
* paints also apply to preceding nested geometries
  * path effects also apply to preceding nested geometries

TBR=
Change-Id: Ic72f8d032fb5823f506ff688630b786a23219f20
Reviewed-on: https://skia-review.googlesource.com/97222
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-19 20:44:56 +00:00
Mike Reed
8008df1080 handle large rects, rename helper
To fix gm/bigrect, needed to do adjust "largest" rect so it doesn't become empty when round-tripping with SkRect/SkIRect.
I renamed it after this.

Bug: skia:
Change-Id: I747782c8456da603cf298275d2300ea1996e7629
Reviewed-on: https://skia-review.googlesource.com/95563
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Yuqian Li <liyuqian@google.com>
2018-01-17 17:38:57 +00:00
Florin Malita
54f65c473f Skotty -> Skottie
Change-Id: If8b6516024c69b0fc256208874f6666a4e70e12c
Reviewed-on: https://skia-review.googlesource.com/95241
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-17 14:15:36 +00:00
Florin Malita
1586d85198 [skotty] Refactor paint opacity
Promote to a PaintNode attribute, drop color composite.

TBR=
Change-Id: Ia79d5f7e193a472d53ac4ff8beb7234d4dc26cef
Reviewed-on: https://skia-review.googlesource.com/94280
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-12 19:48:03 +00:00
Florin Malita
6aaee59c04 [skotty,sksg] Initial gradient support
TBR=
Change-Id: I61e4d46ac14660f4c9ea757be2278e4098131a6b
Reviewed-on: https://skia-review.googlesource.com/94121
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-12 19:20:55 +00:00
Florin Malita
5f9102f291 [skotty,sksg] Initial matte layer support
TBR=
Change-Id: I5b689f5d7b0d147fa200cf5bffe476077085cb19
Reviewed-on: https://skia-review.googlesource.com/93300
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-11 19:32:45 +00:00
Florin Malita
0401e7ed8e [skotty] Adjust Draw node bounds for paint
TBR=

Change-Id: I88b3fe9c0ed4be2244b82d78995d6e27fa022296
Reviewed-on: https://skia-review.googlesource.com/93301
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-11 19:22:35 +00:00
Florin Malita
0e66fbab10 [skotty] Initial solid layer support
TBR=
Change-Id: Ib78ff693a1c79873248563502635aed93a90f963
Reviewed-on: https://skia-review.googlesource.com/92624
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-01-09 23:08:18 +00:00
Florin Malita
dcbb2db6d9 [skotty] Color opacity support
TBR=
Change-Id: I21dd6dda211d17c5de1b815fd43eac713a8e8ccc
Reviewed-on: https://skia-review.googlesource.com/92840
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-09 19:11:27 +00:00
Florin Malita
db38573ca0 [skotty] Pre-initialize animated props
Force an initial tick on animation initialization.

This prevents inconsistent state flashing if the client starts rendering
before the first tick.

TBR=
Change-Id: Iaec3146b4085c980e6501d6a65dd8f2421a2895f
Reviewed-on: https://skia-review.googlesource.com/92740
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-09 18:02:17 +00:00
Florin Malita
f959092453 [skotty] Animator scrubbing
Less boilerplate, less template bloat.

TBR=
Change-Id: Ie0ef4808f4bcd8af9b6cdf89732d214311bc6101
Reviewed-on: https://skia-review.googlesource.com/92701
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-09 17:31:27 +00:00
Florin Malita
a6dd752efa [skotty] Pass animation frame/time as float
No reason to punt through SkMSec, we just lose precision.

TBR=
Change-Id: I2f61e49658701a3b5a675f3dd44543fd9aa98708
Reviewed-on: https://skia-review.googlesource.com/92600
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-09 14:07:22 +00:00
Florin Malita
71cba8f311 [skotty] Layer in/out support
TBR=
Change-Id: I79a9f5f15c051fc2d08bc2d6788ff059ec2d36f0
Reviewed-on: https://skia-review.googlesource.com/92460
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-09 13:29:12 +00:00
Florin Malita
9e1c58cb6a [skotty] Animator cleanup pass
TBR=
Change-Id: I2849c1438a8b245f04a01977919b653f0a16492b
Reviewed-on: https://skia-review.googlesource.com/92380
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-09 00:42:41 +00:00
Florin Malita
c0034179a1 [skotty] Initial opacity support
TBR=

Change-Id: I62581d3a7a83af5ccf373f0f4edf66a2d7f06f07
Reviewed-on: https://skia-review.googlesource.com/92223
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-08 22:36:01 +00:00
Florin Malita
c59b03071f [skotty] Tag animating paths as volatile
Change-Id: Ib90634ef682dba49b99594b008a0615d04c61a49
Reviewed-on: https://skia-review.googlesource.com/92140
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-08 22:06:41 +00:00
Mike Reed
274218ef01 move largest apis into private
Related to https://skia-review.googlesource.com/c/skia/+/91860

Bug: skia:
Change-Id: Ia8fd981b422bbab75541b078277d2e09e1fc9d41
Reviewed-on: https://skia-review.googlesource.com/91940
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-01-08 20:42:27 +00:00
Florin Malita
4932807824 [skotty,sksg] Initial image support
TBR=
Change-Id: Ib3c918b1d746e4f190ae05708681f2d5519afdb2
Reviewed-on: https://skia-review.googlesource.com/91980
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-08 18:11:31 +00:00
Florin Malita
95448a90c1 [skotty] More flexible property parsing
Older Json versions don't tag properties wih an "a" animation marker,
but appear to instead rely on a try-and-see-what-sticks approach.

TBR=
Change-Id: I8a3a7e43576c590aa5ac168891574ceb4811ad49
Reviewed-on: https://skia-review.googlesource.com/91861
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-08 15:44:29 +00:00
Mike Reed
2985987cac add skotty-dir slide
Shows a directory of skotties in a grid

Bug: skia:
Change-Id: I96b0700d8809c94a394cf517222123967afb20dc
Reviewed-on: https://skia-review.googlesource.com/91407
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-01-08 13:44:49 +00:00
Florin Malita
51b8c89b1c [skotty,sksg] Initial trim path effect
TBR=
Change-Id: I5b612c5aade23f727a3622daeff2534f68e6b66a
Reviewed-on: https://skia-review.googlesource.com/91404
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-07 14:30:08 +00:00
Florin Malita
9661b98221 [skotty] De-templatize the Animator apply function
We can use a raw function pointer.

TBR=
Change-Id: I66d19ed563171dc314c862b35c3c98d462337f18
Reviewed-on: https://skia-review.googlesource.com/91461
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-07 13:43:08 +00:00
Florin Malita
721553a34e [skotty] Cubic Bezier lerp
Change-Id: I7eda67fb89c1ef54f4bc1470d10ee5ab797a8b6e
Reviewed-on: https://skia-review.googlesource.com/91445
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-05 19:38:29 +00:00
Florin Malita
c14f144484 [sksg] More inval fixes
Backpedal on node/reval-time-determined damage: nodes cannot control
the invalidation order, and shared descendants may be revalidated before
a particular ancestor gets to query their state - thus making any
decisions based on that invalid.

Instead, apply damage suppression at invalidation time, based on node
type/traits.  Node types which don't generate direct damage are marked
as such, and the invalidation logic bubbles damage past them, until it
finds a valid damage receiver.

Nodes which currently suppress damage:

 - PaintNode    (and subclasses)
 - GeometryNode (and subclasses)
 - Matrix

TBR=
Change-Id: I843e683e64cb6253d8c26d8397c44d02a7d6026f
Reviewed-on: https://skia-review.googlesource.com/91421
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-05 18:08:31 +00:00
Kevin Lubick
4284613cfe Enable conditional-uninitialized flag
Bug: skia:7462
Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-SKNX_NO_SIMD
Change-Id: I1c0a09984bf28a5c620a89af56040f018bae6310
Reviewed-on: https://skia-review.googlesource.com/90941
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
2018-01-05 18:03:25 +00:00
Florin Malita
18eafd922d [skotty, sksg] Add layer transform inheritance support
Split the matrix component of sksg::Transform into its own, free-floating,
chainable node.

Update the composite transform animator to target matrix nodes instead of
transform nodes.

Update the layer transform attachment logic to follow "parent" references,
and build matrix inheritance chains on the fly.

TBR=
Change-Id: I017e5e462274c2cc210730e057b3ea2e7de5c0cb
Reviewed-on: https://skia-review.googlesource.com/90803
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-05 03:29:04 +00:00
Florin Malita
0ebf4192f1 [sksg] More inval fiddling
Node subclasses can now control whether their bounds (changes)
contribute to damage.

Tristate:

  * Default:   The node bounds contribute to damage if the node itself was
               invalidated, observing hasSelfInval().  This is the default
               behavior.

  * ForceSelf: The node bounds contribute to damage, regardless of
               hasSelfInval().  Used for domain-boundary nodes (e.g. Draw),
               which gate blocked fragments (e.g. geometry, paint nodes).

  * BlockSelf: The node bounds do not contribute to damage, regardless of
               hasSelfInval().  Used for nodes which do not contribute
               damage directly (e.g. paints, geometry).

TBR=
Change-Id: I7c941c7ea12e14b008d846ec13108e66e34dbc73
Reviewed-on: https://skia-review.googlesource.com/91104
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-05 00:42:14 +00:00
Florin Malita
d6c4f8f608 [skotty] Add cubic Bezier lerp stubs
... and refactor some of the keyframe parsing.

TBR=
Change-Id: If45922eab36412908036401cee693202f5c3e281
Reviewed-on: https://skia-review.googlesource.com/91100
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-04 21:46:14 +00:00
Florin Malita
02a32b0fa4 [skotty] Add polystar support
TBR=

Change-Id: Ifcf6beb75eaf08a150785b72e322bb30ab84b779
Reviewed-on: https://skia-review.googlesource.com/90902
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-04 17:55:04 +00:00
Florin Malita
fbc13f1434 [skotty] Add ellipse support
TBR=
Change-Id: I48bbc6aabaab1c3ab5cc9fb19c87ad1f5606eb54
Reviewed-on: https://skia-review.googlesource.com/90900
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-04 16:23:14 +00:00
Florin Malita
e6345d90f8 [skotty,sksg] Add support for geometry merge
TBR=
Change-Id: Ia5edbfeae61779ead6031f6dd4e33794b3eefdc0
Reviewed-on: https://skia-review.googlesource.com/90382
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-04 15:22:59 +00:00
Florin Malita
c75e2401a8 [sksg] Refine invalidation logic
We need to discriminate between nodes whose bounds updates contribute to the dirty
region, and nodes whose bounds changes do not.

E.g. animated shape in a group: the animated shape node bounds should yield damage,
but the ancestor group bounds should not.

To accomplish this, we refine the invalidation state:

  1) self invalidation == the node itself was invalidated, and its bounds updates
     yield damage.
  2) descendant invalidation == the node has some (self-)invalidated descendant,
     but its own bounds are not contributing damage.

Also:

  * hoist the bounding box invalidation logic into the base class (Node::revalidate)
    and update to respect the states described above.
  * remove (now-redundant) GeometryNode bbox logic.
  * update revalidation methods to return the node bbox instead of void

TBR=
Change-Id: I8023d1793fb501c945a53f2dc2d2983e5b620ade
Reviewed-on: https://skia-review.googlesource.com/90581
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-04 00:59:20 +00:00
Florin Malita
e8bb6da08d [skotty] Fix native path lerp
SkPath::interpolate() seems to use 'weight' opposite from documentation.

TBR=
Change-Id: I678f7939776bfb21614095df8a2c2dcaa4ecd5f5
Reviewed-on: https://skia-review.googlesource.com/90341
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-02 22:59:01 +00:00
Florin Malita
9e73f885c7 [skotty] Native SkPath interpolation
SkPath supports interpolation, no reason to handle that explicitly in
Skotty.

Change skotty::ShapeValue to convert to SkPaths upfront, when parsing,
and then rely in native interpolation.

TBR=
Change-Id: I32d424ea359e0736909d4e51602ffeb14403feed
Reviewed-on: https://skia-review.googlesource.com/90362
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-02 22:24:31 +00:00
Florin Malita
2a8275b782 [skotty] Improved shape & layer paint order
Closer to what I think the docs are trying to articulate.

Change-Id: I784c4daaf3f6f2c70b2e9636c30a763ab0c711e7
Reviewed-on: https://skia-review.googlesource.com/90242
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-02 18:14:31 +00:00
Florin Malita
2e1d7e2342 [skotty,sksg] Initial RRect support
Bug: skia:
Change-Id: I51bf6619e8d857d5d14fcd6651c144bd3c59453f
Reviewed-on: https://skia-review.googlesource.com/90027
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2018-01-02 15:56:30 +00:00
Florin Malita
fc043dcd55 [skotty] Add Json DM source
Generates a filmstrip with evenly distributed frames for a Skotty animation.

TBR=
Change-Id: Ia89e0d65d59fd5ab4ef221a231e9b3e0c033828a
Reviewed-on: https://skia-review.googlesource.com/90025
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-12-31 18:44:29 +00:00
Florin Malita
dacc02b8dd [skotty] Initial shape transform support
TBR=

Change-Id: I29ce2e6a29492fb0ec51f28f095392594ea6781c
Reviewed-on: https://skia-review.googlesource.com/90024
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-12-31 14:33:09 +00:00
Florin Malita
e8750e1078 [skotty] Fix path close handling
... and add a transform animation sample

TBR=
Change-Id: I27a67d7861dffb9ca22a5e7155ee0eba3b4575f6
Reviewed-on: https://skia-review.googlesource.com/90023
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-12-31 00:07:39 +00:00
Florin Malita
094ccde238 Initial Lottie loader impl (Skotty)
Coarse workflow:

* Construction

  1) build a Json tree
  2) collect asset IDs (for preComp/image layer resolution)
  3) "attach" pass
     - traverse the Json tree
     - build an SkSG dom, one fragment at a time
     - attach "animator" objects to the dom, for each animated prop
  4) done, we can throw away the Json tree

* For each animation tick

  1) iterate over active animators and poke their respective dom nodes/attributes
  2) revalidate the SkSG dom
  3) draw the SkSG dom

Note: post construction, things are super-simple - we just poke SkSG DOM attributes
with interpolated values, and everything else is handled by SkSG (invalidation,
revalidation, render).

Change-Id: I96a02be7eb4fb4cb3831f59bf2b3908ea190c0dd
Reviewed-on: https://skia-review.googlesource.com/89420
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-12-30 22:55:39 +00:00
Florin Malita
80746c2bd2 [sksg] Fix inval rect mapping
Return false from mapRect() doesn't mean the op failed.

TBR=
Change-Id: I0582fde3efaa792010f27e3684cfe9c4332e29dc
Reviewed-on: https://skia-review.googlesource.com/90021
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-12-30 17:57:08 +00:00
Florin Malita
fa8d49adfa [sksg] Refactor stroke logic
Instead of a specialized node, hoist attributes to base class.

TBR=
Change-Id: I4fa5a24dfc899307a8603577738972ebd32f57f5
Reviewed-on: https://skia-review.googlesource.com/89903
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-12-29 17:12:11 +00:00
Florin Malita
2a2dfcbb42 [sksg] Fix paint inval
Paint nodes contribute to invalidation.  Hoist the inval logic from
geometry nodes to draw nodes.

TBR=
Change-Id: Iab33086c377ef4940a84dae3cdccb2c9bdbee99c
Reviewed-on: https://skia-review.googlesource.com/89901
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-12-29 00:41:00 +00:00
Florin Malita
f91d57b585 [sksg] Initial stroke wrapper support
TBR=

Change-Id: I33e2fe076334de34c4427e7bfe6b6aaa724130b2
Reviewed-on: https://skia-review.googlesource.com/89641
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-12-27 22:12:06 +00:00
Florin Malita
047ae27431 [sksg] Initial Path support
TBR=

Change-Id: I594634d339b5e1ad9181dc5303af1a1c754d0fe3
Reviewed-on: https://skia-review.googlesource.com/89540
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-12-27 16:32:15 +00:00
Florin Malita
4aa4441186 Initial scene graph (SkSG)
Sketching a thin (as in close-to-skia-semantics) scene graph API, focused on
external animation, inval tracking and minimal repaint.

Only a few concrete classes/features so far:

* Rect/Color/Transform/Group
* basic inval tracking
* a trivial animated sample with inval visualization

Pretty much everything (especially naming) is volatile, so treat accordingly.

The interesting bits to review are likely in Node.{h,cpp} for inval and
SampleSGInval.cpp for usage.

Initial class hierarchy:

  * Node: invalidation/ancestors tracking
  |
   -- * RenderNode: onRender(SkCanvas)
  |   |
  |    -- * Draw (concrete): rendering a [geometry, paint] tuple
  |   |
  |    -- * Group (concrete): grouping multiple RenderNodes
  |   |
  |    -- * EffectNode: single-descendant effect wrapper
  |       |
  |        -- * Transform (concrete): transform effect
  |
   -- * PaintNode: onMakePaint()
  |   |
  |    -- * Color (concrete): SkColor paint wrapper
  |
   -- * GeometryNode: onComputeBounds(), onDraw(SkCanvas, SkPaint)
      |
       -- * Rect (concrete): SkRect wrapper

TBR=

Change-Id: Iacf9b773c181a7582ecd31ee968562f179d1aa1b
Reviewed-on: https://skia-review.googlesource.com/85502
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-12-21 20:56:32 +00:00
Greg Daniel
faa095e984 Update SkSurface MakeFromBackend* factories to take an SkColorType.
Bug: skia:
Change-Id: Ib1b03b1181ec937843eac2e8d8cb03ebe53e32c1
Reviewed-on: https://skia-review.googlesource.com/86760
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-12-19 18:41:36 +00:00
Hal Canary
d2ded55168 experimental/tools/gerrit-change-id-to-number
Change-Id: I10a46d2d9c8a710f6816f697e48366366078e4f0
Reviewed-on: https://skia-review.googlesource.com/86640
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2017-12-18 17:21:42 +00:00
Hal Canary
c465d13e6f resources: orgainize directory.
Should make it easier to ask just for images.

Change-Id: If821743dc924c4bfbc6b2b2d29b14affde7b3afd
Reviewed-on: https://skia-review.googlesource.com/82684
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2017-12-08 17:16:00 +00:00
Brian Osman
4f99e58252 Remove a huge pile of views code
All of this is dead when not using the old SkWindow framework.

TBR=reed@google.com

Bug: skia:
Change-Id: I0f6ab18987a98469bfd367d5bc10967300dfd3ca
Reviewed-on: https://skia-review.googlesource.com/75384
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-11-22 18:59:44 +00:00
Brian Osman
eff04b5ec2 Remove SampleApp and convert HelloWorld to sk_app
There is still a large amount of views code that could be trimmed down,
but which is used to implement samples (in viewer). Seemed simpler to
remove some of this code in pieces.

Bug: skia:
Change-Id: Ia3415060d03c8de604a154e3dc38379b754daab6
Reviewed-on: https://skia-review.googlesource.com/72801
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-11-21 18:37:19 +00:00
Brian Osman
9e021d2441 Remove SkV8Example
Bug: skia:
Change-Id: I411787ae3ef7185e2909a683537799e51096fd62
Reviewed-on: https://skia-review.googlesource.com/74201
Reviewed-by: Greg Daniel <egdaniel@google.com>
2017-11-21 16:46:32 +00:00
Brian Osman
0860458333 Remove expectations kruft from experimental
Bug: skia:
Change-Id: I8a35b4ce4463534d733d698ae1478de027e0e5f5
Reviewed-on: https://skia-review.googlesource.com/74143
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Stephan Altmueller <stephana@google.com>
2017-11-21 16:21:45 +00:00
Brian Osman
a7dfe41225 Remove more iOS sample code
I think this is generally obsoleted by sk_app?

Bug: skia:
Change-Id: Ie8e9dd1f11f2d2f97f0a21a7e79b37755e75cd44
Reviewed-on: https://skia-review.googlesource.com/74161
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-11-21 16:09:49 +00:00
Brian Osman
11adf3200d Remove clutter from experimental
SkMatrix has the canonical version of setPolyToPoly, we don't need three
other copies sitting around.

SkBorder appears to be useless.

Bug: skia:
Change-Id: Ie747ff7af6cf1d03e6276e8d7fe57e9b3e4ad411
Reviewed-on: https://skia-review.googlesource.com/74141
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-11-21 15:44:19 +00:00
Hal Canary
c60dea17d8 style nit: s/RIGHT SINGLE QUOTATION MARK/APOSTROPHE/g when apropriate
Change-Id: If834febee09266cad6a7a2fb64b06adc25790e33
Reviewed-on: https://skia-review.googlesource.com/73742
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2017-11-20 19:09:18 +00:00
Andreas Haas
ae99d29f6b [v8-platform] Store the platform in a unique_ptr
We want to change the signature of {CreateDefaultPlatform} in the V8
API to return a unique_ptr instead of a raw pointer to indicate that the
caller owns the platform. With this change we prepare pdfium for this
change.

R=egdaniel@google.com

Change-Id: Ib0bb743ca0acd98018cb28828890868f1e0fc612
Reviewed-on: https://skia-review.googlesource.com/69320
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2017-11-09 17:19:14 +00:00
Hal Canary
7a3e989de2 experimental/documentation/gerrit: authentication
NOTRY=true
Change-Id: I8d4f86848dcc37bcc0aead3700969ea4df6417db
Reviewed-on: https://skia-review.googlesource.com/59762
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2017-10-17 12:53:02 +00:00
Florin Malita
e1dadd74f8 [SVGDom] Add 'stroke-dashoffset' support
https://www.w3.org/TR/SVG/painting.html#StrokeDashoffsetProperty
Change-Id: Ia25d0048a56ac3835cabcb4e1794d91667367d7c
Reviewed-on: https://skia-review.googlesource.com/59820
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-10-13 22:53:32 +00:00
Florin Malita
f543a60ef0 [SVGDom] Add 'stroke-dasharray' support
https://www.w3.org/TR/SVG/painting.html#StrokeDasharrayProperty
Change-Id: I9a63ebbd958d661c865ed405570b86cca68f63bf
Reviewed-on: https://skia-review.googlesource.com/59700
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-10-13 19:14:39 +00:00
Florin Malita
ffe6ae49e4 [SVGDom] Add 'visibility' support
https://www.w3.org/TR/SVG/painting.html#VisibilityProperty

Change-Id: I8b872af26150d93cf39cf8eeba23c91e1decace3
Reviewed-on: https://skia-review.googlesource.com/58863
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-10-12 17:06:34 +00:00
Florin Malita
1aa1bb65fd [SVGDom] Initial <pattern> support
https://www.w3.org/TR/SVG/pservers.html#Patterns

Change-Id: I80455c4ae04cf03526f8e8797f40b0b2d24e043f
Reviewed-on: https://skia-review.googlesource.com/58461
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-10-11 18:56:38 +00:00
Florin Malita
b36be14c25 [SVGDom] Avoid some unneeded canvas save()s
The canvas only needs to be saved once, per local SkSVGRenderContext.

Add a helper (saveOnce) to implement this optimization.

Change-Id: I0c21fa78ad9fd5d3d11de0a29f8441620488d676
Reviewed-on: https://skia-review.googlesource.com/58340
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-10-11 18:32:37 +00:00
Florin Malita
6a69c053ff [SVGDom] Initial <use> support
https://www.w3.org/TR/SVG/struct.html#UseElement

Change-Id: Id85c2648255dcd4763bf11c7bdb8b1490286f1e4
Reviewed-on: https://skia-review.googlesource.com/58260
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-10-11 18:21:37 +00:00
Florin Malita
98395d00d2 [SVGDom] Fix SkSVGTransformableNode::mapToParent()
The method is used for clip path resolution, and is supposed to transform the path
into parent node coords -- so it should use the forward matrix, not the inverse.

Change-Id: Id6eb9fbaf024b083e19f56eddb1c293becea48fc
Reviewed-on: https://skia-review.googlesource.com/58280
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-10-11 16:48:57 +00:00
Florin Malita
57a0edf7ba [SVGDom] Add clip-rule support
Currently we use 'fill-rule' when emitting clip paths.  This is wrong:
per spec [1], clip paths observe 'clip-rule', not 'fill-rule'.

[1] https://www.w3.org/TR/SVG/masking.html#ClipRuleProperty

Change-Id: Idf81de05e9601663c8dbc9856900ffa679daf4a5
Reviewed-on: https://skia-review.googlesource.com/57661
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Stephan Altmueller <stephana@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-10-10 19:23:23 +00:00
Florin Malita
4de426b242 [SVGDom] stroke-miterlimit support
https://www.w3.org/TR/SVG/painting.html#StrokeMiterlimitProperty
Change-Id: I5e488e95afe17c4b753e8177ea5783d4820e3d2c
Reviewed-on: https://skia-review.googlesource.com/57221
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-10-10 16:20:43 +00:00
Florin Malita
f6143ffa3a [SVGDom] Add support for <a> elements
https://www.w3.org/TR/SVG/linking.html#AElement

The Skia SVG DOM is not a user agent, so link semantics are not
particularly interesting.  But since <a> can wrap actual content, it is
important to not drop it on the floor.

The simplest thing to do is turn it into a <g> node and run with it.

Change-Id: I4e103553354746ceb49bc1038680a1c477a1320a
Reviewed-on: https://skia-review.googlesource.com/57620
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-10-10 15:03:42 +00:00
Florin Malita
532a091626 [SVGDom] Fix href handling for radial gradients
Currently, the href logic only visits linear gradient nodes.  Update to
also visit radial gradients, per
https://www.w3.org/TR/SVG/pservers.html#RadialGradientElementHrefAttribute.
Change-Id: I8d33d9faa65dae776c13e134c497acccfb428abb
Reviewed-on: https://skia-review.googlesource.com/57480
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-10-10 11:39:32 +00:00
Ben Wagner
63fd760a37 Remove trailing whitespace.
Also adds a presubmit to prevent adding trailing whitespace to source
code in the future.

Change-Id: I41a4df81487f6f00aa19b188f0cac6a3377efde6
Reviewed-on: https://skia-review.googlesource.com/57380
Reviewed-by: Ravi Mistry <rmistry@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2017-10-09 21:20:34 +00:00
Florin Malita
cc6cc2963b [SVGDom] Radial gradient support
Implement support for
https://www.w3.org/TR/SVG/pservers.html#RadialGradients.

BUG=skia:7074

Change-Id: I19645a4a3bbddfd1ee0d08a2775381a0017acbfc
Reviewed-on: https://skia-review.googlesource.com/57340
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-10-09 20:26:54 +00:00
Florin Malita
df007e1a7a [SVGDom] Factor out common gradient logic
In preparation of radial gradient support, move common logic into an
abstract base class (SkSVGGradient).

Change-Id: Ie5361048ca8fddd9070c573c8daef0d0f57dc95e
Reviewed-on: https://skia-review.googlesource.com/57108
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-10-09 19:36:44 +00:00
Florin Malita
ebca0ddac0 Fix SkSVGDOM length & presentation context scoping
TBR=
BUG=skia:7033

Change-Id: I07584acc35253acfd6ca2c3c91c615bb507f7601
Reviewed-on: https://skia-review.googlesource.com/44620
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-09-09 14:06:28 +00:00
Brian Salomon
f43d0001e4 Revert "Revert "Revert "Revert "Remove GrBackendRenderTargetDesc in favor of GrBackendRenderTarget.""""
This reverts commit 6df4d6be0d.

Reason for revert: Google3 fix landed

Original change's description:
> Revert "Revert "Revert "Remove GrBackendRenderTargetDesc in favor of GrBackendRenderTarget."""
> 
> This reverts commit 71554bc256.
> 
> Reason for revert: Google3
> 
> Original change's description:
> > Revert "Revert "Remove GrBackendRenderTargetDesc in favor of GrBackendRenderTarget.""
> > 
> > This reverts commit 807371c15b.
> > 
> > Docs-Preview: https://skia.org/?cl=40260
> > Change-Id: I28e0434c455155ff39a5aaa4141abdf442474e87
> > Reviewed-on: https://skia-review.googlesource.com/40260
> > Reviewed-by: Greg Daniel <egdaniel@google.com>
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
> 
> TBR=egdaniel@google.com,bsalomon@google.com
> 
> Change-Id: Ifdfa896a70db69935473276d12dce54de5c6b6f7
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/41500
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=egdaniel@google.com,bsalomon@google.com

Change-Id: I827419bb19972c3644929a8c984bb9534baab0ba
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/41700
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-08-31 20:04:12 +00:00
Brian Salomon
6df4d6be0d Revert "Revert "Revert "Remove GrBackendRenderTargetDesc in favor of GrBackendRenderTarget."""
This reverts commit 71554bc256.

Reason for revert: Google3

Original change's description:
> Revert "Revert "Remove GrBackendRenderTargetDesc in favor of GrBackendRenderTarget.""
> 
> This reverts commit 807371c15b.
> 
> Docs-Preview: https://skia.org/?cl=40260
> Change-Id: I28e0434c455155ff39a5aaa4141abdf442474e87
> Reviewed-on: https://skia-review.googlesource.com/40260
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=egdaniel@google.com,bsalomon@google.com

Change-Id: Ifdfa896a70db69935473276d12dce54de5c6b6f7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/41500
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-08-31 15:57:42 +00:00
Brian Salomon
71554bc256 Revert "Revert "Remove GrBackendRenderTargetDesc in favor of GrBackendRenderTarget.""
This reverts commit 807371c15b.

Docs-Preview: https://skia.org/?cl=40260
Change-Id: I28e0434c455155ff39a5aaa4141abdf442474e87
Reviewed-on: https://skia-review.googlesource.com/40260
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-08-30 17:59:46 +00:00
Greg Daniel
02611d9afd Add Make[backend] calls for creating GrContexts
Docs-Preview: https://skia.org/?cl=26369
Bug: skia:
Change-Id: I460ee63e466f85b05918479f068a2e5ca2d70550
Reviewed-on: https://skia-review.googlesource.com/26369
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-07-25 14:33:03 +00:00
Brian Salomon
807371c15b Revert "Remove GrBackendRenderTargetDesc in favor of GrBackendRenderTarget."
This reverts commit e2d37c2a07.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Remove GrBackendRenderTargetDesc in favor of GrBackendRenderTarget.
> 
> Also removes a reference to GrBackendTextureDesc in a comment and updates markdown docs.
> 
> Docs-Preview: https://skia.org/?cl=24861
> Bug: skia:
> Change-Id: Ic6490d5ef46953450e6dee69271397bb2b94d0d6
> Reviewed-on: https://skia-review.googlesource.com/24861
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com

Change-Id: I4b85b529727f0bf5aec21d87e725a8195666e2e5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/25182
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-07-20 20:48:23 +00:00
Brian Salomon
e2d37c2a07 Remove GrBackendRenderTargetDesc in favor of GrBackendRenderTarget.
Also removes a reference to GrBackendTextureDesc in a comment and updates markdown docs.

Docs-Preview: https://skia.org/?cl=24861
Bug: skia:
Change-Id: Ic6490d5ef46953450e6dee69271397bb2b94d0d6
Reviewed-on: https://skia-review.googlesource.com/24861
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-07-20 20:28:57 +00:00
Hal Canary
54dac1f359 experimental/documentation/gerrit.md: fix error
NOTRY=true
Change-Id: I40762016f28cd5814c79e4159fa4f73d585f6545
Reviewed-on: https://skia-review.googlesource.com/21377
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2017-07-04 17:23:04 +00:00
Hal Canary
f642cb337a experimental/documentation/gerrit.md: check for error case
NOTRY=true
Change-Id: I0eebe482111efa90dc2fb9d106bdacaf689a38d3
Reviewed-on: https://skia-review.googlesource.com/21371
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2017-07-02 16:46:20 +00:00
Robert Phillips
646e4293f0 Retract GrTexture*.h & GrRenderTarget*.h from other headers
This does push some additional work (& includes) into the .cpp files.

Change-Id: I27c847e371802270d13594dcc22aae44039990bb
Reviewed-on: https://skia-review.googlesource.com/19660
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-06-13 17:21:41 +00:00
Mike Reed
f2ae2b2dbc move perlinenoise2 into effects
Bug: skia:
Change-Id: I5c178bdc5901d15c6924b3fb1f29119ab3cc701d
Reviewed-on: https://skia-review.googlesource.com/18131
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2017-05-30 20:15:37 +00:00
Florin Malita
4aed13889b Reland of SkShaderBase
Introduce a private base class (SkShaderBase), to hide
implementation details from the public interface (SkShader).

Change-Id: Ib1d76cde880bd51868b97408710f8bb38128e536
Reviewed-on: https://skia-review.googlesource.com/17925
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-05-25 14:59:07 +00:00
Florin Malita
d93e11ceb4 Revert "SkShaderBase"
This reverts commit 58a756435c.

Reason for revert: g3, Android borkage.

Original change's description:
> SkShaderBase
> 
> Introduce a private base class (SkShaderBase), to hide
> implementation details from the public interface (SkShader).
> 
> Change-Id: If3ec26ca6abc9da20e3f139c11fdc023bdd85176
> Reviewed-on: https://skia-review.googlesource.com/17241
> Commit-Queue: Florin Malita <fmalita@chromium.org>
> Reviewed-by: Mike Reed <reed@google.com>
> 

TBR=mtklein@google.com,fmalita@chromium.org,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: I32b012ee466dd006c074593f211f43ed602f1078
Reviewed-on: https://skia-review.googlesource.com/17845
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-05-24 21:15:57 +00:00
Florin Malita
58a756435c SkShaderBase
Introduce a private base class (SkShaderBase), to hide
implementation details from the public interface (SkShader).

Change-Id: If3ec26ca6abc9da20e3f139c11fdc023bdd85176
Reviewed-on: https://skia-review.googlesource.com/17241
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2017-05-24 19:56:15 +00:00
Hal Canary
23e474cb73 SkCanvas: Helpers for draw{Point,Line,Circle}
Change-Id: Ie9c7d3b8f01aee435563b23b7d27f098f07dd287
Reviewed-on: https://skia-review.googlesource.com/16909
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2017-05-16 12:59:11 +00:00
Hal Canary
cbd0f3b4e3 experimental/documentation/gerrit.md: more tricks
NOTRY=true
Change-Id: I04d371b16f7805b4c972010a5bc1eebd979169a6
Reviewed-on: https://skia-review.googlesource.com/16915
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2017-05-15 20:21:36 +00:00
Stephan Altmueller
efa48d599d Experimental Go bindings for Skia
This CL implements Go bindings for a subset of the functions in the C API. 
It implements a Go version of the C demo program in 
experimental/c-api-example/skia-c-example.c and the output is identical. 
(Checked by hand). 

The main purpose is to establish a pattern of calling the Skia C API that 
is memory safe and provides a idiomatic Go interface to Skia. 

Follow up CLs will cover the entire C API, add documentation and establish 
a pattern to distribute the bindings more easily.

BUG=
Change-Id: I96ff7c3715164c533202ce300ab0312b1b07f884

Change-Id: I96ff7c3715164c533202ce300ab0312b1b07f884
Reviewed-on: https://skia-review.googlesource.com/10032
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Stephan Altmueller <stephana@google.com>
2017-05-10 15:32:19 +00:00
Brian Salomon
ab015efc48 Move the ability to access textures, buffers, and image storages out from GrProcessor.
GrXferProcessor can no longer use this functionality so it is moved to a new intermediate class inherited by GrFragmentProcessor and GrPrimitiveProcessor.

Change-Id: I4f30c89bdceb2d77b602bf0646107e0780881c26
Reviewed-on: https://skia-review.googlesource.com/11202
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-04-04 15:27:44 +00:00
Herb Derby
b549cc38c8 Change SkMemory to the more accurately named SkMalloc.
Change-Id: I6b08a74234b99bac866bad71014b94f7ec2d4bc8
Reviewed-on: https://skia-review.googlesource.com/10188
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-03-27 18:13:07 +00:00
Brian Salomon
d3b65972aa Mark overridden destructors with 'override' and remove 'virtual'
This silences a new warning in clang 5.0

Change-Id: Ieb5b75a6ffed60107c3fd16075d2ecfd515b55e8
Reviewed-on: https://skia-review.googlesource.com/10006
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
2017-03-22 16:06:18 +00:00
Robert Phillips
bbd7a3be40 Make experimental Perlin noise shader take texture proxies
This is split out of: https://skia-review.googlesource.com/c/8823/ (Remove GrFragmentProcessor-derived class' GrTexture-based ctors)

Change-Id: I18c444981f5c72e9688866e045c90844bc4945b1
Reviewed-on: https://skia-review.googlesource.com/9917
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-03-21 19:38:55 +00:00
Herb Derby
d7b34a5ca0 Make SkMemory.h and adjust all files for usage.
This will be rolled out in three stages:
1) make SkMemory.h and have SkTypes.h include it.
2) Adjust chromium and android.
3) no long include SkMemory.h in SkTypes.h

Change-Id: If360ef5e1164d88f50b03f279e2e963ca2f57d5d
Reviewed-on: https://skia-review.googlesource.com/9874
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2017-03-20 18:40:49 +00:00
Robert Phillips
26c90e0479 Add GrRenderTargetContext::resourceProvider & GrResourceProvider::caps
and retract GrSurfaceContextPriv a bit

Change-Id: Id47af1052f9bda4fe7c85b3ce46b3ebe37797524
Reviewed-on: https://skia-review.googlesource.com/9647
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-03-14 21:23:44 +00:00
Brian Osman
3b65598bce Make SkGr.h private and remove unused functions
BUG=skia:

Change-Id: I6699d00c5412ed9d9bf14b032a08b06b1c766bce
Reviewed-on: https://skia-review.googlesource.com/9398
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-03-08 20:55:21 +00:00
Brian Osman
32342f032e Rebase and fix chromium
Combine texture provider and resource provider

Largely mechanical. Only three places that were calling createApprox
via texture provider (ie without flags), so that was simple.

BUG=skia:

Change-Id: I876367bcdc6a8db736deedab1028de1972015509
Reviewed-on: https://skia-review.googlesource.com/9176
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-03-04 13:49:47 +00:00
Robert Phillips
6f9f7ebb74 Expand use of GrMakeCachedBitmapProxy (take 2)
Reland of https://skia-review.googlesource.com/c/8666/ (Expand use of GrMakeCachedBitmapProxy) with a fix for the non-GPU build

Change-Id: I91d1658139b895b94e04d3f486e56b76bc6d184a
Reviewed-on: https://skia-review.googlesource.com/8700
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-02-18 20:55:51 +00:00
Robert Phillips
eae7524c59 Revert "Expand use of GrMakeCachedBitmapProxy"
This reverts commit 561d1f8153.

Reason for revert: ios-device-xcode-clang

Original change's description:
> Expand use of GrMakeCachedBitmapProxy
> 
> Change-Id: Ic276b9d772763dc16ac6b15a0896578d2d02e06e
> Reviewed-on: https://skia-review.googlesource.com/8666
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> 

TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: I5349cfea983cb65c11b5c250e674a841b9691c40
Reviewed-on: https://skia-review.googlesource.com/8677
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-02-17 20:19:04 +00:00
Robert Phillips
561d1f8153 Expand use of GrMakeCachedBitmapProxy
Change-Id: Ic276b9d772763dc16ac6b15a0896578d2d02e06e
Reviewed-on: https://skia-review.googlesource.com/8666
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-02-17 19:15:51 +00:00
Mike Reed
df85c38163 stop using SkScalarMul
BUG=skia:

Change-Id: Ie41d8665a1c62ba8eddc93d8cfefaf64ddc52ff8
Reviewed-on: https://skia-review.googlesource.com/8411
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-02-14 19:45:24 +00:00
Brian Salomon
cb30bb2cb7 Remove GrFragmentProcessor::computeInvariantOutput
Change-Id: If475730103052c6097eb91be06808fb723b70bf8
Reviewed-on: https://skia-review.googlesource.com/8330
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-02-13 15:32:00 +00:00
Herb Derby
83e939bcb7 Use SkArenaAlloc in the SkAutoBlitterChoose code.
- Added default implementation of onMakeContext to support use in android.

Searches for uses:
"public SkShader"  package:^chromium$ -file:^src/third_party/skia
package:^aosp.* "public SkShader"  -file:external/skia -file:.*third_party/skia
package:^android$ "public SkShader"  -file:external/skia -file:.*third_party/skia

... shows that no subclass overrides onCreateContext.

TBR=reed@google.com
TBR=mtklein@google.com

Change-Id: I8bd5f57a79534574e344b165d31dccee41c31767
Reviewed-on: https://skia-review.googlesource.com/8140
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2017-02-07 20:01:20 +00:00
Robert Phillips
dd8b72ae73 Revert "Use SkArenaAlloc instead of SkSmallAllocator in the SkAutoBlitterChoose code."
This reverts commit 2b57b7f7a7.

Reason for revert: Android compile failing

Original change's description:
> Use SkArenaAlloc instead of SkSmallAllocator in the SkAutoBlitterChoose code.
> 
> 
> TBR=reed@google.com
> Change-Id: Iefb044bf7657fbf982f23aa91a3f4d013ce2c626
> Reviewed-on: https://skia-review.googlesource.com/7786
> Reviewed-by: Mike Klein <mtklein@chromium.org>
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Herb Derby <herb@google.com>
> 

TBR=mtklein@chromium.org,mtklein@google.com,herb@google.com,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: Id09c35377dddae0811d998b7d0c34c422325a5bc
Reviewed-on: https://skia-review.googlesource.com/8129
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-02-07 17:28:21 +00:00
Herb Derby
2b57b7f7a7 Use SkArenaAlloc instead of SkSmallAllocator in the SkAutoBlitterChoose code.
TBR=reed@google.com
Change-Id: Iefb044bf7657fbf982f23aa91a3f4d013ce2c626
Reviewed-on: https://skia-review.googlesource.com/7786
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2017-02-07 15:43:45 +00:00
Hal Canary
6f6961ebad make GR_TEST_UTILS=0 work
Change-Id: Icce35140ca08b65217b32e6b1ffc6ad2f38ab37f
Reviewed-on: https://skia-review.googlesource.com/7840
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2017-02-02 12:49:17 +00:00
Herb Derby
99d4721171 WS: remove trailing WS.
TBR=stani@google.com

Change-Id: I8d2b86697797977ed153cc65e2ca63941677c010
Reviewed-on: https://skia-review.googlesource.com/7826
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2017-01-31 21:00:35 +00:00
Hal Canary
2d0f452622 delete project.pbxproj
Change-Id: Ibe6ab90eeeb76a8c75f2e8c2d881b099265a3f8e
Reviewed-on: https://skia-review.googlesource.com/7785
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2017-01-30 23:54:48 +00:00
Hal Canary
96abfc37cc experimental/documentation/gerrit.md: more detail
NOTRY=true
Change-Id: I386013af35ae2a8b51fa78109ebd89a826334839
Reviewed-on: https://skia-review.googlesource.com/7754
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
2017-01-30 19:49:20 +00:00
Hal Canary
861bc3f45d experimental/documentation/gerrit.md: fix markdown
https://skia.googlesource.com/skia/+/master/experimental/documentation/gerrit.md

NOTRY=true
Change-Id: Id7fcb90c563dfb7cd160421d18ae84fd442eb98e
Reviewed-on: https://skia-review.googlesource.com/7752
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2017-01-30 17:52:38 +00:00
Hal Canary
c349f7f6ae experimental/documentation/gerrit.md: improvements
https://skia.googlesource.com/skia/+/master/experimental/documentation/gerrit.md
NOTRY=true
Change-Id: I90d8e16e9d6146fefe0199bb98d5f8eea31d4e8f
Reviewed-on: https://skia-review.googlesource.com/7750
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2017-01-30 17:47:31 +00:00
Hal Canary
2d0c238fcb experimental/documentation/gerrit.md
NOTRY=true
Change-Id: I5f429b48732ca99409cb923c2a3d7bf5f4189d24
Reviewed-on: https://skia-review.googlesource.com/7723
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2017-01-27 20:39:59 +00:00
Brian Salomon
587e08f361 Revert "Revert "Start of rewrite of GrFragmentProcessor optimizations.""
This reverts commit 052fd5158f.

Disables the test (of unused code) until platform-specific issues are addressed.

Change-Id: I7aa23a07954fccf382aa07d28afcbffb0bebcd6d
Reviewed-on: https://skia-review.googlesource.com/7656
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-01-27 16:43:38 +00:00
Ethan Nicholas
052fd5158f Revert "Start of rewrite of GrFragmentProcessor optimizations."
This reverts commit 85eb4226a4.

Reason for revert: test failures on Windows, e.g. https://chromium-swarm.appspot.com/task?id=33f9527484414110&refresh=10

Original change's description:
> Start of rewrite of GrFragmentProcessor optimizations.
> 
> This adds a replacement for computeInvariantOutput buts does not use it yet. The replacement allows for three types of optimizations:
> 
> * known input color -> known output color for GrFP elimination
> * tracking of whether all color processors modulate their input for the "tweak alpha" optimziation
> * opaqueness tracking
> 
> This loses some of the generality of computInvariantOutput. It does not track the known output status of individual color components (other than opaque alpha). It does not track whether GrFragmentProcessors read their input color. It doesn't allow a processor that will receive non-constant output to advertise that it produces a constant output. These could probably be added back in the unlikely case that they prove valuable.
> 
> Unlike computeInvariantOutput the optimizations are decided at instantiation time and constant colors are expressed as GrColor4f rather than GrColor.
> 
> Change-Id: I684d3f9050693dde2d28154fa695e049ed8cf61a
> Reviewed-on: https://skia-review.googlesource.com/7481
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> 

TBR=egdaniel@google.com,bsalomon@google.com,brianosman@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: I2390df257456013fa74137cb5d7b5a93820c291e
Reviewed-on: https://skia-review.googlesource.com/7652
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2017-01-27 15:34:43 +00:00
Brian Salomon
85eb4226a4 Start of rewrite of GrFragmentProcessor optimizations.
This adds a replacement for computeInvariantOutput buts does not use it yet. The replacement allows for three types of optimizations:

* known input color -> known output color for GrFP elimination
* tracking of whether all color processors modulate their input for the "tweak alpha" optimziation
* opaqueness tracking

This loses some of the generality of computInvariantOutput. It does not track the known output status of individual color components (other than opaque alpha). It does not track whether GrFragmentProcessors read their input color. It doesn't allow a processor that will receive non-constant output to advertise that it produces a constant output. These could probably be added back in the unlikely case that they prove valuable.

Unlike computeInvariantOutput the optimizations are decided at instantiation time and constant colors are expressed as GrColor4f rather than GrColor.

Change-Id: I684d3f9050693dde2d28154fa695e049ed8cf61a
Reviewed-on: https://skia-review.googlesource.com/7481
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-01-27 14:56:48 +00:00
Brian Salomon
5f13fbac19 Stop tracking whether GrFragmentProcessors read their input
Change-Id: Id5338901978b97289798eaef873527597bd8dfd6
Reviewed-on: https://skia-review.googlesource.com/7414
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2017-01-23 20:17:53 +00:00
Robert Phillips
67c18d6b51 Continue making Ganesh use absolute texture coordinates - take 2
The idea here is that the GrCoordTransform will actually hold a GrTextureProxy (rather than a GrTexture) and then, in GrGLSLPrimitiveProcessor::GetTransformMatrix, use the instantiated width & height (when uploading the transform matrix)

Relanding of: https://skia-review.googlesource.com/c/6977/


Change-Id: Ibc9b9e354f7fc23b1a6e6e4fe7c9fe3cef771c02
Reviewed-on: https://skia-review.googlesource.com/7265
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-01-20 18:18:18 +00:00
Brian Osman
61624f0c71 Plumb dst color space in many places, rather than "mode"
This is less to type in most cases, and gives us more information
(for things like picture-backed images, where we need to know all
about the destination surface).

Additionally, strip out the plumbing entirely for bitmap sources,
where we don't need to know anything.

BUG=skia:

Change-Id: I4deff6c7c345fcf62eb08b2aff0560adae4313da
Reviewed-on: https://skia-review.googlesource.com/5748
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2016-12-09 20:31:23 +00:00
Florin Malita
7d529881c4 [SVGDom] Clipped clipPath support
ClipPaths can be clipped too, e.g.:

  <clipPath id="clip1" clip-path="url(#clip2)">...</clipPath>

Since we're not really drawing clips but resolving their geometry,
asPath() needs to take composed clipping into account (and intersect as
needed).

R=reed@google.com,robertphillips@google.com,stephana@google.com

Change-Id: I25959e22fe50f72042147cfe6b416b6b9ac20cd4
Reviewed-on: https://skia-review.googlesource.com/5720
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2016-12-09 16:06:25 +00:00
Florin Malita
ce8840e384 [SVGDom] ClipPath support
* clip-path attribute handling
  * clipPath container element
  * asPath() SkSVGNode virtual for capturing subtree geometry

R=robertphillips@google.com,stephana@google.com

Change-Id: I9597534fe3047b631da6309eafac055dff5696e9
Reviewed-on: https://skia-review.googlesource.com/5650
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2016-12-08 15:00:18 +00:00
Florin Malita
e932d4b3a9 [SVGDom] Add fill-rule support
There's a bit of friction with this attribute, because per spec it is
an inherited presentation attribute, but in Skia it is part of the
actual SkPath state.

So we must add some plumbing to SkSVGShape & friends to allow overriding
the fill type at render-time.

R=robertphillips@google.com,stephana@google.com

Change-Id: I9c926d653c6211beb3914bffac50d4349dbdd2c0
Reviewed-on: https://skia-review.googlesource.com/5415
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2016-12-06 16:05:41 +00:00
Hal Canary
08c79b8556 remove more old cmake files
NOTRY=true

Change-Id: I53326b62467aeb6346325597f0223e247fefed8c
Reviewed-on: https://skia-review.googlesource.com/5391
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2016-11-30 20:37:45 +00:00
Brian Salomon
94efbf51f5 Merge GrGLSLCaps into GrShaderCaps
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5121

Change-Id: If8d13638f80f42161cbc766a2666c5789e5772c8
Reviewed-on: https://skia-review.googlesource.com/5121
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2016-11-29 19:32:31 +00:00
Brian Salomon
99938a8ef2 Merge GrGLSLShaderVar and GrShaderVar
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5087

Change-Id: Ib8943a1da1ea495554feaf5b0992b94fbb9539ab
Reviewed-on: https://skia-review.googlesource.com/5087
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2016-11-21 19:13:43 +00:00