This proposal makes sense to me. Though I feel
BACKGROUND_COLOR_ANIMATION may be too specific. How about just
DYNAMIC_DRAWING, which works similar to DrawingDisplayItem except the
actual drawing is driven by some impl-side driver?
Then for your second question, I think we need to make a few decision
first before a conclusion can be reached:
* Should background color animation be a compositing trigger? (i.e.
cause a CompositedLayerMapping to be created for that element?)
* Should there ever be main-thread-driven background color animation?
(as opposed to always driven by cc impl-side)
In my opinion, answer to both questions should be no. And the
implication is that:
- One layer may contain multiple dynamic drawing items
- Dynamic drawing items don't need to be at the beginning of a layer's item list
Now back to your question. We have existing mechanism to lookup
ElementId from AnimationPlayer, where ElementId is an unique handle
for the DOM element that owns an animation object.
Currently in SPv1 it is guaranteed that each ElementId will map to one
or zero Layer/LayerImpl. This is likely going to change in SPv2, so
that ElementId will map to property nodes.
Either way, animation_player->element_id() won't be powerful enough
for your use case, because the element that's animating its background
color may not necessarily create a layer.
Conceptually the animation subsystem should not know about layer
stuffs, however, for invalidating tiles as background color mutates,
someone needs to know which LayerImpl owns the animated display item.
I think each DynamicDrawingDisplayItem should have an animation_id
that maps to a cc::Animation. At commit time, LayerTreeHostImpl should
maintain a mapping from animation_id to a (layer_id,
display_item_index) pair for each DynamicDrawingDisplayItem it saw.
----
There are other subtleties need to be worried about.
1. How do we throttle BG animation? Because animating BG induces tile
invalidation, it needs to be done on the pending tree, how do we avoid
starving (pending tree never gets ready due to chasing a moving
target)?
2. How does it work when a BG animation shares a timeline with
non-raster-inducing animations? (i.e. one animation applies on pending
tree, the other applies on active tree, but both need to apply
synchronously)
3. Opaque layers that have partial pixels due to contents scale are
overfilled with "safe opaque background color". Should we animate that
as well?
> --
> You received this message because you are subscribed to the Google Groups
> "paint-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
paint-dev+...@chromium.org.
> To post to this group, send email to
pain...@chromium.org.
> To view this discussion on the web visit
>
https://groups.google.com/a/chromium.org/d/msgid/paint-dev/CALRxhAuGuU%3DC6AYOURJKEWjAOu29qZnjThd%3DSw3FH04BCd1YKw%40mail.gmail.com.