`a || b` only evaluates b if a is false. `a | b` always evaluates
both a and b. If a and b are of type bool, `||` is usually what you
want, so clang now warns on `|` where both arguments are of type bool.
In Skia, 3 of 3 uses of `|` were intentional as far as I can tell (one
had an explicit comment, the other two didn't). Rewrite them slightly
to make this intent more clear and to suppress the warning.
There was also one use of `&`. That one looks like a (benign) typo for
`&&`, so change it.
Bug: chromium:1255745
Change-Id: I9ac37075311005c0a8fcb8d1379f516510929423
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459456
Commit-Queue: Nico Weber <thakis@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Auto-Submit: Nico Weber <thakis@chromium.org>
Reviewed-by: Florin Malita <fmalita@google.com>
If text layout fails (e.g. due to unsatisfiable scaling constraints),
log an error to notify clients.
Change-Id: Ic7a028196b3bfb8f45b91c88766f0059145a202f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458722
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
Change-Id: Iffb757bdc8b28d14aae176b1d2448e72ccde7c3f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459116
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
With this CL we can run as:
dm --src gm skp tests --config grmtl -v --nocpu --nogpu
and not get all the non-Graphite unit tests.
Bug: skia:12466
Change-Id: Ib3f04f315fe4b5731a54e4c72979a0c1e00baf24
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457898
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
1) CachingResourceProvider - The immediate user of this is ChromeOS,
but it seems like a generally useful ResourceProvider implementation
that all can use.
2) Animation::Builder - See this CL:
https://chromium-review.googlesource.com/c/chromium/src/+/3171517
It seems that windows builds fail with "undefined reference" linker
errors when trying to use the Animation::Builder directly. My guess
is that this is because the SK_API macro is needed to export it.
Change-Id: Ief39fe6ec03f992a0be73e5be54b0119d2d82930
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458407
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
Classes of issues addressed:
1. static constexpr class variables aren't automatically inline. Already handled in a separate CL
2. Lack of C++17 copy elision means classes of objects constructed at function return need a copy or move constructor even if RVO will mean it isn't called.
3. Nested braced init no longer allowed for base classes of subclasses without constructors.
4. template static constexpr var in template class throws error about redundant initialization. Adding inline and removing defn outside of class fixes it.
5. Some places that should have been including std headers now actually need to include them.
6. No auto template parameters.
7. No lambdas in constexpr funcs.
Bug: chromium:1257145
Change-Id: Icb24c6b4ed039287fb4cf27a21a1bb7dc9821728
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457298
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This is in prep for compiling with -std=c++14 and -Wno-c++17-extensions
when building with clang. Chrome has encountered problems with
third_party headers that are included both in Skia and other Chrome
sources that produce different code based on whether preprocessor macros
indicate a C++14 or C++17 compilation.
In C++17 they are already inline implicitly. When compiling with C++14
we can get linker errors unless they're explicitly inlined or defined
outside the class. With -Wno-c++17-extensions we can explicitly inline
them in the C++14 build because the warning that would be generated
about using a C++17 language extension is suppressed.
We cannot do this in public headers because we support compiling with
C++14 without suppressing the C++17 language extension warnings.
Bug: chromium:1257145
Change-Id: Iaf5f4c62a398f98dd4ca9b7dfb86f2d5cab21d66
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457498
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
In addition to single line (point) text, AE also supports path layout
for paragraph text.
At a high level, the paragraph box top is mapped to the path (following
alignment rules), and each glyph is displaced along its path positioning
vector, post orientation.
The main difference compared to point text, is that the distance on path
is based on the fragment position relative to the paragraph left edge.
The paragraph box also plays a role in alignment: left/center/right
aligns with path start/mid/end.
This includes a tangential optimization: instead of validating cached
contour data in each PathInfo::getMatrix() call, we only check once at
a higher level (onSync) -- to avoid performing a shape vector comparison
for each fragment.
Change-Id: I2c31ce3b0a525a3cd2d4525abcf88d5fc943bb6e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457656
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
"Perpendicular To Path" and "Reverse Path" are animatable in AE, but
used to be exported as static props. Bodymovin is being updated to
export them as animatable now.
Change the parser to handle both cases.
Change-Id: If2fea2a37af7ec6af5ac07c24cfb533bff5e03ca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457736
Auto-Submit: Florin Malita <fmalita@chromium.org>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Current limitations:
-- single-line only (no paragraph box support)
-- "Force Alignment" not supported
-- tracking animators not supported
Change-Id: I4072f1d8280032787c6db7e8b47d6f55be43bddb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/456237
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
The Fill effect has separate "color" and "opacity" components.
In AE, the color chooser does not allow modifying the alpha channel --
the only source for Fill transparency is the opacity property.
Thus, the alpha component of the color property should always be 1.
But in practice, it appears Bodymovin sometimes exports the color with a
zero alpha field (BM always encodes colors as 4-float arrays).
To workaround this issue, update Fill to ignore the color alpha and only
use the explicit opacity.
Change-Id: Ic4bbbc1ac91d255fe14e3261d1ae03340e053ce2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/454856
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Loading an old SKP stops working after a while, so this changes
it to draw something and then deserialize it immediately.
I also noticed that the CPU backend supports atan, so we can
use a more complete example there.
Change-Id: I70bec69d05184c5ea041b143132ddbbd7f63f004
Bug: skia:12439
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/454456
Reviewed-by: Brian Osman <brianosman@google.com>
Some group effects (including layer opacity) are not applied upfront,
via an expensive saveLayer, but are deferred until we can determine
whether they can be folded into an atomic draw's paint (to avoid the
extra layer).
At the moment, the MotionTile custom render node drops all pending
paint effects on the floor (ignores |ctx|). Update to apply via the
shader paint.
Also update a couple of related tests to animate opacity.
Change-Id: I1f5cd2459ec81b170749528e8818d0be598a7ca7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452723
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Bug: skia:12478
Change-Id: I4e2bc1eb441c19d7b4cf2bcea65b852f7f0aa59b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453136
Reviewed-by: Ravi Mistry <rmistry@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
The current HueSaturation effect implementation relies on a simple
HSLA color matrix operation and assumes the controls are linear.
Turns out AE's saturation is more sophisticated, both in implementation
and in control mapping.
Updating the effect to use a chain of specialized color filters:
- keep HSLAMatrix() for hue adjustments
- introduce a custom runtime effect for saturation
(following AE's semantics)
- use a plain Matrix() CF for lightness adjustments
Change-Id: Iba6c9f7fd8c01dc33c1cd00822ea546867c057ac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452976
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Per spec, reading anything other than the most recently written
union member is undefined behavior.
Keyframe containers always access the same member, consistently. But
the type-agnostic equality operator does touch both members.
Refactor to avoid undefined behavior.
Also add a couple of unit tests to capture keyframe deduping behavior
(which in turn relies on the equality operator).
Change-Id: I7ba9c335ef28af7ddc71bd6f03d56b891fbdea1e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/451016
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
Using thread_local on iOS requires iOS 9 or greater. Chrome for iOS
now requires 13, Skia sets the minimum to 11 for test builds, and
Flutter actively does not support 8 or earlier. Dropping support for
iOS 8 in practice and moving to iOS 9 makes it possible to use
thread_local without reservations on iOS.
Change-Id: Ib80cbe24e8154be650f343643281384c17356242
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/447497
Reviewed-by: Heather Miller <hcm@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
This reverts commit 481a58dfe0.
Reason for revert: Fixing the build
Original change's description:
> Revert "Small changes for SkText that are not in experimental directory"
>
> This reverts commit 92f1bc0083.
>
> Reason for revert: Blocking Android roll.
>
> Original change's description:
> > Small changes for SkText that are not in experimental directory
> >
> > (also made utf 8<->16 conversion static on SkUnicode)
> >
> > Change-Id: Ie64d18ad21a35ec10bd0b350fb7887fb78a419d8
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448140
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Julia Lavrova <jlavrova@google.com>
>
> Change-Id: Ieb9eb0495dddfc0f9e9e74861b24efc0201fd520
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448656
> Auto-Submit: Brian Osman <brianosman@google.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Change-Id: I1e5859c9dd943c701d4c4e648bdc3e44412eca54
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448676
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
This reverts commit 92f1bc0083.
Reason for revert: Blocking Android roll.
Original change's description:
> Small changes for SkText that are not in experimental directory
>
> (also made utf 8<->16 conversion static on SkUnicode)
>
> Change-Id: Ie64d18ad21a35ec10bd0b350fb7887fb78a419d8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448140
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>
Change-Id: Ieb9eb0495dddfc0f9e9e74861b24efc0201fd520
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448656
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
(also made utf 8<->16 conversion static on SkUnicode)
Change-Id: Ie64d18ad21a35ec10bd0b350fb7887fb78a419d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448140
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Bodymovin uses tt: [1-4] to encode a layer track matte type, and skips
the property when a track matte is not present.
Flow OTOH uses explicit tt: 0 to signal the absence of a track matte.
Update the parser to not error out on tt: 0.
Change-Id: I2d456ac3479e356ba1fc5320589848f8872775e6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445957
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
fontMgr doesn't export the function named `makeTypefaceFromData`.
it has `**M**akeTypefaceFromData`.
This is an imported pull request from
https://github.com/google/skia/pull/87
GitOrigin-RevId: 7a80a1a7776d0b20810510665f6a3727100bef97
Change-Id: I02eb6a5f406d4448f61266016f9c0882eb59c871
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445804
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Also update RELEASE_NOTES to describe new syntax.
Change-Id: I2666551b98f80b61ae3a48c92a9e306cdc7242b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444735
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
AfterEffects and Bodymovin support an "AllCaps" text flag which forces
text capitalization.
* add toUpper() bindings to SkUnicode/SkICU
* add capitalization options to SkottieShaper
* plumb existing Lottie 'ca' (AllCaps) prop
* also fix a couple of unrelated whoopsies
Change-Id: I8e80921b66530e9830938004946082c6e450b04b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445104
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
This moves the functions for dealing with child effects into the public
module (where those types already live). With that change, blend and
colorFilter have no module-specific declarations.
Change-Id: I7665e68427ea4d8d1ed4d31afb658edb79bac5a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443412
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
These scripts are useful when testing WebAssembly locally
because the mimetype impacts how the binaries are loaded.
The porting was achieved by doing the following:
python -m lib2to3 -w -n serve.py
Change-Id: I09673fa881339a9b157c5fc993e190766efcd85e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443884
Reviewed-by: Erik Rose <erikrose@google.com>