<commit_before>﻿//Apache2, 2014-present, WinterDev

using PixelFarm.Drawing;
namespace LayoutFarm
{
    public enum InvalidateReason
    {
        Empty,
        ViewportChanged,
        UpdateLocalArea,
        InvalidateParentArea,
    }

    public class InvalidateGraphicsArgs
    {
        internal InvalidateGraphicsArgs() { }
        public InvalidateReason Reason { get; private set; }
        public bool PassSrcElement { get; private set; }
        public int LeftDiff { get; private set; }
        public int TopDiff { get; private set; }
        internal Rectangle Rect;
        internal Rectangle GlobalRect;

        public RenderElement SrcRenderElement { get; private set; }
        public void Reset()
        {
            LeftDiff = TopDiff = 0;
            GlobalRect = Rect = Rectangle.Empty;
            SrcRenderElement = null;
            Reason = InvalidateReason.Empty;
            PassSrcElement = false;
        }
        /// <summary>
        /// set info about this invalidate args
        /// </summary>
        /// <param name="srcElem"></param>
        /// <param name="leftDiff"></param>
        /// <param name="topDiff"></param>
        public void Reason_ChangeViewport(RenderElement srcElem, int leftDiff, int topDiff)
        {
            SrcRenderElement = srcElem;
            LeftDiff = leftDiff;
            TopDiff = topDiff;
            Reason = InvalidateReason.ViewportChanged;
        }
        public void Reason_UpdateLocalArea(RenderElement srcElem, Rectangle localBounds)
        {
            SrcRenderElement = srcElem;
            Rect = localBounds;
            Reason = InvalidateReason.UpdateLocalArea;
        }
        public void Reason_InvalidateParent(RenderElement srcElem, Rectangle localBounds)
        {
            SrcRenderElement = srcElem;
            Rect = localBounds;
            PassSrcElement = true;
            Reason = InvalidateReason.InvalidateParentArea;
        }
#if DEBUG
        public override string ToString() => Reason.ToString() + " " + SrcRenderElement.dbug_obj_id.ToString();
#endif
    }

    partial class RenderElement
    {
        internal void InvalidateGraphics(InvalidateGraphicsArgs args)
        {
            //RELATIVE to this ***
            _propFlags &= ~RenderElementConst.IS_GRAPHIC_VALID;
            if ((_uiLayoutFlags & RenderElementConst.LY_SUSPEND_GRAPHIC) != 0)
            {
#if DEBUG
                dbugVRoot.dbug_PushInvalidateMsg(RootGraphic.dbugMsg_BLOCKED, this);
#endif
                return;
            }

            if (!GlobalRootGraphic.SuspendGraphicsUpdate)
            {
                Rectangle rect = new Rectangle(0, 0, _b_width, _b_height);
                args.Rect = rect;

                //RELATIVE to this***
                //1.
                _propFlags &= ~RenderElementConst.IS_GRAPHIC_VALID;
                //2.  
                _rootGfx.BubbleUpInvalidateGraphicArea(args);
            }
            else
            {

            }
        }
        public void InvalidateGraphics()
        {
            //RELATIVE to this ***
            _propFlags &= ~RenderElementConst.IS_GRAPHIC_VALID;
            if ((_uiLayoutFlags & RenderElementConst.LY_SUSPEND_GRAPHIC) != 0)
            {
#if DEBUG
                dbugVRoot.dbug_PushInvalidateMsg(RootGraphic.dbugMsg_BLOCKED, this);
#endif
                return;
            }

            if (!GlobalRootGraphic.SuspendGraphicsUpdate)
            {
                Rectangle rect = new Rectangle(0, 0, _b_width, _b_height);
                InvalidateGraphicLocalArea(this, rect);
            }
            else
            {

            }
        }

        public void InvalidateParentGraphics()
        {
            //RELATIVE to its parent
            this.InvalidateParentGraphics(this.RectBounds);
        }

        protected virtual void OnInvalidateGraphicsNoti(bool fromMe, ref Rectangle totalBounds) { }

