Introduce a PropertyObserver to receive property notifications for layer
and shape nodes.
Properties are communicated using strongly-typed "handles", which act
as impedance adapters between the AE/BM model and the internal Skottie
model.
Bug: skia:
Change-Id: Ieb9be1ff843673f1f4fe900d3774c36956b7c941
Reviewed-on: https://skia-review.googlesource.com/156186
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Sets up a fake web font loader which serves a local/resource font to
the sample text animation.
Also rename resources/skotty/skotty_* -> resources/skottie/skottie_*.
Change-Id: I4af5b24fc3cc5c63c78801979f9be56744047134
Reviewed-on: https://skia-review.googlesource.com/155881
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Web fonts are quite common in Lottie text assets. Expand the
ResourceProvider interface to allow loading of external (web) font data.
Fonts are passed back to Skottie as opaque SkData, and instantiated
using SkFontMgr::makeFromData().
Change-Id: Ia4c994bd60e6a3bd47c90172c267ed5f897a38e4
Reviewed-on: https://skia-review.googlesource.com/155601
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
PS1 reverts commit 6c8d242b14.
PS2 uses an SkMutex for thread safety.
Change-Id: I9318f92cc028844b3dc5a99a00282c2762057895
Reviewed-on: https://skia-review.googlesource.com/155060
Reviewed-by: Mike Klein <mtklein@google.com>
Use sk_ieee_float_divide to silence UBSAN.
(note: the result is already checked to be finite)
Bug: skia:10041
Change-Id: I97d1d6f84926b7162ed636be7afd052ca42d8e81
Reviewed-on: https://skia-review.googlesource.com/155165
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Matrix nodes are most often not composed outside of the DAG. Split into
a basic Matrix class and a (private) ComposedMatrix subclass.
TBR=
Bug: skia:8340
Change-Id: I3c182e10ae5fa20d0639c1031523dba3956b75bb
Reviewed-on: https://skia-review.googlesource.com/153883
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Replace sksg::Group::shrink_to_fit() with a factory accepting an
externally-built children array.
This provides more control for clients (e.g. reserve() instead of
shrink_to_fit()).
Change-Id: Iad587435e0e9da15251a9d3bc2510ca945950b5d
Reviewed-on: https://skia-review.googlesource.com/152861
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
Pulling this off requires deferring the group creation until after we've
resolved all the draws. Doable, but somewhat tricky due to the
interaction with the dangling/uncommitted animator logic.
TBR=
Bug: skia:8340
Change-Id: Id00c841152bd80330751db45f6b26462efc844a5
Reviewed-on: https://skia-review.googlesource.com/152860
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Most of the time when doing fallback there is a simple ping pong between
the requested font and a given fallback font. Use the fallback entry as
a cache of one. This greatly speeds up the example layout.
In the future more work will be done on caching.
Change-Id: I3efe819d6d08d096715cf505cc8d894a282a745b
Reviewed-on: https://skia-review.googlesource.com/151100
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Skia's containers grow too aggressively, stick to STL containers for
reduced head overhead.
Also introduce Group::shrink_to_fit() to be used when clients know they
are done adding children to a group.
TBR=
Bug: skia:8340
Change-Id: I842db2e80c7cfb65a462e4859af6e63496863a5c
Reviewed-on: https://skia-review.googlesource.com/151161
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Only initialize a default font manager when needed.
Change-Id: I3473804d426f1f4981f3727d3539303fb670cdd1
Reviewed-on: https://skia-review.googlesource.com/150840
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
SkTArray is not a good choice for tigh allocations:
- its minimum allocation count is 8
- reserve(sz) doesn't adjust capacity to the exact value, but padds
the same way as normal growth (max(sz, 8, 50%))
- no shrink_to_fit() function to trim unneeded capacity
Since keyframed properties with a small number of frames are quite
common in Lottie, this adds significant heap overhead.
Switch to std::vector(), reserve() to the estimated frame count and
shrink_to_fit() when done parsing.
Bug: skia:8340
Change-Id: Id575e2da2fd17537948c2b38485a8accdb9f7a8b
Reviewed-on: https://skia-review.googlesource.com/150905
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
On the demo page, we use the skia-cdn bucket to hopefully
have better performance than unpkg.
Additionally, on the demo page, we default to using the
WASM version if supported by the browser.
Docs-Preview: https://skia.org/?cl=150904
Bug: skia:8216
Change-Id: I901016e95b8d66803053680691aac4d314821d18
Reviewed-on: https://skia-review.googlesource.com/150904
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
The -Lottie bot runs with --nonativeFonts so, for some animations that
request a specific font (e.g. Helvetica), this would fail, but not
fallback to an actual font manager.
This makes sure we at least have some text, even if it's the "wrong"
font.
Bug: skia:8298
Change-Id: Ibce7fda5b0a82fc3a708ab1cf5a7a394484ca89e
Reviewed-on: https://skia-review.googlesource.com/150468
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
In the presence of time remapping, time start/stretch values appear to
be ignored.
TBR=
Change-Id: I6a4dcc107f2d0fc6361f91ba4f4643e33da37d93
Reviewed-on: https://skia-review.googlesource.com/149701
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
-- introduce a new animatable value (TextValue)
-- introduce a new adapter (TextAdapter) to translate Lottie text props to SG text props
-- use existing animated property-bind machinery and the new constructs when parsing text layers
Change-Id: Ibbfb69daf5b0a3c9a5ce8d1ccdeedca5b5d0fa6f
Reviewed-on: https://skia-review.googlesource.com/149266
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Constant keyframes currently requiere an "h" property/marker.
In order to support keyframed text parsing, relax this to consider any
keyframe missing an end value as constant.
TBR=
Change-Id: Idf332dc0174ee0ee6773708518a0bbc284f8860f
Reviewed-on: https://skia-review.googlesource.com/149265
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Plumb AnimationBuilder throught a bazillion layers to make it reachable
when parsing animatable values.
This is in preparation of keyframed text, which will require access to
the font set when parsing.
Refactor only, no functional changes.
TBR=
Change-Id: Ide2ef2ba66fbcc75fdcc785f987b364d45dff5b6
Reviewed-on: https://skia-review.googlesource.com/149264
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Update the ResourceProvider interface to inherit from SkRefCnt, to
clarify sharing/ownership semantics in the Skottie Builder API. Now it
follows the same pattern as SkFontMgr.
Change-Id: I7ff8ad39023d9ecfe609e0180b5aabf776672d48
Reviewed-on: https://skia-review.googlesource.com/148991
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Allow embedders to pass a font manager.
In order to avoid excessive factory API clutter, introduce an
Animation::Builder helper to wrap factory options.
Also clean up various bits:
* hoist scene parsing out of the Animation ctor
* store the animation duration explicitly (instead of unused fps)
* plumb const SkFontMgr& internally (instead of a ref)
Change-Id: I3e180dfa85ba18c8462cfeb5a7385bef985ed6c4
Reviewed-on: https://skia-review.googlesource.com/148800
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
* introduce AnimationBuilder to hold mostly immutable (modulo caching)
state
* split the scoped animator state into AnimatorScope
This will facilitate splitting the monolithic Skottie.cpp in follow-up
CLs.
Refactoring only, no functional changes.
TBR=
Change-Id: I0a8295e60be4559586fc4a9fea3dee4a7f5714d4
Reviewed-on: https://skia-review.googlesource.com/148390
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
The "closed" shape property cannot be interpolated -- so ensure we catch
different values in interpolation pre-checks.
Bug: skiai:8264
Change-Id: If2c7e09c1227b0013acba3833c314e0646715d52
Reviewed-on: https://skia-review.googlesource.com/147967
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Still loads to do. For now just draws trivial text nodes using a default fontmgr.
Change-Id: I7343b648726d2c4f376f43437f6ae1377ad8ba86
Reviewed-on: https://skia-review.googlesource.com/147465
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Use the SkJSON conversion idiom instead of ParseDefault<SkString>.
Change-Id: Ieeadb86891602eaef2ecf5b68a4eb17b4897e8f7
Reviewed-on: https://skia-review.googlesource.com/147103
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
ScopedRenderContext tries really hard to avoid unnecessary RenderContext
initializations.
This is most likely unneeded because
a) the structure is quite lightweight
and
b) all ScopedRenderContext instantiation sites imediately call setters
which require a writable context (assuming no-op args are uncommon)
Let's get rid of that over-engineered gunk.
Bug: skia:
Change-Id: Ieedc20c63c66b4d43744359e881c20639654040c
Reviewed-on: https://skia-review.googlesource.com/146761
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Current impl can underflow int due to unchecked arithmetic.
Add a Parse<size_t> specialization and convert call sites which use
inline arithmetic. Underflowing unsigned types should be well defined
and caught in later tests.
Bug: oss-fuzz:9798
Change-Id: Iaebe8aad4009e2511fe1d8733d336f5f119bb384
Reviewed-on: https://skia-review.googlesource.com/146648
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Use the deferred paint override mechanism, similar to opacity.
Change-Id: I78fa7f5d73ef333480ec72b0cb663819b1de2404
Reviewed-on: https://skia-review.googlesource.com/146527
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
What is left of the SkView system is used only by samples or viewer.
As a result, move it out of the Skia source tree and re-organize so it
is a bit easier to understand and use more shared code.
Move samplecode/ClockFaceView.cpp to samplecode/SampleTextEffects.cpp,
sice that's what's actually in it.
Move SkAnimTimer.h to tools/timer, since it's actually shared between gm
and samples.
Change-Id: I55dafd94c64e4f930ddbd19168e0f812af86c455
Reviewed-on: https://skia-review.googlesource.com/146161
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Move SkTextBlobBuilder::allocRunText* to private: for the time
being, to reduce the documented interface footprint.
No code is deleted; the functions may be restored when a
client is ready to call them.
Also, add SkTextBlob::MakeFromString to complement
SkTextBlob::MakeFromText.
R=halcanary@google.com,fmalita@google.com
TBR=reed@google.com
Bug: skia:6818
Change-Id: If09d4da4ce38b680d73f25d187e3d06eeb0ec652
Reviewed-on: https://skia-review.googlesource.com/146521
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Cary Clark <caryclark@skia.org>
- plumb a RenderContext RenderNode::render() argument to track pending
opacity
- defer opacity application until we can determine whether a layer is
required (group with multiple children) or the opacity can be pushed
onto the draw paint (for single/atomic draws)
Bug: skia:
Change-Id: I962ba08bad780395d5d738307bde986e9efa502b
Reviewed-on: https://skia-review.googlesource.com/146445
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
* reserve SkPath storage to avoid incremental allocations
* refactor eval() to avoid copying data when interpolation is not
triggered
Change-Id: I467affbbfd652e8fa2a486acab7d6c7b9165d49f
Reviewed-on: https://skia-review.googlesource.com/146166
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
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>
This makes it easier to see what ties this module to Skia.
Change-Id: I392ae4f89fb1afe9193bdb2fda95036f4f5623ed
Reviewed-on: https://skia-review.googlesource.com/145882
Commit-Queue: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
This allows correct shaping across any run breaks.
Change-Id: Ib305bd974ccee2471b1dfe8bd895fb28e475177f
Reviewed-on: https://skia-review.googlesource.com/145726
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Overwrite the layer content color with a color filter.
TBR=
Change-Id: I39f920225affb2641cc11ab1f0c1456d89b47cb7
Reviewed-on: https://skia-review.googlesource.com/145730
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
... and funnel all existing factories through the new one.
Change-Id: I01ffb95abf178eacc0ad430e730d680800a509c7
Reviewed-on: https://skia-review.googlesource.com/145428
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Create new header and namespace, `SkUTF` where we are putting all of our
robust, well documented UTF-8, UTF-16, and UTF-32 functions:
`SkUTF::{Count,Next,To}UTF{8,16,32}()`.
SkUTF.h and SkUTF.cpp do not depend on the rest of Skia and are suitable
for re-use in other modules.
Some of the old UTF-{8,16} functions still live in SkUtils.h; their use
will be phased out in future CLs.
Also added more unit testing and cleaned up old tests.
Removed functions that were unused outside of tests or used only once.
Change-Id: Iaa59b8705abccf9c4ba082f855da368a0bad8380
Reviewed-on: https://skia-review.googlesource.com/143306
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Similar to saving PNG frames, now we can save SKPs.
TBR=
Change-Id: I5791b564a1d3e70424e45e62034e559e677795f1
Reviewed-on: https://skia-review.googlesource.com/141320
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
When all matrix properties are static/default, we simply discard the
matrix node. But we cannot do that in the presence of a parent matrix.
TBR=
Change-Id: I56c62216f18786249dea063690261bfae83fabec
Reviewed-on: https://skia-review.googlesource.com/141127
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
The adapter apply() method can get called before stops resolution, so
only log when some stops are present.
TBR=
Change-Id: I8e336e2cff781a0e64de31e6b63f3cf373b2daa0
Reviewed-on: https://skia-review.googlesource.com/140245
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Some tranform properties are not optional, but many of them are static
identity. Detect these cases and don't attach SG nodes for them.
Reduces the number of sksg::Matrix nodes by ~18%.
TBR=
Change-Id: Ia51c865d6928e8c48c73b30f6d45541caf334880
Reviewed-on: https://skia-review.googlesource.com/140186
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
We already have a clip optimization when there is only one opaque mask.
Extend to cover multiple opaque masks, using Merge scene nodes.
TBR=
Change-Id: I24b61f0c0d080b13438c6777e98a8e2fefd09fdd
Reviewed-on: https://skia-review.googlesource.com/140002
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
The fill type is not reflected in shape keyframes, but it is tracked in
the scene graph. Make sure we don't overwrite when interpolating.
TBR=
Change-Id: I281a61c3f4181ce34f772b36b83d0c7a64e265f6
Reviewed-on: https://skia-review.googlesource.com/139176
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
- plumb the framerate in AttachContext (needed for remapping)
- expand CompTimeMapper to handle time remapping (in addition to
time start, time stretch)
TBR=
Change-Id: If33bae7b4fe224f45d5a094a47899b9025827991
Reviewed-on: https://skia-review.googlesource.com/138990
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
We currently drop static split-position adapters without commiting the
value to the scene graph.
TBR=
Change-Id: Id5852da35345fa58ecaf6c752456ecb32e5b405a
Reviewed-on: https://skia-review.googlesource.com/136782
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Minor cleanup: BindProperty reports whether a non-default property was
applied or bound for animation -- use this mechanism to detect
fully-opaque masks.
TBR=
Change-Id: I3bd9429842621309d0c6bd966ef748917e498c66
Reviewed-on: https://skia-review.googlesource.com/136623
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
We currently apply start-time/stretch-time adjustments to the referenced
composition AND to the referencing layer local properties. That last
part is incorrect: the adjustment should only apply to the referenced
composition.
Introduce a specialized composition time mapper to handle t adjustments,
and push the logic down to AttachCompLayer (and out of the generic
AttachLayer).
TBR=
Change-Id: I0ddb86232010a8e7cdac6524aef2eea5823e306d
Reviewed-on: https://skia-review.googlesource.com/136166
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Some BM versions wrap point values as single or even multi-element arrays.
Parse<SkScalar> already handles the former case - we can extend that
behavior to also cover the latter and simplify Parse<SkPoint>.
TBR=
Change-Id: I2152928944f43dc03a5d8f0d65865ac43974fd7a
Reviewed-on: https://skia-review.googlesource.com/135800
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
It's a tiny, core-ish component -- might as well treat as such to
simplify dependencies.
Change-Id: I6f31ce2d151f9a629d88bfc7f15d64891d5150c0
Reviewed-on: https://skia-review.googlesource.com/135780
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
When possible, load 8 chars and mask out the tag and \0 terminator.
~19% faster on a Z840, ~5% faster on a PixelC.
Change-Id: I12d4b7d86c92c887b00f5d2480d3ff05a7042df1
Reviewed-on: https://skia-review.googlesource.com/135624
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
Use std::swap instead. It does not appear that any external user
specializes SkTSwap, but some may still use it. This removes all use in
Skia so that SkTSwap can later be removed in a smaller CL. After that
the <utility> include can be removed from SkTypes.h.
Change-Id: If03d4ee07dbecda961aa9f0dc34d171ef5168753
Reviewed-on: https://skia-review.googlesource.com/135578
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
We currently blow through string chars without checking for end-of-input.
Maybe we could avoid this upfront, when we locate the stop char: try to
determine if it's part of an unterminated string, fail immediately if
so. Figuring out if the tail is an unterminated string seems
intractable though (requires arbitrarily deep tail parsing).
That brings us to plan B:
* treat scope-closing tokens (} & ]) as string terminators
(we know end-of-input points to one of these for sure)
* adjust matchString() to check for end-of-input
Bug: oss-fuzz:8899
Change-Id: Ic0a88a405548e8724b76faca525099a7e7037341
Reviewed-on: https://skia-review.googlesource.com/135145
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
The input is not guaranteed to contain well-formed scopes, so it's not
sufficient to check for end-of-stream only when popping the top-level
scope -- we have to check on every scope pop.
Bug: oss-fuzz:8898
Change-Id: I7399a8872187ec6714672cac2ff8fc7fbf3c2dfe
Reviewed-on: https://skia-review.googlesource.com/135059
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
1) skip redundant \0 terminator => Value is always zero-initialized
2) skip storing a len record => strlen is cheap for short strings
Change-Id: I3c10c9b9cf6155b95124e2c0194c59e9531a7ca4
Reviewed-on: https://skia-review.googlesource.com/135049
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Pass an explicit input size instead of requiring a C string.
Thanks to mtklein's clever trick, this has no measurable perf impact.
TBR=
Change-Id: Ic8cb1dc75f4d0814e5b2c80038d1b8d3a7b072ab
Reviewed-on: https://skia-review.googlesource.com/134946
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
ASAN opines that a nullptr memcpy dest is undefined behavior, even when
n == 0. ASAN may be right.
This doesn't occur internally, in the parser, but can be triggered with
the DOM builder API (as do some tests currently).
We could say "don't do that", but if someone wants to build an empty
string/array/object, it's kind of awkward to force them to provide a
valid source pointer instead of simply e.g. Array(nullptr, 0).
So let's guard for this case to make ASAN happy.
Change-Id: If12e39f5eb8b273f22bbb0b5fce3321bf6482173
Reviewed-on: https://skia-review.googlesource.com/134944
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Pass an explicit input size instead of requiring a C string.
Thanks to mtklein's clever trick, this has no measurable perf impact.
Change-Id: I64f210a9f653a78b05ab6b58fa34479504aa35ff
Reviewed-on: https://skia-review.googlesource.com/134940
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
* move most common accessor methods to the header, for inlining
* drop the lazy type checking semantics in favor of explicit guarded/unguarded
conversions
* revisit the public class hierarchy to better constrain type-bound APIs
* expose public type factories and add tests
* drop the empty-vector optimization -- allocating an external size_t in these
uncommon cases is better than paying for a conditional on every access.
TBR=
Change-Id: Ic609bb74f12cad1756865a2489ad56c03ecc5494
Reviewed-on: https://skia-review.googlesource.com/134845
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
This reverts commit 03b68421ca.
Reason for revert: Broke Debian9 builds
Original change's description:
> [skjson] Implementation/API tweaks
>
> * move most common accessor methods to the header, for inlining
> * drop the lazy type checking semantics in favor of explicit guarded/unguarded
> conversions
> * revisit the public class hierarchy to better constrain type-bound APIs
> * expose public type factories and add tests
> * drop the empty-vector optimization -- allocating an external size_t in these
> uncommon cases is better than paying for a conditional on every access.
>
> Change-Id: I24a7c75db3aa8b12c740c77ac7df4af4e3a1dff8
> Reviewed-on: https://skia-review.googlesource.com/134610
> Commit-Queue: Florin Malita <fmalita@chromium.org>
> Reviewed-by: Mike Klein <mtklein@google.com>
TBR=mtklein@google.com,fmalita@chromium.org
Change-Id: I2c681ef5c8d5fc15508e58b4b0f6ab9491b7d76f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/134880
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
* move most common accessor methods to the header, for inlining
* drop the lazy type checking semantics in favor of explicit guarded/unguarded
conversions
* revisit the public class hierarchy to better constrain type-bound APIs
* expose public type factories and add tests
* drop the empty-vector optimization -- allocating an external size_t in these
uncommon cases is better than paying for a conditional on every access.
Change-Id: I24a7c75db3aa8b12c740c77ac7df4af4e3a1dff8
Reviewed-on: https://skia-review.googlesource.com/134610
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
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>
Module-related functionality is not required in dm/bench at this point.
Let's disable module deps flattening for now. As an immediate benefit
we can reduce the deps visibility for some internal skjson targets.
Bug: skia:8061
Change-Id: I0e09208964ca94b519121207ba1b6225059ef573
Reviewed-on: https://skia-review.googlesource.com/133822
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
For now this is only wired to a bench and a couple of tests.
Local numbers, for a ~500KB BM "compressed" json:
micros bench
2456.54 json_rapidjson nonrendering
1192.38 json_skjson nonrendering
Change-Id: I7b3514f84c7c525d1787722c43ad6095e3692563
Reviewed-on: https://skia-review.googlesource.com/127622
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
This reverts commit ba2f82986f.
Reason for revert: This is going to be hard to maintain long-term. I've fixed the python script to handle this case: https://skia-review.googlesource.com/c/skia/+/131580
Original change's description:
> Rename sg tests and samples targets to fix Visual Studio name conflict
>
> GN was emitting projects for the SG versions of tests and samples, which
> conflicted with the top-level versions of those. This made the normal GN
> VS IDE files confusing, and the merged ones totally broken.
>
> Change-Id: Ifd048258d4358ed2852d5263b16278c5b8ebd9c4
> Reviewed-on: https://skia-review.googlesource.com/131391
> Commit-Queue: Brian Osman <brianosman@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Commit-Queue: Florin Malita <fmalita@chromium.org>
> Auto-Submit: Brian Osman <brianosman@google.com>
> Reviewed-by: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
TBR=jvanverth@google.com,brianosman@google.com,fmalita@chromium.org,fmalita@google.com
Change-Id: I25553fdcfd063c920635fe1bd71553b578d0b0c8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/131600
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
The constness on null_provider causes:
"default initialization of an object of const type
'const NullResourceProvider' without a user-provided default constructor"
See https://stackoverflow.com/a/47368753 for more.
TL;DR; clang 3.8 and older is not happy
Bug: skia:
Change-Id: Icfc38680163c3bd4952c0e35551706cad8dbfee6
Reviewed-on: https://skia-review.googlesource.com/131521
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
GN was emitting projects for the SG versions of tests and samples, which
conflicted with the top-level versions of those. This made the normal GN
VS IDE files confusing, and the merged ones totally broken.
Change-Id: Ifd048258d4358ed2852d5263b16278c5b8ebd9c4
Reviewed-on: https://skia-review.googlesource.com/131391
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Most of the existing clients don't care about nested resources.
Change-Id: Ie7991dd25ebbd679b5b49e5624772c7e19e7ec79
Reviewed-on: https://skia-review.googlesource.com/131141
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Update the script to search for headers in both 'sources' and 'public'.
Change-Id: I195c6e3720f3d3d99dea04628388821a58fa791b
Reviewed-on: https://skia-review.googlesource.com/130823
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
* 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>