示例#1
0
        public virtual void Update(IClipper clipper)
        {
            var matrix       = this.Camera.Matrix;
            var camera       = new Camera(matrix);
            var oldOffset    = this.DataOrigin;
            var oldSize      = this.DataSize;
            var oldPosition  = this.ClipOrigin;
            var matrixOffset = new Point(-matrix.OffsetX, -matrix.OffsetY);

            this.Update();

            var newOffset = this.DataOrigin;
            var newSize   = this.DataSize;

            if (newSize.Width < oldSize.Width &&
                (oldPosition.X + oldOffset.X) == matrixOffset.X)
            {
                var h    = Math.Max(oldSize.Height, newSize.Height);
                var rect = new Rectangle(
                    newSize.Width,
                    matrix.OffsetY,
                    oldSize.Width - newSize.Width,
                    h);
                clipper.Add(RectangleShape.Hull(camera.ToSource(rect), 0, false));
            }

            if (newSize.Height < oldSize.Height &&
                (oldPosition.Y + oldOffset.Y) == matrixOffset.Y)
            {
                var w    = Math.Max(oldSize.Width, newSize.Width);
                var rect = new Rectangle(
                    matrix.OffsetX,
                    newSize.Height,
                    w,
                    oldSize.Height - newSize.Height);
                clipper.Add(RectangleShape.Hull(camera.ToSource(rect), 0, false));
            }

            if (newOffset.X != oldOffset.X || newOffset.Y != oldOffset.Y)
            {
                clipper.RenderAll = true;
            }
        }
示例#2
0
        public override Point[] Measure(Matrix matrix, int delta, bool extend)
        {
            if (Data == null)
            {
                return(null);
            }
            var location = Point.Zero;

            if (OuterShape != null)
            {
                location = OuterShape.Location;
            }
            var hull = RectangleShape.Hull(new Rectangle(location, Data.Size), delta, extend);

            if (matrix != null && !matrix.IsIdentity)
            {
                matrix.Transform(hull);
            }
            return(hull);
        }