The Wayback Machine - https://web.archive.org/web/20210907105701/https://github.com/flutter/flutter/pull/89264
Skip to content
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

Make sure Opacity widgets/layers do not drop the offset #89264

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

@dnfield
Copy link
Member

@dnfield dnfield commented Sep 1, 2021

fixes #89255
fixes #71008

Now, instead of dropping the opacity layer when it is either disabled or the value is opaque, it uses an OffsetLayer instead. This avoids some of the memory regression from #83145, because the engine special cases OpacityLayers to always raster cache them, but does not do quite the same with OffsetLayers.

I did see some regression on mean/median on the internal benchmark, but overall the values are still within the range of the change without this PR.

/cc @xster

@skia-gold
Copy link

@skia-gold skia-gold commented Sep 1, 2021

Gold has detected about 4 new digest(s) on patchset 1.
View them at https://flutter-gold.skia.org/cl/github/89264

@skia-gold
Copy link

@skia-gold skia-gold commented Sep 1, 2021

Gold has detected about 1 new digest(s) on patchset 2.
View them at https://flutter-gold.skia.org/cl/github/89264

@skia-gold
Copy link

@skia-gold skia-gold commented Sep 1, 2021

Gold has detected about 1 new digest(s) on patchset 3.
View them at https://flutter-gold.skia.org/cl/github/89264

if (enabled)
final int realizedAlpha = alpha!;
// The type assertions work because the [alpha] setter nulls out the
// engineLayer if it would ahve changed type (i.e. changed to or from 255).

This comment has been minimized.

@xu-baolin

xu-baolin Sep 1, 2021
Member

ahve -> have

@@ -208,4 +208,30 @@ void main() {
expect(error, isNull);
debugPaintSizeEnabled = false;
});

test('debugDisableOpacity keeps things in the right spot', () {

This comment has been minimized.

@xu-baolin

xu-baolin Sep 1, 2021
Member

Without this patch, this test can pass also, right?

This comment has been minimized.

@dnfield

dnfield Sep 1, 2021
Author Member

The container gets rendered in the wrong location without this patch

This comment has been minimized.

@dnfield

dnfield Sep 1, 2021
Author Member

Err, sorry - without this change, there'd be no OpacityLayer, the PictureLayer would be the firstChild of rootLayer.

This comment has been minimized.

@xu-baolin

xu-baolin Sep 1, 2021
Member

It passes with the latest master branch.

This comment has been minimized.

@dnfield

dnfield Sep 1, 2021
Author Member

Ahh you are right. This would need to test that the add to scene does the right thing. But the golden test does that without getting into such implementation details. I'll remove this test.

This comment has been minimized.

@xu-baolin

xu-baolin Sep 1, 2021
Member

It isn't bad to remain this ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants