public override void DrawLayer(BitmapCanvas canvas, DenseMatrix parentMatrix, byte parentAlpha) { LottieLog.BeginSection("CompositionLayer.Draw"); canvas.GetClipBounds(out _originalClipRect); RectExt.Set(ref _newClipRect, 0, 0, LayerModel.PreCompWidth, LayerModel.PreCompHeight); parentMatrix.MapRect(ref _newClipRect); for (var i = _layers.Count - 1; i >= 0; i--) { var nonEmptyClip = true; if (!_newClipRect.IsEmpty) { nonEmptyClip = canvas.ClipRect(_newClipRect); } if (nonEmptyClip) { BaseLayer layer = _layers[i]; layer.Draw(canvas, parentMatrix, parentAlpha); } } if (!_originalClipRect.IsEmpty) { canvas.ClipRect(_originalClipRect, Region.Op.Replace); } LottieLog.EndSection("CompositionLayer.Draw"); }