From 39e920cd1ac27e1da86c4d10aa5a8782e059ab92 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Tue, 23 Apr 2019 15:02:57 -0700 Subject: [PATCH] Document that OpacityLayer's children are nonempty (flutter/engine#8707) See https://github.com/flutter/flutter/issues/31517 --- engine/src/flutter/flow/layers/opacity_layer.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engine/src/flutter/flow/layers/opacity_layer.h b/engine/src/flutter/flow/layers/opacity_layer.h index e437041c21f..93f73988d9e 100644 --- a/engine/src/flutter/flow/layers/opacity_layer.h +++ b/engine/src/flutter/flow/layers/opacity_layer.h @@ -9,6 +9,10 @@ namespace flutter { +// Don't add an OpacityLayer with no children to the layer tree. Painting an +// OpacityLayer is very costly due to the saveLayer call. If there's no child, +// having the OpacityLayer or not has the same effect. In debug_unopt build, the +// |EnsureSingleChild| will assert if there are no children. class OpacityLayer : public ContainerLayer { public: OpacityLayer();