Exemple #1
0
        public void updateBoundAndGenID(ClipElement prior)
        {
            this._genId = ClipStack.getNextGenID();
            this._isIntersectionOfRects = false;

            if (this.isRect)
            {
                this._bound = this.rect;
                if (prior == null || prior.isIntersectionOfRects())
                {
                    this._isIntersectionOfRects = true;
                }
            }
            else
            {
                this._bound = this.mesh.bounds;
            }

            if (prior != null)
            {
                this._bound = this._bound.intersect(prior.getBound());
            }

            if (this._bound.isEmpty)
            {
                this.setEmpty();
            }
        }
Exemple #2
0
        public ReducedClip(ClipStack stack, Rect layerBounds, Rect queryBounds)
        {
            Rect stackBounds;
            bool iior;

            stack.getBounds(out stackBounds, out iior);

            if (stackBounds == null)
            {
                this.scissor = layerBounds;
                return;
            }

            stackBounds = layerBounds.intersect(stackBounds);
            if (iior)
            {
                this.scissor = stackBounds;
                return;
            }

            queryBounds = stackBounds.intersect(queryBounds);
            if (queryBounds.isEmpty)
            {
                this.scissor = Rect.zero;
                return;
            }

            this.scissor = queryBounds;
            this._walkStack(stack, this.scissor);
        }
Exemple #3
0
        public static ReducedClip create(ClipStack stack, uiRect layerBounds, uiRect queryBounds)
        {
            ReducedClip clip = ObjectPool <ReducedClip> .alloc();

            uiRect?stackBounds;
            bool   iior;

            stack.getBounds(out stackBounds, out iior);

            if (stackBounds == null)
            {
                clip.scissor = layerBounds;
                return(clip);
            }

            stackBounds = uiRectHelper.intersect(layerBounds, stackBounds.Value);
            if (iior)
            {
                clip.scissor = stackBounds;
                return(clip);
            }

            queryBounds = uiRectHelper.intersect(stackBounds.Value, queryBounds);
            if (queryBounds.isEmpty)
            {
                clip.scissor = uiRectHelper.zero;
                return(clip);
            }

            clip.scissor = queryBounds;
            clip._walkStack(stack, clip.scissor.Value);
            return(clip);
        }
Exemple #4
0
        void _walkStack(ClipStack stack, Rect queryBounds)
        {
            foreach (var element in stack.stack)
            {
                if (element.isRect)
                {
                    continue;
                }

                if (element.contains(queryBounds))
                {
                    continue;
                }

                this.maskElements.Add(element);
            }
        }
Exemple #5
0
            public static RenderLayer create(int rtID = 0, int width = 0, int height = 0,
                                             FilterMode filterMode = FilterMode.Bilinear,
                                             uiRect?layerBounds    = null, uiPaint?layerPaint = null, bool ignoreClip = true)
            {
                D.assert(layerBounds != null);
                var newLayer = ObjectPool <RenderLayer> .alloc();

                newLayer.rtID         = rtID;
                newLayer.width        = width;
                newLayer.height       = height;
                newLayer.filterMode   = filterMode;
                newLayer.layerBounds  = layerBounds.Value;
                newLayer.layerPaint   = layerPaint;
                newLayer.ignoreClip   = ignoreClip;
                newLayer.currentState = State.create();
                newLayer.states.Add(newLayer.currentState);
                newLayer.clipStack = ClipStack.create();

                return(newLayer);
            }