Unverified Commit 048baa75 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Always push layer for RenderAnimatedOpacityMixin (#83145)

parent 4562cce4
...@@ -993,7 +993,7 @@ mixin RenderAnimatedOpacityMixin<T extends RenderObject> on RenderObjectWithChil ...@@ -993,7 +993,7 @@ mixin RenderAnimatedOpacityMixin<T extends RenderObject> on RenderObjectWithChil
_alpha = ui.Color.getAlphaFromOpacity(opacity.value); _alpha = ui.Color.getAlphaFromOpacity(opacity.value);
if (oldAlpha != _alpha) { if (oldAlpha != _alpha) {
final bool? didNeedCompositing = _currentlyNeedsCompositing; final bool? didNeedCompositing = _currentlyNeedsCompositing;
_currentlyNeedsCompositing = _alpha! > 0 && _alpha! < 255; _currentlyNeedsCompositing = _alpha! > 0;
if (child != null && didNeedCompositing != _currentlyNeedsCompositing) if (child != null && didNeedCompositing != _currentlyNeedsCompositing)
markNeedsCompositingBitsUpdate(); markNeedsCompositingBitsUpdate();
markNeedsPaint(); markNeedsPaint();
...@@ -1010,12 +1010,6 @@ mixin RenderAnimatedOpacityMixin<T extends RenderObject> on RenderObjectWithChil ...@@ -1010,12 +1010,6 @@ mixin RenderAnimatedOpacityMixin<T extends RenderObject> on RenderObjectWithChil
layer = null; layer = null;
return; return;
} }
if (_alpha == 255) {
// No need to keep the layer. We'll create a new one if necessary.
layer = null;
context.paintChild(child!, offset);
return;
}
assert(needsCompositing); assert(needsCompositing);
layer = context.pushOpacity(offset, _alpha!, super.paint, oldLayer: layer as OpacityLayer?); layer = context.pushOpacity(offset, _alpha!, super.paint, oldLayer: layer as OpacityLayer?);
} }
......
...@@ -306,7 +306,7 @@ void main() { ...@@ -306,7 +306,7 @@ void main() {
expect(renderAnimatedOpacity.needsCompositing, false); expect(renderAnimatedOpacity.needsCompositing, false);
}); });
test('RenderAnimatedOpacity does not composite if it is opaque', () { test('RenderAnimatedOpacity does composite if it is opaque', () {
final Animation<double> opacityAnimation = AnimationController( final Animation<double> opacityAnimation = AnimationController(
vsync: FakeTickerProvider(), vsync: FakeTickerProvider(),
)..value = 1.0; )..value = 1.0;
...@@ -318,7 +318,7 @@ void main() { ...@@ -318,7 +318,7 @@ void main() {
); );
layout(renderAnimatedOpacity, phase: EnginePhase.composite); layout(renderAnimatedOpacity, phase: EnginePhase.composite);
expect(renderAnimatedOpacity.needsCompositing, false); expect(renderAnimatedOpacity.needsCompositing, true);
}); });
test('RenderAnimatedOpacity reuses its layer', () { test('RenderAnimatedOpacity reuses its layer', () {
......
...@@ -102,7 +102,7 @@ void main() { ...@@ -102,7 +102,7 @@ void main() {
expect(renderSliverAnimatedOpacity.needsCompositing, false); expect(renderSliverAnimatedOpacity.needsCompositing, false);
}); });
test('RenderSliverAnimatedOpacity does not composite if it is opaque', () { test('RenderSliverAnimatedOpacity does composite if it is opaque', () {
final Animation<double> opacityAnimation = AnimationController( final Animation<double> opacityAnimation = AnimationController(
vsync: FakeTickerProvider(), vsync: FakeTickerProvider(),
)..value = 1.0; )..value = 1.0;
...@@ -124,7 +124,7 @@ void main() { ...@@ -124,7 +124,7 @@ void main() {
); );
layout(root, phase: EnginePhase.composite); layout(root, phase: EnginePhase.composite);
expect(renderSliverAnimatedOpacity.needsCompositing, false); expect(renderSliverAnimatedOpacity.needsCompositing, true);
}); });
test('RenderSliverAnimatedOpacity reuses its layer', () { test('RenderSliverAnimatedOpacity reuses its layer', () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment