Exemple #1
0
        public Stats(CompositionObject?root)
        {
            if (root is null)
            {
                return;
            }

            var objectGraph = Graph.FromCompositionObject(root, includeVertices: false);

            CompositionPathCount = objectGraph.CompositionPathNodes.Count();
            CanvasGeometryCount  = objectGraph.CanvasGeometryNodes.Count();

            foreach (var(_, obj) in objectGraph.CompositionObjectNodes)
            {
                AnimatorCount += obj.Animators.Count;

                CompositionObjectCount++;
                switch (obj.Type)
                {
                case CompositionObjectType.AnimationController:
                    AnimationControllerCount++;
                    break;

                case CompositionObjectType.BooleanKeyFrameAnimation:
                    BooleanKeyFrameAnimationCount++;
                    break;

                case CompositionObjectType.ColorKeyFrameAnimation:
                    ColorKeyFrameAnimationCount++;
                    break;

                case CompositionObjectType.CompositionColorBrush:
                    ColorBrushCount++;
                    break;

                case CompositionObjectType.CompositionColorGradientStop:
                    ColorGradientStopCount++;
                    break;

                case CompositionObjectType.CompositionContainerShape:
                    ContainerShapeCount++;
                    break;

                case CompositionObjectType.CompositionEffectBrush:
                    EffectBrushCount++;
                    break;

                case CompositionObjectType.CompositionEllipseGeometry:
                    EllipseGeometryCount++;
                    break;

                case CompositionObjectType.CompositionGeometricClip:
                    GeometricClipCount++;
                    break;

                case CompositionObjectType.CompositionLinearGradientBrush:
                    LinearGradientBrushCount++;
                    break;

                case CompositionObjectType.CompositionPathGeometry:
                    PathGeometryCount++;
                    break;

                case CompositionObjectType.CompositionPropertySet:
                {
                    var propertyCount = ((CompositionPropertySet)obj).Names.Count();
                    if (propertyCount > 0)
                    {
                        PropertySetCount++;
                        PropertySetPropertyCount += propertyCount;
                    }
                }

                break;

                case CompositionObjectType.CompositionRadialGradientBrush:
                    RadialGradientBrushCount++;
                    break;

                case CompositionObjectType.CompositionRectangleGeometry:
                    RectangleGeometryCount++;
                    break;

                case CompositionObjectType.CompositionRoundedRectangleGeometry:
                    RoundedRectangleGeometryCount++;
                    break;

                case CompositionObjectType.CompositionSpriteShape:
                    SpriteShapeCount++;
                    break;

                case CompositionObjectType.CompositionSurfaceBrush:
                    SurfaceBrushCount++;
                    break;

                case CompositionObjectType.CompositionViewBox:
                    ViewBoxCount++;
                    break;

                case CompositionObjectType.CompositionVisualSurface:
                    VisualSurfaceCount++;
                    break;

                case CompositionObjectType.ContainerVisual:
                    ContainerVisualCount++;
                    break;

                case CompositionObjectType.CubicBezierEasingFunction:
                    CubicBezierEasingFunctionCount++;
                    break;

                case CompositionObjectType.DropShadow:
                    DropShadowCount++;
                    break;

                case CompositionObjectType.ExpressionAnimation:
                    ExpressionAnimationCount++;
                    break;

                case CompositionObjectType.InsetClip:
                    InsetClipCount++;
                    break;

                case CompositionObjectType.LayerVisual:
                    LayerVisualCount++;
                    break;

                case CompositionObjectType.LinearEasingFunction:
                    LinearEasingFunctionCount++;
                    break;

                case CompositionObjectType.PathKeyFrameAnimation:
                    PathKeyFrameAnimationCount++;
                    break;

                case CompositionObjectType.ScalarKeyFrameAnimation:
                    ScalarKeyFrameAnimationCount++;
                    break;

                case CompositionObjectType.ShapeVisual:
                    ShapeVisualCount++;
                    break;

                case CompositionObjectType.SpriteVisual:
                    SpriteVisualCount++;
                    break;

                case CompositionObjectType.StepEasingFunction:
                    StepEasingFunctionCount++;
                    break;

                case CompositionObjectType.Vector2KeyFrameAnimation:
                    Vector2KeyFrameAnimationCount++;
                    break;

                case CompositionObjectType.Vector3KeyFrameAnimation:
                    Vector3KeyFrameAnimationCount++;
                    break;

                case CompositionObjectType.Vector4KeyFrameAnimation:
                    Vector4KeyFrameAnimationCount++;
                    break;

                default:
                    throw new InvalidOperationException();
                }
            }
        }
