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,11 +736,15 @@ class RenderOpacity extends RenderProxyBox { ...@@ -736,11 +736,15 @@ 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);
markNeedsCompositingBitsUpdate(); if (didNeedCompositing != alwaysNeedsCompositing)
markNeedsCompositingBitsUpdate();
markNeedsPaint(); markNeedsPaint();
markNeedsSemanticsUpdate(); if (wasVisible != (_alpha != 0))
markNeedsSemanticsUpdate();
} }
int _alpha; int _alpha;
...@@ -1354,8 +1358,10 @@ class RenderPhysicalModel extends _RenderCustomClip<RRect> { ...@@ -1354,8 +1358,10 @@ 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;
markNeedsCompositingBitsUpdate(); if (didNeedCompositing != alwaysNeedsCompositing)
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