Commit Graph

608 Commits

Author SHA1 Message Date
Kevin Lubick
541f310b34 [canvaskit] Fix primitive_shaper build
The problem was we didn't have a way to not build with
SkParagraph, which we can't use when we are using the
primitive shaper.

Change-Id: Iafe070d6f5c01aaa7a42225793d5ad873f144798
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254968
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-11-15 21:10:22 +00:00
Kevin Lubick
0491267160 [canvaskit] Expose more SkParagraph methods
Bug: skia:9469

Change-Id: I922a877fc20d29b95e68f93842505df5dead6934
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254960
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2019-11-15 20:08:41 +00:00
Kevin Lubick
d267719e32 [canvaskit] Add MatrixTransform ImageFilter
Change-Id: Ifcb73c331846abb3ffa9ac2f41236de8da4fdccc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254804
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-11-15 19:50:14 +00:00
Kevin Lubick
1496758da4 [canvaskit] Request an 8 bit stencil buffer from the WebGL 1/2 context
We hadn't been requesting one, but told Skia we had one, which caused
issues.

Bug: skia:9564
Change-Id: I9a2e78a528778a386225cdcbbb2d2b3d8f705f05
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254801
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-11-15 17:21:48 +00:00
Kevin Lubick
ea03373a6d [canvaskit] Swap font resolution order for emoji test
Change-Id: I522435f37b7c8cf363fb36668e35a8c5bd114810
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254898
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2019-11-15 16:30:00 +00:00
Kevin Lubick
37ab53e7c7 [canvaskit] Expose a few more methods
More requests by flutter-web.
 - drawPoints
 - drawImageNine
 - getSegment
 - addPoly

Change-Id: Iad8f51bb7df5fe014931dc12c8d09d64c08c3a13
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253740
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-11-14 19:00:33 +00:00
Florin Malita
ad76b2ee25 [skottie] One-node camera support
So far Skottie has been assuming all cameras are two-node (have a point
of interest).

AE also supports one-node cameras, where the camera does not auto-orient
towards a POI but starts off perpendicular to the z == 0 plane.