        public void InvalidateParentGraphics(Rectangle totalBounds)
        {
            //RELATIVE to its parent***

            _propFlags &= ~RenderElementConst.IS_GRAPHIC_VALID;
            RenderElement parent = this.ParentRenderElement; //start at parent ****

            //--------------------------------------- 
            if ((_uiLayoutFlags & RenderElementConst.LY_REQ_INVALIDATE_RECT_EVENT) != 0)
            {
                OnInvalidateGraphicsNoti(true, ref totalBounds);
            }
            //
            if (parent != null)
            {
                if (!GlobalRootGraphic.SuspendGraphicsUpdate)
                {
                    InvalidateGraphicsArgs arg = _rootGfx.GetInvalidateGfxArgs();
                    arg.Reason_InvalidateParent(parent, totalBounds);

                    _rootGfx.BubbleUpInvalidateGraphicArea(arg);//RELATIVE to its parent***
                }
                else
                {
<commit_msg>2226:<commit_after>﻿//Apache2, 2014-present, WinterDev

using PixelFarm.Drawing;
namespace LayoutFarm
{
    public enum InvalidateReason
    {
        Empty,
        ViewportChanged,
        UpdateLocalArea,
    }

    public class InvalidateGraphicsArgs
    {
        internal InvalidateGraphicsArgs() { }
        public InvalidateReason Reason { get; private set; }
        public bool PassSrcElement { get; private set; }
        public int LeftDiff { get; private set; }
        public int TopDiff { get; private set; }
        internal Rectangle Rect;
        internal Rectangle GlobalRect;

        public RenderElement SrcRenderElement { get; private set; }
        public void Reset()
        {
            LeftDiff = TopDiff = 0;
            GlobalRect = Rect = Rectangle.Empty;
            SrcRenderElement = null;
            Reason = InvalidateReason.Empty;
            PassSrcElement = false;
        }
        /// <summary>
        /// set info about this invalidate args
        /// </summary>
        /// <param name="srcElem"></param>
        /// <param name="leftDiff"></param>
        /// <param name="topDiff"></param>
        public void Reason_ChangeViewport(RenderElement srcElem, int leftDiff, int topDiff)
        {
            SrcRenderElement = srcElem;
            LeftDiff = leftDiff;
            TopDiff = topDiff;
            Reason = InvalidateReason.ViewportChanged;
        }
        public void Reason_UpdateLocalArea(RenderElement srcElem, Rectangle localBounds)
        {
            SrcRenderElement = srcElem;
            Rect = localBounds;
            Reason = InvalidateReason.UpdateLocalArea;
        }
        
#if DEBUG
        public override string ToString() => Reason.ToString() + " " + SrcRenderElement.dbug_obj_id.ToString();
#endif
    }

    partial class RenderElement
    {
        internal void InvalidateGraphics(InvalidateGraphicsArgs args)
        {
            //RELATIVE to this ***
            _propFlags &= ~RenderElementConst.IS_GRAPHIC_VALID;
            if ((_uiLayoutFlags & RenderElementConst.LY_SUSPEND_GRAPHIC) != 0)
            {
#if DEBUG
                dbugVRoot.dbug_PushInvalidateMsg(RootGraphic.dbugMsg_BLOCKED, this);
#endif
                return;
            }

            if (!GlobalRootGraphic.SuspendGraphicsUpdate)
            {
                Rectangle rect = new Rectangle(0, 0, _b_width, _b_height);
                args.Rect = rect;

                //RELATIVE to this***
                //1.
                _propFlags &= ~RenderElementConst.IS_GRAPHIC_VALID;
                //2.  
                _rootGfx.BubbleUpInvalidateGraphicArea(args);
            }
            else
            {

            }
        }
        public void InvalidateGraphics()
        {
            //RELATIVE to this ***
            _propFlags &= ~RenderElementConst.IS_GRAPHIC_VALID;
            if ((_uiLayoutFlags & RenderElementConst.LY_SUSPEND_GRAPHIC) != 0)
            {
#if DEBUG
                dbugVRoot.dbug_PushInvalidateMsg(RootGraphic.dbugMsg_BLOCKED, this);
#endif
                return;
            }

            if (!GlobalRootGraphic.SuspendGraphicsUpdate)
            {
                Rectangle rect = new Rectangle(0, 0, _b_width, _b_height);
                InvalidateGraphicLocalArea(this, rect);
            }
            else
            {

            }
        }

        public void InvalidateParentGraphics()
        {
            //RELATIVE to its parent
            this.InvalidateParentGraphics(this.RectBounds);
        }

        protected virtual void OnInvalidateGraphicsNoti(bool fromMe, ref Rectangle totalBounds) { }

        public void InvalidateParentGraphics(Rectangle totalBounds)
        {
            //RELATIVE to its parent***

            _propFlags &= ~RenderElementConst.IS_GRAPHIC_VALID;
            RenderElement parent = this.ParentRenderElement; //start at parent ****

            //--------------------------------------- 
            if ((_uiLayoutFlags & RenderElementConst.LY_REQ_INVALIDATE_RECT_EVENT) != 0)
            {
                OnInvalidateGraphicsNoti(true, ref totalBounds);
            }
            //
            if (parent != null)
            {
                if (!GlobalRootGraphic.SuspendGraphicsUpdate)
                {
                    InvalidateGraphicsArgs arg = _rootGfx.GetInvalidateGfxArgs();
                    arg.Reason_UpdateLocalArea(parent, totalBounds);

                    _rootGfx.BubbleUpInvalidateGraphicArea(arg);//RELATIVE to its parent***
                }
                else
                {

{'fraction_non_alphanumeric': 0.08730578162984885, 'fraction_numerical': 0.00359370045449741, 'mean_word_length': 1.6356545961002786, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3144562', 'n_tokens_mistral': 2520, 'n_tokens_neox': 2398, 'n_words': 507}