Looking at audio layer support for Skottie, we need an API to
externalize audio asset loading and playback.
Similar approach to the other resource types for loading, but in
addition we also delegate playback control to the embedder.
First thought: keep it really simple and just emit seek() events.
Positive |t|s for track playback, negative for track off.
The embedder needs to implement state menagement (playing/not-playing)
and optional synchronization (if animation playback is not real time).
Change-Id: I54d1c2c39d0c38dd926f7c93764bde6695cb3fe2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309317
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
https://clang.llvm.org/extra/clang-tidy/checks/performance-unnecessary-copy-initialization.html
Finds local variable declarations that are initialized using the copy
constructor of a non-trivially-copyable type but it would suffice to
obtain a const reference.
The check is only applied if it is safe to replace the copy by a const
reference. This is the case when the variable is const qualified or when
it is only used as a const, i.e. only const methods or operators are
invoked on it, or it is used as const reference or value argument in
constructors or function calls.
Change-Id: I1261410deccd8ea64e85edec53fbd5360940e587
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308759
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
SkArenaAlloc has three fields that are used only for reset. Make a
subclass called SkArenaAllocWithReset which has the three
fields, and has the reset functionality.
An example of a reset() that is used instead of using a better scope
is PathOpsAngleAfter in PathOpsAngleTest.cpp.
Change-Id: Ie1965d128dfb7df9e022f4d18460d3f75f33e1a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307348
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
https://clang.llvm.org/extra/clang-tidy/checks/readability-const-return-type.html
`const` on a non-pointer/reference return type typically doesn't add
value and can have negative side effects. (i.e., returning a
`const std::string` isn't meaningfully different from returning a
`std::string`, but can sometimes inhibit move-related optimizations.)
In Skia's case, the priv() functions are a notable exception where const
return types are intentional and valuable. These calls have been marked
with NOLINT to exclude them from the check.
This check does not affect pointer and reference returns, where
constness is important.
Change-Id: I86cab92332f164e5ab710b4127182eec99831d7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308564
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
We already expose frame-index-based seek methods, makes sense to also
allow querying the in/out points.
Change-Id: I3b805f6df3484c8bdc7cd6c81e54b5073710e222
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308598
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
This fixes a large number of SkSL namespaces which were labeled as if
they were anonymous, and also a handful of other mislabeled namespaces.
Missing namespace-end comments have been added throughout.
A number of diffs are just indentation-related (adjusting 1- or 3-
space indents to 2-space).
Change-Id: I6c62052a0d3aea4ae12ca07e0c2a8587b2fce4ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308503
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This is a 'Create' and returns a reference. Be sure to release the
reference.
Bug: skia:10542
Change-Id: If4ed7a37a43efe5f8f17a4a15a0f82cdae7d9276
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307795
Auto-Submit: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Previously one could not color text with paints, even though TextStyle's foregroundColor and
backgroundColor fields are SkPaints. Canvaskit only exposed these as colors in order to allow
SimpleTextStyle to be a value object that would not have to be deleted by the user.
CanvasKit.Paint is a bound SkPaint. I wanted to allow a user to pass a paint to be used
in a text style without alterting SimpleTextStyle's status as a value-object.
So I've added a new bound method, pushPaintStyle which acts just like pushStyle but allows
a foreground and background paint to be supplied which are used to override the existing paints.
The user is responsible for deleting these paints.
Sorry for the kludgy design, if you have got a more elegant way, I'm open to suggestions.
Change-Id: Ib78464171346fe9f717f6d5b9d9428b1d0278498
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307596
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
The majority of existing call sites were automatically updated using
clang-tidy -fix. A small handful required a manual update,
e.g. CppCodeGen.
This check is a bit lenient, and in particular will not flag cases like
`std::unique_ptr<Base>(new Derived())` which is still pretty common
throughout our codebase. This CL does not attempt to replace all the
cases that ClangTidy does not flag.
Change-Id: I5eba48ef880e25d22de80f321a68c389ba769e36
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307459
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
The MultiFrameImageAsset helper can be flagged to decode lazy images
upfront (to avoid run-time decoding and resource cache interactions).
But when pre-decoding is enabled, MultiFrameImageAsset yields a
different SkImage for every request - *even for static images*.
This means that e.g. each image layer precomp instance gets its own
copy of the data. Bad bad bad.
Update MultiFrameImageAsset to cache the last frame, and reuse when
backed by a static image.
Change-Id: I65431e7ccf4a64f0055f935f9823c33402d1bb2b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306938
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
the BUILD_DIR in compile.sh was not being set properly prior to this
change, resulting in build output in the `skia/out/canvaskit_wasm`
directory instead of the `skia/out/canvaskit_wasm_experimental_simd`
directory.
Change-Id: Idb599d4885a16c10848e4c90954e778f63065c45
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306299
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Nathaniel Nifong <nifong@google.com>
This reverts commit 143646297e.
Reason for revert: Have to fix it and reland again
Original change's description:
> Revert "Attach whitespaces to the neighbor unresolved blocks"
>
> This reverts commit 131c5ad6f1.
>
> Reason for revert: Blocking the G3 roll
>
> Original change's description:
> > Attach whitespaces to the neighbor unresolved blocks
> >
> > Fix the situation when an unresolved {arabic} text is broken into
> > many small runs by resolved english spaces.
> >
> > Bug: skia:10487
> > Change-Id: I3a739501c0fb7e0fc845e68392e1d214df9302db
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304000
> > Commit-Queue: Julia Lavrova <jlavrova@google.com>
> > Reviewed-by: Ben Wagner <bungeman@google.com>
>
> TBR=bungeman@google.com,jlavrova@google.com
>
> Change-Id: Iaa338dd5fb5c9962df2ee32bafbc089da0e2b8a1
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10487
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305797
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
TBR=bungeman@google.com,robertphillips@google.com,jlavrova@google.com
Bug: skia:10487
Change-Id: If8a85254fd536f465d80766de0406053d90c96a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306062
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
While doing a refactor, Clang issued some warnings about having copy-
constructors without assignment operators in some TextStyle classes.
Rewrote the code to minimize custom constructor/copy/assignment methods,
favoring C++11 member initialization syntax instead.
Change-Id: I4f0361ce38d4b0ada346b0ede4fcad4e2b686d67
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305959
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
These missing includes were discovered when attempting a refactor.
Change-Id: I8aad5610de2337de6e55885b5868e606c1514eaf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305997
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
BM can now export inline fonts, encoded as data-uris.
Extend our DataURIResourceProviderProxy helper to also intercept and
decode inline typefaces.
Change-Id: Iaf1be9db2fd32383af78bc351b1228fe6b3b64bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305685
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
This reverts commit 131c5ad6f1.
Reason for revert: Blocking the G3 roll
Original change's description:
> Attach whitespaces to the neighbor unresolved blocks
>
> Fix the situation when an unresolved {arabic} text is broken into
> many small runs by resolved english spaces.
>
> Bug: skia:10487
> Change-Id: I3a739501c0fb7e0fc845e68392e1d214df9302db
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304000
> Commit-Queue: Julia Lavrova <jlavrova@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>
TBR=bungeman@google.com,jlavrova@google.com
Change-Id: Iaa338dd5fb5c9962df2ee32bafbc089da0e2b8a1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10487
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305797
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Fix the situation when an unresolved {arabic} text is broken into
many small runs by resolved english spaces.
Bug: skia:10487
Change-Id: I3a739501c0fb7e0fc845e68392e1d214df9302db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304000
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Although deprecated, loadFont is still in use - we should proxy it for
now.
Change-Id: Iccef76d4ba394d08fc61c7471def8dee470db695
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305516
Auto-Submit: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Spread/choke operates as a compression of the alpha channel towards the
low bits.
Change-Id: I82aec1321b60f7f75a79e8280e761d4629f6c923
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305183
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
Change-Id: Ie55e876638246a444c32b169ed3830cd7b0fbab3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304861
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Change-Id: Ic44e24057b95bb014504f02a736fb4341afc8971
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304856
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
In this CL:
- Modify modules/canvaskit/gpu.js to support the use of OffscreenCanvas.
- Add a CanvasKit demos.skia.org demo for CanvasKit in a Web Worker.
Change-Id: I8c26bd94f2aa5b3c09cf149b056b910b0e4cd602
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304320
Reviewed-by: Elliot Evans <elliotevans@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Commit-Queue: Elliot Evans <elliotevans@google.com>
These changes were supposed to land yesterday, but I forgot.
Change-Id: I46aca428482f9812c1b025f9735ebe2c0ac02bf1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304602
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Assorted bugfixes for the non-analytical mask code path.
1) SkSG modulatePaint() should only override the blend mode when
one is specified (!= kSrcOver).
2) Some modes (notably intersect) require touching pixels outside the
mask draw geometry. These modes must be applied as a layer.
Introduce an explicit layer node in SkSG, and inject for masks which
require it.
Also refactor Subtract to use more natural blend and pathops modes,
instead of always inverting geometry.
TBR=
Change-Id: I412168d1ff61eb8e59907babe8f0e091f6fffacf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303997
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
This also makes the effects deserialization available via compile flag.
Change-Id: Ib6692499a619205ac480a8823ce7de12c0a5a723
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303596
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Sksg::Merge needs to preserve the fill type of the first path appended
in the stack.
Theoretically, one could append multiple paths with different fill types
using sksg::Merge, but in practice Skottie should never do that (append
mode with invertible shape only used for the very first mask in a stack).
TBR=
Change-Id: Ie9ac9187cc1c8baaae2bef439313a7700407f04a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303582
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>