-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[skwasm] Scene builder optimizations for platform view placement #54949
Conversation
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approach mostly LGTM but it looks like there are a couple bugs to squash. More comments would be very helpful
@@ -477,6 +597,16 @@ class PlatformViewPosition { | |||
|
|||
bool get isZero => (offset == null) && (transform == null); | |||
|
|||
ui.Rect mapLocalToGlobal(ui.Rect rect) { | |||
if (offset != null) { | |||
return rect.shift(offset!); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to return here? can there be both an offset
and a transform
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose I should add a comment that says this exactly, but either one is set or the other, never both. Or maybe I should just refactor this to have subclasses and stuff.
return rect.shift(offset!); | ||
} | ||
if (transform != null) { | ||
transform!.transformRect(rect); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want rect = transform!.transformRect(rect)
here. Otherwise, this is a no-op.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thank you.
); | ||
} | ||
|
||
int _placePicture(ui.Offset offset, ScenePicture picture) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more documentation would be very helpful to understand what is going on with LayerOperation and LayerSlice and LayerSliceBuilder
something small like "Returns the slice index for [picture] at [offset]. The picture is added to the last slice where it either intersects with a picture in the slice or it intersects with a platform view in the preceding slice. If the picture intersects with a platform view in the last slice, a new slice is added at the end and the picture goes in there." That's very clunky wording which could be improved a lot but basically a comment explaining what this method is trying to do would be helpful in understanding the purpose of the slices and how we are trying to optimize.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, I'll add some comments.
} | ||
sliceIndex--; | ||
} | ||
if (sliceIndex == sceneSlices.length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
impossible to hit this condition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, I should remove this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
A reason for requesting a revert of flutter/engine/54949 could |
Reason for revert: Incorrect golden diffs on engine roll, see flutter/flutter#155181 |
…ment (#54949)" (#55193) Reverts: #54949 Initiated by: eyebrowsoffire Reason for reverting: Incorrect golden diffs on engine roll, see flutter/flutter#155181 Original PR Author: eyebrowsoffire Reviewed By: {harryterkelsen} This change reverts the following previous change: This PR refactors the scene builder's logic in order to more aggressively merge flutter content and platform view content together. This essentially covers the case discussed in this flutter issue: flutter/flutter#149863 This optimization ensures that each picture or platform view is applied to the lowest possible slice in the scene, which avoids the proliferation of redundant slices and overlays in the scene.
…155194) flutter/engine@ab9daaa...4d8d851 2024-09-14 [email protected] Synthesize remove events on `PointerChange.ACTION_UP` and `PointerChange.ACTION_POINTER_UP` (flutter/engine#55157) 2024-09-13 [email protected] Roll Skia from bdc5e73cb6c9 to 2b8e33aa4824 (1 revision) (flutter/engine#55192) 2024-09-13 [email protected] Roll Dart SDK from 302b6472b849 to c0f7e399ff4a (1 revision) (flutter/engine#55191) 2024-09-13 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[skwasm] Scene builder optimizations for platform view placement (#54949)" (flutter/engine#55193) 2024-09-13 [email protected] Delete VolatilePathTracker in favor of Dispatch tracking (flutter/engine#55125) 2024-09-13 [email protected] Roll Fuchsia Linux SDK from 3YH1DEYJ-s93fHBw5... to -kKh_AYzPh_iEmTxK... (flutter/engine#55190) 2024-09-13 [email protected] Roll Skia from 9877f459399a to bdc5e73cb6c9 (1 revision) (flutter/engine#55189) 2024-09-13 [email protected] [impeller] add Android flag for disabling surface control for debugging. (flutter/engine#55185) 2024-09-13 [email protected] Roll Skia from a5a6d12b3642 to 9877f459399a (2 revisions) (flutter/engine#55187) 2024-09-13 [email protected] Roll Dart SDK from eb664303c5ff to 302b6472b849 (2 revisions) (flutter/engine#55182) 2024-09-13 [email protected] [skwasm] Scene builder optimizations for platform view placement (flutter/engine#54949) 2024-09-13 [email protected] add back test itSendsTextShowPasswordToFrameworkOnAttach with new mock for display metrics (flutter/engine#55110) Also rolling transitive DEPS: fuchsia/sdk/core/linux-amd64 from 3YH1DEYJ-s93 to -kKh_AYzPh_i If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This PR refactors the scene builder's logic in order to more aggressively merge flutter content and platform view content together. This essentially covers the case discussed in this flutter issue: flutter/flutter#149863
This optimization ensures that each picture or platform view is applied to the lowest possible slice in the scene, which avoids the proliferation of redundant slices and overlays in the scene.