computeMasks method

void computeMasks()

Implementation

void computeMasks() {
  _renderMasks.clear();
  var masks =
      parent!.children!.whereType<ActorMask>().toList(growable: false);

  for (final mask in masks) {
    var renderMask = ActorLayerEffectRendererMask(mask);
    mask.source?.all((child) {
      if (child == parent) {
        // recursive mask was selected
        return false;
      }
      if (child is ActorDrawable) {
        if (child == this) {
          return false;
        } else if (child.layerEffect != null) {
          // Layer effect is direct discendant of this layer, so we want to
          // draw it with the other drawables in this layer.
          renderMask.drawables.add(child.layerEffect!);
          // Don't iterate if child has further layer effect
          return false;
        } else {
          renderMask.drawables.add(child);
        }
      }
      return true;
    });

    if (renderMask.drawables.isNotEmpty) {
      _renderMasks.add(renderMask);
    }
  }
}