Exemple #2
0
        public Stats(CompositionObject root)
        {
            var objectGraph = Graph.FromCompositionObject(root, includeVertices: false);

            _compositionPathCount = objectGraph.CompositionPathNodes.Count();
            _canvasGeometryCount  = objectGraph.CanvasGeometryNodes.Count();

            foreach (var n in objectGraph.CompositionObjectNodes)
            {
                _compositionObjectCount++;
                switch (n.Object.Type)
                {
                case CompositionObjectType.AnimationController:
                    _animationControllerCount++;
                    break;

                case CompositionObjectType.ColorKeyFrameAnimation:
                    _colorKeyFrameAnimationCount++;
                    break;

                case CompositionObjectType.CompositionColorBrush:
                    _colorBrushCount++;
                    break;

                case CompositionObjectType.CompositionContainerShape:
                    _containerShapeCount++;
                    break;

                case CompositionObjectType.CompositionEffectBrush:
                    _effectBrushCount++;
                    break;

                case CompositionObjectType.CompositionEllipseGeometry:
                    _ellipseGeometryCount++;
                    break;

                case CompositionObjectType.CompositionGeometricClip:
                    _geometricClipCount++;
                    break;

                case CompositionObjectType.CompositionPathGeometry:
                    _pathGeometryCount++;
                    break;

                case CompositionObjectType.CompositionPropertySet:
                {
                    var propertyCount = ((CompositionPropertySet)n.Object).PropertyNames.Count();
                    if (propertyCount > 0)
                    {
                        _propertySetCount++;
                        _propertySetPropertyCount += propertyCount;
                    }
                }

                break;

                case CompositionObjectType.CompositionRectangleGeometry:
                    _rectangleGeometryCount++;
                    break;

                case CompositionObjectType.CompositionRoundedRectangleGeometry:
                    _roundedRectangleGeometryCount++;
                    break;

                case CompositionObjectType.CompositionSpriteShape:
                    _spriteShapeCount++;
                    break;

                case CompositionObjectType.CompositionSurfaceBrush:
                    _surfaceBrushCount++;
                    break;

                case CompositionObjectType.CompositionViewBox:
                    _viewBoxCount++;
                    break;

                case CompositionObjectType.CompositionVisualSurface:
                    _visualSurfaceCount++;
                    break;

                case CompositionObjectType.ContainerVisual:
                    _containerVisualCount++;
                    break;

                case CompositionObjectType.CubicBezierEasingFunction:
                    _cubicBezierEasingFunctionCount++;
                    break;

                case CompositionObjectType.ExpressionAnimation:
                    _expressionAnimationCount++;
                    break;

                case CompositionObjectType.InsetClip:
                    _insetClipCount++;
                    break;

                case CompositionObjectType.LinearEasingFunction:
                    _linearEasingFunctionCount++;
                    break;

                case CompositionObjectType.PathKeyFrameAnimation:
                    _pathKeyFrameAnimationCount++;
                    break;

                case CompositionObjectType.ScalarKeyFrameAnimation:
                    _scalarKeyFrameAnimationCount++;
                    break;

                case CompositionObjectType.ShapeVisual:
                    _shapeVisualCount++;
                    break;

                case CompositionObjectType.SpriteVisual:
                    _spriteVisualCount++;
                    break;

                case CompositionObjectType.StepEasingFunction:
                    _stepEasingFunctionCount++;
                    break;

                case CompositionObjectType.Vector2KeyFrameAnimation:
                    _vector2KeyFrameAnimationCount++;
                    break;

                case CompositionObjectType.Vector3KeyFrameAnimation:
                    _vector3KeyFrameAnimationCount++;
                    break;

                default:
                    throw new InvalidOperationException();
                }
            }
        }