Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@JsouLiang
Copy link
Contributor

The UIView's opaque property will inform the UIViews color blend, for example the parent is Red and subview is Green,
when the subview's alpha not equal 1.0, then iOS GPU will blend the color: Result = Source + Destination * (1 - SourceAlpha)

Result: is the blended color
Source: is the top of texture color: green
Destination: is the bottom of texture color: red
SourceAlpha: is the subView alpa

If the FlutterView opaque = YES and when it subView has translucent pixel that rendering out may have jagged black edges.
So I change the FlutterView opaque = NO to make blend alpha correctly.
And you can use this project to check the effect: https://github.com/JsouLiang/platform_blend_test

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@JsouLiang
Copy link
Contributor Author

cc @cyanglaz

@chinmaygarde
Copy link
Member

Isn't this the same as -[FlutterViewController setViewOpaque:NO] which seems to be a public API? Is that API not adequate for some reason?

@JsouLiang
Copy link
Contributor Author

Isn't this the same as -[FlutterViewController setViewOpaque:NO] which seems to be a public API? Is that API not adequate for some reason?

yes, I know this API, I don't use this api case by i feel I was want change the FlutterView default property value.

@cyanglaz
Copy link
Contributor

@dnfield #6447 seems to be the first time we default ViewOpaque to YES. I know it is long time ago but did you remember why we did this? Will there be a regression if set _viewOpaque to No by default?

@dnfield
Copy link
Contributor

dnfield commented Jan 19, 2022

I think it was to make things consistent with Android. There also might hav ebeen some performance related concerns, but I don't remember there being any benchmark changes for this.

That said, this patch needs a test.

@JsouLiang
Copy link
Contributor Author

JsouLiang commented Jan 20, 2022

Do we have benchmark tests which can test this change?

@dnfield
Copy link
Contributor

dnfield commented Jan 20, 2022

I'd try running some devicelab iOS tests with and without this change, e.g. flutter_gallery__transitions_perf

@cyanglaz
Copy link
Contributor

@JsouLiang I think the benchmark already exists, but we also need tests to make sure this value is set to NO if we are going to land this.

@JsouLiang
Copy link
Contributor Author

@cyanglaz yes, I think so, we need to verify the impact of this change on performance. And is the benchmark test on the remote CI?

@dnfield
Copy link
Contributor

dnfield commented Jan 20, 2022

@JsouLiang I strongly doubt this will impact any benchmark we have, and if it does impact a benchmark unexpectedly we can always revert it. I wouldn't worry too much about the benchmark. However, we do want a unit test (probably one in https://github.com/flutter/engine/blob/master/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm) that tests that this behavior is as expected.

@dnfield
Copy link
Contributor

dnfield commented Jan 20, 2022

It would probably be good to have a golden test that verifies we don't regress the alpha blending this fixes as well, but that may be harder to do particularly in the engine repo.

@JsouLiang
Copy link
Contributor Author

So what should I do?

@JsouLiang
Copy link
Contributor Author

@dnfield I think this change doesn't add test, because we can't be sure there are show 'border'. If you in iPhone see the border and you snapshot screen the picture is no border.

@cyanglaz
Copy link
Contributor

@JsouLiang For this particular change, you can add an unit-test to check if _viewOpaque is set to NO by default. Can the flutter driver screenshot generate a screenshot that shows the borders?

@JsouLiang
Copy link
Contributor Author

@cyanglaz Hey, my phone is iPhoneXsMax. And I run the demo which has render border, then I use flutter snapshot -d .... to snapshot the screen the result is no border in the picture. Here is :
flutter_01
but the device has border.

@JsouLiang
Copy link
Contributor Author

@cyanglaz hey, the pr has any progress?

@dnfield
Copy link
Contributor

dnfield commented Jan 24, 2022

@JsouLiang - I think at this point we're waiting for a unit test to be added as suggested #30664 (comment)

@JsouLiang JsouLiang force-pushed the iOS-UIKitView-Render-Issue branch 4 times, most recently from 2d7a0a7 to 47d1f7d Compare January 25, 2022 08:03
@dnfield dnfield requested a review from gaaclarke January 25, 2022 18:58
@chinmaygarde
Copy link
Member

@dnfield The test has been added as requested. Are you able to review the same?

@JsouLiang JsouLiang force-pushed the iOS-UIKitView-Render-Issue branch from 47d1f7d to badc8a4 Compare February 9, 2022 10:13
@JsouLiang
Copy link
Contributor Author

@cyanglaz hey, I think you are right, and i add a new test case. please help me review it, thanks.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 21, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 21, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 21, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 21, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 21, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 21, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 22, 2022
jason-simmons added a commit to jason-simmons/flutter_engine that referenced this pull request Feb 28, 2022
@JsouLiang
Copy link
Contributor Author

@cyanglaz @gaaclarke @dnfield I found that this PR causes some performance issues, that's mean we couldn't use this way that change the opaque = NO to fix the UIKitView Render Border issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

platform-ios waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.

Projects

Development

Successfully merging this pull request may close these issues.

5 participants