-
Notifications
You must be signed in to change notification settings - Fork 6k
PlatformView Blur for Backdrop Filter #34596
Conversation
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm
Outdated
Show resolved
Hide resolved
testing/ios/IosUnitTests/IosUnitTests.xcodeproj/project.pbxproj
Outdated
Show resolved
Hide resolved
testing/ios/IosUnitTests/IosUnitTests.xcodeproj/project.pbxproj
Outdated
Show resolved
Hide resolved
Also need to rebase or merge upstream/main and resolve conflicts. |
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViewsTest.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViewsTest.mm
Outdated
Show resolved
Hide resolved
testing/ios/IosUnitTests/IosUnitTests.xcodeproj/project.pbxproj
Outdated
Show resolved
Hide resolved
testing/ios/IosUnitTests/IosUnitTests.xcodeproj/project.pbxproj
Outdated
Show resolved
Hide resolved
testing/ios/IosUnitTests/IosUnitTests.xcodeproj/project.pbxproj
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
Outdated
Show resolved
Hide resolved
…ng the next PR. Still need to test new method calls.
@cyanglaz Looks like all the comments have been addressed. But @emilyabest, the test failures do look related. |
@chinmaygarde We realized the implementation is missing functionality for multiple backdrop filters and removing backdrop filters. I'm testing that code now and will look into the failing tests after pushing it to the PR. Thanks for looking over the comments! |
3cf0170
to
c4ab9cb
Compare
The scenario test is failing due to blur is implemented in this PR. However, the scenario app uses a none-zero origin for the PlatformView, making the blur not working probably. |
Need to merge #34355 before landing this. |
@cyanglaz Trying to understand the status here. Per your last comment, this patch depends on #34355 which landed but had to be reverted due to flutter/flutter#109831 and now the perf fixes are going to be incorporated here. Is that right? |
Yes, #34355 is now included in this PR with the fix. This PR is now waiting for #35501 to land so the scenario app's backdrop filter blur screenshot can be updated more appropriately in this PR. |
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.
This PR now contains re-landing of #34355 with the fix that the PlatformViews are cleared at the start of each frame + tests.
cc @zanderso Do you mind give it a review?
@LongCatIsLooong I did some change since last LGTM:
- Add the re-land of Pushing BackdropFilter Mutator #34355.
- Add the code that clears the visited_platform_views_ list at the start of a frame + test.
- Updated the screenshot of the scenario app for blurring PlatformView.
} | ||
|
||
- (void)dealloc { | ||
[self.blurEffectView release]; |
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 not reference self in its dealloc state, so
[_blurEffectView release];
_blurEffectView = nil;
@@ -777,6 +805,7 @@ - (BOOL)flt_hasFirstResponderInViewHierarchySubtree { | |||
void FlutterPlatformViewsController::ResetFrameState() { | |||
slices_.clear(); | |||
composition_order_.clear(); | |||
visited_platform_views_.clear(); |
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.
This is the fix for flutter/flutter#109783
@@ -296,6 +1096,86 @@ - (void)testCompositePlatformView { | |||
XCTAssertTrue(CGRectEqualToRect(platformViewRectInFlutterView, CGRectMake(100, 100, 300, 300))); | |||
} | |||
|
|||
- (void)testBackdropFilterCorrectlyPushedAndReset { |
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.
This is the test for This if the fix for flutter/flutter#109783
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.
The objective C part LGTM
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 am not super familiar with this code, but I do see where the list of platform views is being cleared, so rslgtm.
Wait until flutter/flutter#110688 is landed before landing this. |
@@ -43,6 +43,9 @@ void BackdropFilterLayer::Preroll(PrerollContext* context, | |||
const SkMatrix& matrix) { | |||
Layer::AutoPrerollSaveLayerState save = | |||
Layer::AutoPrerollSaveLayerState::Create(context, true, bool(filter_)); | |||
if (context->view_embedder != nullptr) { | |||
context->view_embedder->PushFilterToVisitedPlatformViews(filter_); |
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.
Shouldn't this push the outstanding clips as well? The filter will only be applied to the region inside those clips. More specifically, the output of the filter on the PlatformView will be clipped by the clips.
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.
Yes, it should when we figure out how to filter a specific region inside the PlatformView.
We should have a follow up PR to support filter only a part of the PlatformView (at least a rect), which will fix flutter/flutter#50183
And the clip path should be added to the method in that PR.
Description:
This PR applies a Gaussian Blur filter to PlatformViews. Currently, the blur is applied when transform mutations are called, however this PR will be combined with PR #34355 (Create BackdropFilter Mutator) to blur PlatformViews for the backdrop filter mutator.
Fixed issues:
Fixes: flutter/flutter#109783
Pre-launch Checklist
writing and running engine tests.
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.