Esempio n. 1
0
        public void PerformClipping()
        {
            if (m_ShouldRecalculateClipRects)
            {
                NewRect2DMaskUtil.GetRectMasksForClip(this, m_Clippers);
                m_ShouldRecalculateClipRects = false;
            }

            bool validRect       = true;
            Rect clipRect        = NewClipping.FindCullAndClipWorldRect(m_Clippers, out validRect);
            bool clipRectChanged = clipRect != m_LastClipRectCanvasSpace;

            if (clipRectChanged || m_ForceClip)
            {
                foreach (IClippable clipTarget in m_ClipTargets)
                {
                    clipTarget.SetClipRect(clipRect, validRect);
                }

                m_LastClipRectCanvasSpace = clipRect;
                m_LastValidClipRect       = validRect;
            }

            foreach (IClippable clipTarget in m_ClipTargets)
            {
                var maskable = clipTarget as NewMaskableGraphic_RectMask2D;
                if (maskable != null && !maskable.canvasRenderer.hasMoved && !clipRectChanged)
                {
                    continue;
                }

                clipTarget.Cull(m_LastClipRectCanvasSpace, m_LastValidClipRect);
            }
        }
Esempio n. 2
0
 protected override void OnEnable()
 {
     base.OnEnable();
     m_ShouldRecalculateClipRects = true;
     ClipperRegistry.Register(this);
     NewRect2DMaskUtil.Notify2DMaskStateChanged(this);
 }
Esempio n. 3
0
 protected override void OnDisable()
 {
     base.OnDisable();
     m_Clippers.Clear();
     m_ClipTargets.Clear();
     ClipperRegistry.Unregister(this);
     NewRect2DMaskUtil.Notify2DMaskStateChanged(this);
 }