From 7c8ec376ffc8d1e08caa2bfdc412790b1e4a35d8 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 (#8707) See https://github.com/flutter/flutter/issues/31517 --- flow/layers/opacity_layer.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/flow/layers/opacity_layer.h b/flow/layers/opacity_layer.h index e437041c21f..93f73988d9e 100644 --- a/flow/layers/opacity_layer.h +++ b/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();