Esempio n. 1
0
            internal override CompositionShape?GetShapeRoot(TranslationContext context)
            {
                bool layerHasMasks = false;

#if !NoClipping
                layerHasMasks = _context.Layer.Masks.Any();
#endif
                if (layerHasMasks)
                {
                    throw new InvalidOperationException();
                }

                if (!Transforms.TryCreateContainerShapeTransformChain(_context, out var rootNode, out var contentsNode))
                {
                    // The layer is never visible.
                    return(null);
                }

                var shapeContext = new ShapeContext(_context);

                // Update the opacity from the transform. This is necessary to push the opacity
                // to the leaves (because CompositionShape does not support opacity).
                shapeContext.UpdateOpacityFromTransform(_context, _context.Layer.Transform);
                contentsNode.Shapes.Add(TranslateShapeLayerContents(shapeContext, _context.Layer.Contents));

                return(rootNode);
            }
Esempio n. 2
0
            internal override CompositionShape?GetShapeRoot(TranslationContext context)
            {
                bool layerHasMasks = false;

#if !NoClipping
                layerHasMasks = _context.Layer.Masks.Any();
#endif
                if (layerHasMasks)
                {
                    throw new InvalidOperationException();
                }

                if (!Transforms.TryCreateContainerShapeTransformChain(_context, out var rootNode, out var contentsNode))
                {
                    // The layer is never visible.
                    return(null);
                }

                var shapeContext = new ShapeContext(_context);

                // Update the opacity from the transform. This is necessary to push the opacity
                // to the leaves (because CompositionShape does not support opacity).
                // Note: this is no longer used because we will not call GetShapeRoot if layer transform has
                // animated opacity, instead we will call GetVisualRoot. But let's keep it here
                // just in case we will change the logic of IsShape flag.
                shapeContext.UpdateOpacityFromTransform(_context, _context.Layer.Transform);
                contentsNode.Shapes.Add(TranslateShapeLayerContents(shapeContext, _context.Layer.Contents));

                return(rootNode);
            }