Skip to content

Conversation

@jonahwilliams
Copy link
Contributor

@jonahwilliams jonahwilliams commented Apr 15, 2022

This PR has the goal of allowing render objects which maintain their own composited layer to opt into being repaint boundaries. This requires that the layer be created and managed by the framework and that the layer is an Offset layer subtype. We also add the capability for a repaint boundary to update only its layer properties without repainting its children. This allows the Opacity layers to update or animate their opacity without recreating child pictures, stabilizing the tree without user intervention.

Fixes #101941
Fixes #101597

@flutter-dashboard flutter-dashboard bot added the framework flutter/packages/flutter repository. See also f: labels. label Apr 15, 2022
@jonahwilliams
Copy link
Contributor Author

The latest change allows opacity layers to mark that only their opacity has changed, which allows us to skip rebuilding the child layer. This is required to make the animated switch picture stable without a repaint boundary

@jonahwilliams
Copy link
Contributor Author

@goderbauer it ended up being harder to make markNeedsPaint do the right thing automatically - there are a lot of circumstances where we still need to paint children even if they aren't dirty (aparently) - not to mention we're using RenderObject API here so the existence of children needs to be informed via a new API on RenderObject.

I added a markNeedsX which - if the node is not also marked as needing to be painted - will avoid recreating chiild layers and just update the layer properties

@jonahwilliams jonahwilliams marked this pull request as ready for review April 15, 2022 22:21
@jonahwilliams
Copy link
Contributor Author

i'm marking this ready for review, though I'm aware the tests and documentation need to be improved substantially first.

@jonahwilliams
Copy link
Contributor Author

Also: in order for something like RenderTransform to opt into this we'd need to support swapping out the kind of layer while keeping the children.

const Rect.fromLTWH(0, 0, 500, 500),
);
root.paint(context, const Offset(40, 40));
context.paintChild(root, const Offset(40, 40));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor change: since the RenderOpacity would be a repaint boudary in this case, it would have gone down context.paintChild path to get to compositing correctly

@jonahwilliams
Copy link
Contributor Author

I've added more extensive documentation in #101941 describing the change

engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 28, 2022
egramond pushed a commit to egramond/flutter that referenced this pull request May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

4 participants