[NUI] Add View.Ignored to optimize invisible Views in render thread
authorSeungho Baek <sbsh.baek@samsung.com>
Tue, 27 May 2025 08:22:38 +0000 (17:22 +0900)
committerJaehyun Cho <jaehyun0cho@gmail.com>
Thu, 29 May 2025 05:08:24 +0000 (14:08 +0900)
Signed-off-by: Seungho Baek <sbsh.baek@samsung.com>
src/Tizen.NUI/src/internal/Interop/Interop.Actor.cs
src/Tizen.NUI/src/public/BaseComponents/View.cs

index 4105364122f1c88e7008210fa44fe141068254a2..379c73d8b12aad1b6817749b423a04279c34ae72 100755 (executable)
@@ -92,6 +92,13 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_GetRelayoutSize")]
             public static extern float GetRelayoutSize(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_SetIgnored")]
+            public static extern void SetIgnored(global::System.Runtime.InteropServices.HandleRef actor, bool ignored);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_IsIgnored")]
+            [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
+            public static extern bool IsIgnored(global::System.Runtime.InteropServices.HandleRef actor);
+
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_SetPadding")]
             public static extern void SetPadding(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
 
index fa588d25cd27a116a42902a9d617bdefbd7046f9..cbe105c894649313d7da80c446c47ce62b7c60cd 100755 (executable)
@@ -7158,6 +7158,7 @@ namespace Tizen.NUI.BaseComponents
         {
             Object.InternalSetPropertyInt(SwigCPtr, Property.OffScreenRendering, (int)value);
         }
+
         private OffScreenRenderingType GetInternalOffScreenRendering()
         {
             int temp = Object.InternalGetPropertyInt(SwigCPtr, Property.OffScreenRendering);
@@ -7170,6 +7171,33 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+        /// <summary>
+        /// Gets of sets the flag to identify the View will be ignored or not.
+        /// If the View is marked as ignored, it will not be rendered and will be excluded from render thread computation.
+        /// So, the render thread properties like WorldPosition and WorldColor become inaccurate.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool Ignored
+        {
+            set => SetInternalIgnored(value);
+            get => IsInternalIgnored();
+        }
+
+        private void SetInternalIgnored(bool ignored)
+        {
+            Interop.Actor.SetIgnored(SwigCPtr, ignored);
+            if (NDalicPINVOKE.SWIGPendingException.Pending)
+                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        private bool IsInternalIgnored()
+        {
+            bool isIgnored = Interop.Actor.IsIgnored(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending)
+                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return isIgnored;
+        }
+
         private LayoutExtraData EnsureLayoutExtraData()
         {
             if (layoutExtraData == null)