(https://helpx.adobe.com/after-effects/how-to/camera-animation.html)

Change-Id: Id565de7d8feb9a762940ac372c1bbbcce2e2dfc6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254559
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-11-14 18:45:18 +00:00
Julia Lavrova
b00ccf52de Correct cluster index
Change-Id: Ic657b3fff318e1e76efa4ab7533bc2a833d17802
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253957
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2019-11-11 19:26:56 +00:00
Julia Lavrova
f0ade8a687 Fixing no icu situation
Change-Id: I9763a0a2a0ee231500b27c11e17e0f5f4df44f29
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253683
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-11-08 18:59:03 +00:00
Julia Lavrova
2e30fde046 Font resolution: all unit tests working
Change-Id: Ie6ee30901d599ceefa42651add79bb0288c54c48
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249004
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2019-11-08 17:24:14 +00:00
Kevin Lubick
47bd9f1b73 [canvaskit] Expand SkAnimatedImage
With these things exposed, I think Flutter will not need
CanvasKit to expose the very complex SkCodec API.

Change-Id: Iace1b496d1dcb8842181466e860e8f212aba7b48
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253542
Reviewed-by: Leon Scroggins <scroggo@google.com>
2019-11-08 14:58:14 +00:00
Kevin Lubick
f6a9d20e95 [canvaskit] Fix null dereference when GrContext cannot be made
This happens when validation fails, for example.

Change-Id: Idbd552fbce51c5cf1543fc7a0a34a87230264d6e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253658
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-11-08 14:58:04 +00:00
Ben Wagner
da53dd5e17 Reland "Fix empty run handling in trivial shaper iterators"
This reverts commit 1803f4ef6f.
And also fixes the primitive shaper.

Change-Id: Ieaeda5522c98d8a9e6f628b8a6cc30cf41278350
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252929
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-11-06 14:32:13 +00:00
Ben Wagner
1803f4ef6f Revert "Fix empty run handling in trivial shaper iterators"
This reverts commit 0f3a26dd18.

Reason for revert: Windows bots are broken

Original change's description:
> Fix empty run handling in trivial shaper iterators
> 
> When the text run is of zero length the iterator starts at the end. The
> trivial itereators did not handle this case.
> 
> Change-Id: Id41304500e33d821874f56ab20085cbc4b2d9b0b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252857
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>

TBR=bungeman@google.com,herb@google.com

Change-Id: Ia38e46ac4c04def5d374fbbce450538096d90d64
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252923
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-11-05 20:13:43 +00:00
Ben Wagner
0f3a26dd18 Fix empty run handling in trivial shaper iterators
When the text run is of zero length the iterator starts at the end. The
trivial itereators did not handle this case.

Change-Id: Id41304500e33d821874f56ab20085cbc4b2d9b0b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252857
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-11-05 19:51:11 +00:00
Florin Malita
91a1ec34bf [skottie] Streamlined gradient stop merger
Refactor as a single interpolating loop, based on careful selection
of lerp coefficients.

Change-Id: I58786cddb2f042b53dcbac80c2346736429be102
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252858
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-05 19:44:11 +00:00
Florin Malita
73a722ce97 [skottie] Fix trim path mode interpretation
"m": 1 -> parallel trim
  "m": 2 -> serial trim

(we had these backwards)

TBR=
Bug: skia:9599
Change-Id: Ib764c04a96c3a1e627553d8b8588028a411b5240
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252796
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-11-05 18:31:24 +00:00
Florin Malita
49081f6792 [skottie] Use SkColor4f for gradient color stops
TBR=
Change-Id: I941a2b876f87183c5750bb3cf68fc0cd7f0e56a1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252799
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-11-05 18:26:22 +00:00
Florin Malita
501149f8d1 [skottie] Add support for gradient opacity stops
Bug: skia:9600
Change-Id: If95c02279efae21db8a673a3b0d349915b0aaba0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252483
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-11-04 20:01:16 +00:00
Brian Osman
e36d030016 SkColorMatrix cleanup
Remove the RGB/YUV helpers (use SkYUVMath instead), along with the
unused get20/set20.

Change-Id: Id83467a1b7f33657869e0a933af75387a4e36a88
Bug: skia:9543
Change-Id: Id83467a1b7f33657869e0a933af75387a4e36a88
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252188
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-04 15:20:15 +00:00
Kevin Lubick
79b7134b5f [canvaskit] Add relative SkPath operators
Like with the non-relative forms, we want to be able to
chain these together, but not leak the SkPaths (which happens
if the C++ side returns this). Thus, we have to add in
the JS glue to return the "JS this".

Change-Id: Ic640b84f6c09c1d931ad44bc403b14bb0d0893a2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251960
Reviewed-by: Hal Canary <halcanary@google.com>
2019-11-01 20:08:27 +00:00
Kevin Lubick
77d9b5c58e [canvaskit] Add tentative support for savelayerrec
It was easier to just add a few saveLayer overrides rather
than try to expose the struct of pointers. SkRect*
was hard/impossible because we have it as a value_object,
which does not support pointers in enscriptem.

Change-Id: Iad702593cca19f80d6ef9a319f8c80a087135e38
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250996
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-10-29 16:46:43 +00:00
Kevin Lubick
15b40236bd [canvaskit] Add various ImageFilters
We are pretty comfy exposing this set for the long-term.

CanvasKit will generally support chains of image filters,
not necessarily arbitrary DAGs, just to simplify the
points needed to expose.

Change the naming around MaskFilters also, I like having
the factories be a class function, just to keep things
a bit better organized and minimize the amount of things
we want to keep on the top level CanvasKit object.

Change-Id: If32c630efa2fd8bc4bac84d0c3461ac3c0d21263
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250758
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-10-29 14:48:33 +00:00
Florin Malita
512eb94916 [skottie] Fix layer blend modes under mattes
The layer blend mode should be applied post-masking (after compositing
with the matte layer).

TBR=
Change-Id: Ie84760526cd9be95f08bc68bc5a8dbfb635ca905
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251316
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-29 01:49:26 +00:00
Florin Malita
c6fbedc507 [skottie] 3D layer parenting refinements
Observed AE layer parenting semantics:

  * layers are flagged as either 2D or 3D
  * camera applies to 3D layers, but not to 2D layers
  * parented 3D layers treat their ancestor transform chain as 3D (SkMatrix44)
  * parented 2D layers treat their ancestor transform chain as 2D (SkMatrix, ignoring 3D components)

This means that for a given layer, we may need to build two distinct transform chains - depending
on the type of descendant layer being considered.

Furthermore, transforms are animatable and their animators are scoped to a layer controller.  Since
we're potentially building two version of the transform node, we need to ensure all animators for
both of them are transferred to controller object (we still want to only instantiate a single layer
controller and render tree to avoid duplication).  IOW, all dependent layer transforms need to be
considered before "sealing off" a given layer controller.

In order to avoid a layer dependency/topological sort, we can split off the transform tree
construction into a separate pass.  High-level changes:

  -- replace existing LayerAttachContext with CompositionBuilder
     (holds LayerBuilders and other Composition-wide state)

  -- replace LayerRec with LayerBuilder
     (holds Layer-wide state and also caches transform nodes)

  -- pass 1: for each LayerBuilder, transitively build and cache a transform chain
     of a type (2d/3d) determined by the leaf (entry point) layer

  -- pass 2: for each LayerBuilder, build the actual layer content render tree
     and instantiate the layer controller objects

Bug: skia:8914
Change-Id: I9f7efcf4819424282fd3dda98f5621ba12fd001b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251001
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-28 20:29:54 +00:00
Kevin Lubick
a1a4d82314 [canvaskit] Use skia's version of png and zlib
Change-Id: I730936cf91776451f7ba2657e5d07b20837e2dee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247297
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-10-28 16:27:53 +00:00
Kevin Lubick
2d6d34ec19 [canvaskit] Use newer freetype
This new freetype lets us have emojis and brings in years
worth of bug fixes from the ancient version shipped in
the emscripten-ports

Change-Id: I0b8779dba3341a3ef73c715fde2e5fb37e45126a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247296
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-10-28 15:15:39 +00:00
Ben Wagner
bdf2c87947 HarfBuzz reports y-up, convert to y-down.
Change-Id: If90857f9cf8039ddc0dfba7f660d415a41953015
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250818
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-10-25 14:41:50 +00:00
Florin Malita
c1b501c352 [skottie] Shift Channels effect support
(https://helpx.adobe.com/after-effects/using/channel-effects.html#shift_channels_effect)

Limitations: no HSL sources for now.

Change-Id: Iffd63f2bbfc8c5f1de00846412be26847e822420
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250036
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-10-22 20:36:01 +00:00
Kevin Lubick
6dbc4ed880 [canvaskit] Expose various canvas features
clipRRect and drawColor

Change-Id: I6e947b4a30646a96935c74e0cd334f1624c41065
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249892
Reviewed-by: Mike Reed <reed@google.com>
2019-10-22 16:09:27 +00:00
Florin Malita
587f7365d5 [skottie] Expose native frame rate and seekFrame() in WASM
Change-Id: I003ed90170abf287451a5df51a9aa54285236e63
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249891
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-22 14:13:37 +00:00
Kevin Lubick
e25df6cf78 [canvaskit] Expose Malloc to save copies in some places
By adding in the check to copy1dArray, some places get the benefit
for free.

Change-Id: I12e230465737dc6276feb02ddb37e3c417777055
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249878
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-10-22 13:41:28 +00:00
Florin Malita
94e1a52686 [skottie] fix clangtidy warning
TBR=
Change-Id: I4db02978edbf7d60693b18a7c661640a4ab05bf0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249885
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-21 21:27:40 +00:00
Kevin Lubick
56f569d9be [canvaskit] roll to v0.8.0
Biggest change here is to add initial support for WebGL 2.0 where possible.

Change-Id: I05657dbfeed25fc665205ceda6b35022f6a42053
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249815
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-10-21 19:17:46 +00:00
Florin Malita
cfbc4d496d [skottie] Add DataURI image support in utils/tools
BodyMovin can export inline (dataURI) images.

Change-Id: I821a2e225359f8ac37d4d2c9479d4ff5d78f924e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249516
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-21 18:02:39 +00:00
Florin Malita
b9886864ca [skottie] Frame-index seek API (seekFrame)
Add a new seek method which takes a frame index. This provides more accurate
control when rendering of exact frames is needed.

Also surface the animation frame rate, and convert skottie_tool to use this
new mechanism (now defaulting to native animation frame rate).

Change-Id: Id870629e1747a9f70cbf4d3e770366df1299a519
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249799
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-10-21 17:14:36 +00:00
Kevin Lubick
d3b1fe66d6 [CanvasKit] More Paragraph things
Bug: skia:9469
Change-Id: I72a4912b5b6edd2ddde077a558c2c24b68d7df64
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249556
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2019-10-21 15:27:13 +00:00
Kevin Lubick
3085d9ac7d [canvaskit] Roll chrome version for testing
Also disabling failing perf test.

Change-Id: I5776a5dfba0d429ad6a9d725de26c585e61ba37b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249427
Reviewed-by: Hal Canary <halcanary@google.com>
2019-10-18 17:37:52 +00:00
Florin Malita
814f3cc079 [skottie] Default camera for 3D layers
When 3D layers are present, we need a camera view even when no explicit
camera is present.

TBR=
Bug: skia:8914
Change-Id: I408986d516e03bc4f80c7c09103e09821704ff2f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249420
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-18 17:20:11 +00:00
Florin Malita
a3adb9ac7e [skottie] Camera does not apply to regular/2D layers
Per [1], "Cameras affect only 3D layers and 2D layers with an effect
with a Comp Camera attribute."

[1] https://helpx.adobe.com/after-effects/using/cameras-lights-points-interest.html#create_a_camera_layer_and_change_camera_settings

Bug: skia:8914
Change-Id: Ic63ac1a9bfd0913757061684f64adf3df8424246
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249419
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-18 16:45:07 +00:00
Florin Malita
d9e8586d23 [skottie] Fix camera/3D layer transform interactions
Currently, the camera view transform is attached to the render tree as a
TransformEffect.  This means it gets "flattened" to an SkMatrix in isolation,
and does not compose with other layer transforms in 4x4 format.

Refactor the implementation to

  - build the camera transform upfront
  - compose (chain) all layer transforms from this camera transform

This ensures that transform composition happens in SkMatrix44.

E.g. render tree topology change (TE == TransformEffect)

Before:

                      [root]
                        |
                      [TE]<---[CameraT]
                        |
       ------------------------------------
      |                                    |
      |                                    |
    [TE]<--[Layer1T]          [Layer2T]-->[TE]
      |                                    |
  [Layer1]                              [Layer2]
      |                                    |



After:
                      [root]
                        |
                        |
       ------------------------------------
      |                                    |
      |             [CameraT]              |
      |                / \                 |
    [TE]<--[Layer1T]<--   --->[Layer2T]-->[TE]
      |                                    |
  [Layer1]                              [Layer2]
      |                                    |


TBR=
Bug: skia:8914
Change-Id: Idd407712f75c48623b5299a4284ddb17b98c155f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249217
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-17 20:57:09 +00:00
Brian Osman
e8bcc56951 Fix a couple minor bugs in particle code
- Copy effect state to particle uniforms before each script, so changes
  from spawn or update are visible.
- Guard path binding against out of range access
- New effect that actually stresses both of these conditions

Change-Id: Ice6112793099e515438af8bb863e9e1bf03d08b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249125
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-10-17 14:55:34 +00:00
Hal Canary
e054d3cf3d CanvasKit: Switch to WebGL 2.0
CQ_INCLUDE_TRYBOTS=skia.primary:Test-Debian9-EMCC-GCE-GPU-AVX2-wasm-Release-All-CanvasKit,Test-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-CanvasKit

Bug: skia:9052
Change-Id: I444031276aea90d82f289b16ba6cd36de5192abd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248927
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-10-16 18:45:46 +00:00
Brian Osman
5b43113e75 Interpreter: Reflect all uniform variables in ByteCode
Gives enough information to locate variables by name (using the same
scheme as glGetUniformLocation), and provide hints about type and size.

Bug: skia:9513
Change-Id: I9444f1042471967a79c9f05167dcdb78eca41bad
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244502
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-10-16 15:35:48 +00:00
Hal Canary
ebc89c1a7d canvaskit: add helpful message to compile.sh
Change-Id: I48a48c8d2f3853fd948cadfc7cc93f41d72e2ea2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248800
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-10-16 13:47:14 +00:00
Florin Malita
59e72b71b5 [skottie] Luma matte support
Expand matte support to include normal/inverted luma modes [1].

[1] https://helpx.adobe.com/after-effects/using/alpha-channels-masks-mattes.html#track_mattes_and_traveling_mattes

TBR=
Bug: skia:9390
Change-Id: Ie6555852e70449e4343944c70d2f9b8a98bb33cb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248701
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-16 13:17:51 +00:00
Brian Osman
4beafa69ab Add interactive demo to particle gallery
Docs-Preview: https://skia.org/?cl=248805
Bug: skia:9513
Change-Id: Id862ebdc58c2cde38720e26f0140e20c5338c78c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248805
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-10-15 18:15:47 +00:00
Brian Osman
df18296f98 Add accessors to get/set SkParticleEffect fields
Simplify burst handling. Scripts should just add to burst (if
they want to handle programmatic bursting, as well).

Update most effects to handle dynamic updates to position better,
and add a sample effect meant to be used with mouse tracking.

Change-Id: Ia302e1d04e62e2b07974807c44067786cc10a8ad
Bug: skia:9513
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248798
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-10-15 14:54:50 +00:00
Kevin Lubick
6e5b07e25b [canvaskit] Enable tests for getGlyphPosition
Change-Id: Ibdd5987689305d383699153cdabdb6cbfd528a3e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247599
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2019-10-10 18:48:49 +00:00
Mike Klein
b484e7ce24 hand off frames to encoder as they come
Instead of rendering all .mp4 frames then encoding, we can kick off
rendering and have the encoder consume frames in order as they become
available.

This uses std::promise / std::future pairs to make the handoff: frame
producers fulfill thieir promise by moving their image into set_value(),
and the encoder (main thread) consumes them by moving those images out
of the paired std::future().  It may not be obvious, but the line

    sk_sp<SkImage> img = frame.get_future().get();

does move the image into `img`... gMP4Frames does not hold a ref once
.get_future().get() has returned.  (Though depending on when you look,
the surface still might.)

This lets us get going on encoding as soon as the first frame is ready,
and hypothetically means encoding should finish shortly after the last
frame draws.  But, different frames cost different time to draw, and we
can't control the order they'll return.  We _do_ have control over the
order they're started, and we're doing that exactly wrong using a LIFO
thread pool.  I've added .mp4 encoding starvation stats to show this...
when I run in LIFO order it looks typically something like

    starved min 0ms, med 0ms, avg 4.12333ms, max 2115ms, sum 2474ms
    frame time min 12ms, med 292ms, avg 307.208ms, max 711ms, sum 184325ms
    106.68user 57.27system 0:04.55elapsed 3601%CPU (0avgtext+0avgdata 3159748maxresident)k
    0inputs+1528outputs (0major+772790minor)pagefaults 0swaps

Mirroring the batch order with (i = frame_count - 1 - i) results in less
starvation, less memory usage, better scaling, and a quicker wall time.

    starved min 0ms, med 0ms, avg 0.896667ms, max 382ms, sum 538ms
    frame time min 13ms, med 374ms, avg 344.365ms, max 918ms, sum 206619ms
    111.64user 52.56system 0:03.62elapsed 4529%CPU (0avgtext+0avgdata 2660912maxresident)k
    0inputs+1528outputs (0major+649031minor)pagefaults 0swaps

Change-Id: Ic60e8eac856af238ef32e3383d86f6c24e5c7851
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247674
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-10-10 16:34:31 +00:00