Unverified Commit 8e5d77d3 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Make animating opacity cheaper. (#13583)

No need to update the compositing bits all the time.
parent 813be533
...@@ -736,10 +736,14 @@ class RenderOpacity extends RenderProxyBox { ...@@ -736,10 +736,14 @@ class RenderOpacity extends RenderProxyBox {
assert(value >= 0.0 && value <= 1.0); assert(value >= 0.0 && value <= 1.0);
if (_opacity == value) if (_opacity == value)
return; return;
final bool didNeedCompositing = alwaysNeedsCompositing;
final bool wasVisible = _alpha != 0;
_opacity = value; _opacity = value;
_alpha = _getAlphaFromOpacity(_opacity); _alpha = _getAlphaFromOpacity(_opacity);
if (didNeedCompositing != alwaysNeedsCompositing)
markNeedsCompositingBitsUpdate(); markNeedsCompositingBitsUpdate();
markNeedsPaint(); markNeedsPaint();
if (wasVisible != (_alpha != 0))
markNeedsSemanticsUpdate(); markNeedsSemanticsUpdate();
} }
...@@ -1354,7 +1358,9 @@ class RenderPhysicalModel extends _RenderCustomClip<RRect> { ...@@ -1354,7 +1358,9 @@ class RenderPhysicalModel extends _RenderCustomClip<RRect> {
assert(value != null); assert(value != null);
if (elevation == value) if (elevation == value)
return; return;
final bool didNeedCompositing = alwaysNeedsCompositing;
_elevation = value; _elevation = value;
if (didNeedCompositing != alwaysNeedsCompositing)
markNeedsCompositingBitsUpdate(); markNeedsCompositingBitsUpdate();
markNeedsPaint(); markNeedsPaint();
} }
......
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