Make animating opacity cheaper. (#13583)

No need to update the compositing bits all the time.
This commit is contained in:
Ian Hickson
2017-12-15 18:10:36 -08:00
committed by GitHub
parent 813be533cd
commit 8e5d77d3fa

View File

@@ -736,11 +736,15 @@ class RenderOpacity extends RenderProxyBox {
assert(value >= 0.0 && value <= 1.0);
if (_opacity == value)
return;
final bool didNeedCompositing = alwaysNeedsCompositing;
final bool wasVisible = _alpha != 0;
_opacity = value;
_alpha = _getAlphaFromOpacity(_opacity);
markNeedsCompositingBitsUpdate();
if (didNeedCompositing != alwaysNeedsCompositing)
markNeedsCompositingBitsUpdate();
markNeedsPaint();
markNeedsSemanticsUpdate();
if (wasVisible != (_alpha != 0))
markNeedsSemanticsUpdate();
}
int _alpha;
@@ -1354,8 +1358,10 @@ class RenderPhysicalModel extends _RenderCustomClip<RRect> {
assert(value != null);
if (elevation == value)
return;
final bool didNeedCompositing = alwaysNeedsCompositing;
_elevation = value;
markNeedsCompositingBitsUpdate();
if (didNeedCompositing != alwaysNeedsCompositing)
markNeedsCompositingBitsUpdate();
markNeedsPaint();
}