Adding double-parens around an `if ((false))` squelches the warning.
In other cases, you can squelch the warning by assigning the
always-constant(-on-this-machine) check into a constexpr bool.
Change-Id: I5a344fb45779c5bd2865edb3cffaf839ba9a5d85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504597
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
PS 1 regenerates existing Bazel files
PS 2 adds generated Bazel files to skottie and its dependencies,
as well as incorporating it into CanvasKit.
This changes the version of Bazel we use to 5.0.0 (recently
released).We had been using a pre-release of 6.0 because we
wanted the new features in one of the 5.0 release candidates,
but not the regression that was there (and reverted before the
full 5.0 release). I'd like to stick to the latest stable Bazel
release where possible.
Suggested Review Order:
- //modules/skottie/BUILD.bazel (this was hand written
to encapsulate the skottie library). The files in the
deps are based on skottie.gni.
- //modules/skresources/BUILD.bazel and //modules/sksg/BUILD.bazel
which expose all sources
- //third_party/file_map_for_bazel.json which ignores the
ffmpeg libraries (we won't actually build the SkVideoDecoder
stuff because HAVE_VIDEO_DECODER is not set).
- //modules/canvaskit/BUILD.bazel which makes use of the skottie
library and includes the interface skottie.js file.
- .bazelversion which changes the Bazel version used (e.g. by
Bazelisk).
- All other changes should be auto-generated or related to
deleted files.
Change-Id: Ic26f9a9dea5310f2cbd9cda7d701847924a39a22
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503828
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Add an overload to SkPathEffect that can be used when the CTM is known
at the callsite. GPU callsites are not handled here, that will be
tackled in a separate CL.
Path effects must implement the filterPath virtual that accepts the CTM,
although they are not obligated to use it. If a path effect does
use the CTM, the output geometry must be in the original coordinate
space, not device space.
Bug: skia:11957
Change-Id: I01615985599fe2736de954bb10dac881b0554ae7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420239
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Animated opacities can yield values > 1, which trigger RenderContext
asserts.
Clamp explicitly to avoid this issue. Also avoid allocating a new
RenderContext when the value is >= 1 (no op).
TBR=
Change-Id: I1639af7ab50f4ccf9cd79cb950f14b64dd2619ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408256
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
In the build there are some defaults which actually apply to every
use of a built-in target type, but there are some (particularaly
warnings) which apply only to targets controlled by Skia. Currently
these unwanted defaults are magically known to exist and removed
wherever they are not wanted. Instead, create 'skia_' prefixed target
templates and apply these defaults to those instead.
Change-Id: I3a2afb53c7205a2e2748d1cfad46319f2e93d3b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/385516
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Split the :tests target into a :test target which contains the test
framework and :tests which collects all of the test cases. This allows
for all targets which define tests to depend on :test in order to define
tests, with :tests then depending on all targets which define tests. A
similar split should be considered for gms, samples, and benches.
Change-Id: Ic9f373ec0c1a8ea842fa68327e854db23477caae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371696
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Also cleanup some of the duplicate code in SkRecords
Bug: skia:7650
Change-Id: I4d3167a892c126c19a54002beab25c9a6c96fa5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357000
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
SkPaintPriv methods are just an internal stopgap
Change-Id: Ibe6e37c5871068d8cd67dc0948961444dfd2b62a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347041
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Expand the SkImageAsset API to support controlling sampling options and
pass an additional transform.
Bug: skia:10944, skia:10942
Change-Id: I7bad0b2ab58ed40fe4b425de0eb6970a4c7d7117
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340097
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Step one is to make it private -- only skottie needs it at the moment
Stpe two is to modify pathops to use builders, and then we can likely
remove it shrinkToFit entirely (since builder.snapshot() is already snug).
bug: skia:9000
Change-Id: I9126bcb6fc2094fbeede2acb1f211b0ab771feba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327341
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Plumb layer size information and add machinery for retrieving layer
content as an SkPicture.
Implement the effect in SkSL.
Current limitations:
* displacement source layer must be above (on top in stacking order)
of the target layer
* if animated, the displacement layer timeline (in/out points) must
fully cover the target layer timeline
* Hue/Sat/Lightness selectors are not supported at the moment
These will be addressed in follow-up CLs.
Note: Bodymovin does not export hidden layers by default; if the
displacement source layer is hidden, one should select the "Hidden"
export option.
Change-Id: I11a5c760a9df1e75835a51371f60d5b798e7e38a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314798
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Mechanically updated via Xcode "Replace Regular Expression":
typedef (.*) INHERITED;
-->
using INHERITED = $1;
The ClangTidy approach generated an even larger CL which would have
required a significant amount of hand-tweaking to be usable.
Change-Id: I671dc9d9efdf6d60151325c8d4d13fad7e10a15b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314999
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@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>
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>
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>
Based on SkPathOps for now.
Change-Id: Id27c8a235cbd4ab5083735b67cf5d2635ee16cfc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300497
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Dash, trim, round, transform and upcoming offset have a lot in common.
Introduce a GeometryEffect base class to consolidate.
TBR=
Change-Id: Ib5556e6ebe416685c624d53ba8591e118aa4f0d6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300496
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Two issues:
1) mask shaders are ignored of drawImage; force application via a layer
2) visibility control clashes with layer controller; force a
transparent shader for now
TBR=
Change-Id: Ic9a86c87db043745fa9f829ef36706525570a3be
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299874
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
This reverts commit c80ee456ad.
fix: update flutter's gn file to add guard
Change-Id: Iac5171c8475d9a862d06255dab1c6f38f10de2f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291361
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Implement drop and inner shadow styles using explicit image filters.
Remove existing style support from DropShadowEffect.cpp, as it now
has a new cozy place with its inner sibling.
Supported properties:
- color
- opacity
- angle
- distance
- size (sigma)
Change-Id: I5b7e3c75678e036a20c1908b84c74a670a5aa196
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/283918
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
saveCamera() is no longer experimental
In a separate CL, will stage changes to concat virtual to take M44.
Change-Id: Iaf37ce2f24ab1223c54aeb1e79eaebf18f87fece
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281589
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Change-Id: I2d19c4f0ff1439dcd923a3064eb3ba78432a5113
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281043
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Since we can't use mask filters on layer paints any longer, refactor the
existing wipe effects to use explicit shader masking:
- remove SkSG::MaskFilterEffect - it no longer works
- replace with SkSG::MaskShaderEffect
- for atomic draws, apply the shader to the draw paint as
SkShader::Blend(kSrcIn, mask_shader)
- for isolated content, apply the mask as an extra pass
drawPaint(kDstIn, mask_shader) before restoring the layer
- refactor VenetianBlindsEffect, LinearWipeEffect and RadialWipeEffect
to use mask shaders
- additionally, refactor the RadialWipeEffect gradient to avoid using
a local shader matrix (does not compose correctly within the new
framework)
Everyone clear... do not touch the patient... BZZZT!
TBR=
Change-Id: I3a88da97a17b3b68812480cad5298b8778b6847c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275694
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
AE supports dashing all strokes. Dashes are specified as an arbitrary
number of intervals (alternating dash/gap) plus a start offset.
All values can be animated independently (but of course!).
- implement a SkSG dash effect (based on SkDashPathEffect)
- expand the shape builder logic to allow local geometry adjustments
(kind of a bummer that dashing is a stroke/paint property as opposed
to a geometry effect in AE)
Change-Id: Ic9ff35f2f9a552a3c26f9e1596ce58ad81f7ced5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274550
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
When per-character 3D is enabled, text properties can be animated in
3 dimensions.
- position and scale become 3-value vectors
- in addition to existing "r" (really rz), rotation gains "rx" and "ry"
- instead of specializing for 3D, expand the existing structures to
handle both 3D and 2D modes
- also ensure that sksg::Transform does not flatten to SkMatrix
Change-Id: I426a7ee1ff38c1702deb85e9f1db80f6069f36d6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272648
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
We can skip effect layers when none of the child nodes overlap (treat as
atomic draws, with effects applied on their paint).
The initial heuristic was simply checking for more than one child.
This version relaxes the heuristic to check each child bounds against
the union of preceding siblings.
Change-Id: I2dc6d30d945697f410100db0c46a8a8377d5b569
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269482
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
Change-Id: I0a6627f9b8d47e51c82c89ff1df75c3add8e8035
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267919
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Currently, property animators use lambda captures (std::function<>) to push
values to adapters and then to the scene graph. Some downsides:
* complex lambda captures are expensive in terms of object code size
* adapters with multiple animated properties don't synchronize/quiesce: each individual property tick triggers a SG
synchronization, possibly with inconsistent state (as animator running
order is unspecified)
* there is no enforced scoping, resulting in fragile constructs when SG
fragments are discarded
This CL introduces a simplified and more robust animator pattern:
* property animators are scoped to explicit containers
* instead of capturing arbitrary value functors, animators only capture
a pointer to the target value
Some implementation details:
* keyframe/interpolation logic is pretty much unchanged (just relocated)
* introduced AnimatablePropertyContainer - a base class for animatable
adapters
* legacy binding functions are refactored based on the new mechanism
(they now/transitionally inject adapter objects)
* converted a handful of effects, to exercise trivial refactoring patterns
* converted the text animator goo, to exercise non-trivial refactoring:
- detecting value changes is now trickier (no more lambda magic)
- value adjustments must be hoisted into adapter logic (no more lambda magic)
- all dependent animated values (selectors, etc) must be scoped to the
text adapter to avoid lifetime issues
TBR=
Change-Id: Ia5821982f251de0de58fd3f87812219ff7fcc726
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263938
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Change-Id: I7c672ff6b8eb95ec8c1123a5bfdb202e1644f494
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259281
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
We allow animating the mask filters, so we can end up with null filters
sometimes.
TBR=
Change-Id: Id93aa033407f58bfeb5e059210141c936c356701
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256697
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
This reverts commit 3e7af41224.
Change-Id: Id4f66b3956f4bdbe690db20fc478b7365ee89717
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256676
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>