-
Notifications
You must be signed in to change notification settings - Fork 6k
Support opacity layers for platform-views using hybrid-composition #30264
Conversation
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 on the mutator stack code.
I'm not confident enough to review the code related to android paint context.
CC @blasten as the second reviewer.
| Paint transparency = new Paint(); | ||
| transparency.setAlpha((int) (mutatorsStack.getFinalOpacity() * 255)); | ||
| this.setLayerType(LAYER_TYPE_HARDWARE, transparency); |
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.
CC @blasten for confirming this is OK
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.
does it need to create a new Paint object on every draw call? does this work?
In the constructor:
paint = new Paint();
setLayerType(LAYER_TYPE_HARDWARE, paint);onDraw:
paint.setAlpha((int) (mutatorsStack.getFinalOpacity() * 255));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.
seems like this should work from looking at the android code, but please give it a try and confirm
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.
@blasten You're right, we don't need to create the paint object on every draw call.
We do however need to set the layer type every time, moving it into the constructor does not seem to be enough.
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 have updated the code regarding this
|
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold. |
|
@WasserEsser Which golden test are you talking about? Since the opacity is supported in this change, I suppose there should be an updated golden image in the scenario test (https://github.com/flutter/engine/tree/main/testing/scenario_app) in this PR. I didn't see an update on the golden image. |
|
adding @blasten for a 2nd review. |
|
@cyanglaz I was just referring to the comment the flutter bot made about the tests expiring as the PR is somewhat older. |
|
@WasserEsser Ok, so it is unrelated to what I said about the scenario tests then. Are you familiar with the scenario tests? There should be a README to help you set it up. |
|
@cyanglaz Yep, although I couldn't get them to run the last time I've tried. I'll try to create one later tonight. |
|
@WasserEsser Any update on the test? |
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
|
The scenario app tests on Android are currently broken unfortunately. flutter/flutter#90401. There's an opacity test already, but it won't fail because this test was disabled. https://github.com/flutter/engine/blob/main/testing/scenario_app/android/reports/screenshots/dev.flutter.scenariosui.PlatformViewUiTests__testPlatformViewOpacity.png |
|
@blasten Ah that's why I couldn't get them to work. |
|
This pull request is not suitable for automatic merging in its current state.
|
* Revert "Support opacity layers for platform-views using hybrid-composition" (#31002) * Revert "Support opacity layers for platform-views using hybrid-composition (#30264)" This reverts commit 730b469. * Empty * Revert "[fuchsia] Switch from core-jit to core snapshots. (#30744)" (#31065) This reverts commit a193f08. Co-authored-by: Zachary Anderson <[email protected]> Co-authored-by: David Worsham <[email protected]>
* Revert "Support opacity layers for platform-views using hybrid-composition" (#31002) * Revert "Support opacity layers for platform-views using hybrid-composition (#30264)" This reverts commit 730b469. * Empty * Revert "[fuchsia] Switch from core-jit to core snapshots. (#30744)" (#31065) This reverts commit a193f08. Co-authored-by: Zachary Anderson <[email protected]> Co-authored-by: David Worsham <[email protected]>
SceneBuilder opacity layers are not currently supported for Android platform-views using hybrid-composition.
This PR implements it.
Note that even though #58426 mentions opacity being implemented, it does not seem to be the case.
Fixes #93757
Advances #58426
Pre-launch Checklist
///).