Example #1
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);
        }
Example #2
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);
        }