d5c42c8c03
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> |
||
---|---|---|
.. | ||
include | ||
samples | ||
src | ||
tests | ||
BUILD.gn | ||
sksg.gni |