This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Conversation
This is needed to avoid jank when resizing an embedded Android view. See flutter/flutter#19572 (comment)
Contributor
Author
|
@chinmaygarde I'm not sure what would be the iOS equivalent of skipping |
Contributor
Author
|
Implemented the freeze for iOS as well, @chinmaygarde want to take a look? |
chinmaygarde
reviewed
Aug 7, 2018
lib/ui/compositing.dart
Outdated
| /// The texture is scaled to the given size and rasterized at the given offset. | ||
| void addTexture(int textureId, { Offset offset: Offset.zero, double width: 0.0, double height: 0.0 }) { | ||
| /// | ||
| /// If `freeze` is true new frames will not be consumed from the texture. |
Contributor
There was a problem hiding this comment.
Can this docstring be more detailed please?
Contributor
Author
There was a problem hiding this comment.
Sure, can you help me by explaining what wasn't clear when you read this?
Contributor
There was a problem hiding this comment.
- Who not consume the textures?
- When should the flag be set?
Contributor
Author
There was a problem hiding this comment.
Thanks, rewrote the comment PTAL.
chinmaygarde
approved these changes
Aug 7, 2018
Contributor
Author
|
Woops had a bad merge fixing |
liyuqian
added a commit
to liyuqian/flutter
that referenced
this pull request
Aug 7, 2018
b3e866e Call drawPath without clip if possible (flutter/engine#5952) 7e0bb3b Allow freezing a texture. (flutter/engine#5938) 3cbb5e2 Persist DartCallbackCache contents across launches (flutter/engine#5947) 953570a libtxt: truncate paragraph width to an integer in order to match Blink's behavior (flutter/engine#5962)
amirh
added a commit
to amirh/flutter
that referenced
this pull request
Aug 8, 2018
Resizing an AndroidView happens asynchronously (as it requires thread hopping from the ui thread to the platform thread). While waiting for the resize to complete the framework does exactly when the embedded view has been resized. This leads to pretty bad jank as the framework might paint the embedded view with a wrong size. We're working around this by freezing the texture frame while resizing until we are sure that the next frame has the new size. This is how it looks with the workaround: This is how it looks before and after the workaround: Before (janky) | After (less janky) :--------|---------:  |  This depends on flutter/engine#5938. Additionaly right now the engine completes the resize call immediately, a following PR will change it to complete after a frame with the new size is ready.
amirh
added a commit
to flutter/flutter
that referenced
this pull request
Aug 8, 2018
Resizing an AndroidView happens asynchronously (as it requires thread hopping from the ui thread to the platform thread). While waiting for the resize to complete the framework does exactly when the embedded view has been resized. This leads to pretty bad jank as the framework might paint the embedded view with a wrong size. We're working around this by freezing the texture frame while resizing until we are sure that the next frame has the new size. This is how it looks with the workaround: This is how it looks before and after the workaround: Before (janky) | After (less janky) :--------|---------:  |  This depends on flutter/engine#5938. Additionaly right now the engine completes the resize call immediately, a following PR will change it to complete after a frame with the new size is ready.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is needed to avoid jank when resizing an embedded Android view.
See flutter/flutter#19572 (comment) for more details.