[NUI] Move SuggestedMinimumWidth/Height to native
authorhuiyu <huiyu.eun@samsung.com>
Tue, 26 Jan 2021 04:51:41 +0000 (13:51 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Fri, 29 Jan 2021 03:49:33 +0000 (12:49 +0900)
Patch to improve layout performance
(LayoutController.Process())

Signed-off-by: huiyu <huiyu.eun@samsung.com>
src/Tizen.NUI/src/internal/Interop/Interop.Actor.cs
src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs
src/Tizen.NUI/src/public/Layouting/LayoutItem.cs

index 5dffcb5..30adbe4 100755 (executable)
@@ -121,6 +121,12 @@ namespace Tizen.NUI
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_RemoveRenderer__SWIG_1")]
             public static extern void RemoveRenderer(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_GetSuggestedMinimumWidth")]
+            public static extern float GetSuggestedMinimumWidth(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_GetSuggestedMinimumHeight")]
+            public static extern float GetSuggestedMinimumHeight(global::System.Runtime.InteropServices.HandleRef jarg1);
         }
     }
 }
index 74646f6..cd5d969 100755 (executable)
@@ -51,6 +51,28 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+        internal LayoutLength SuggestedMinimumWidth
+        {
+            get
+            {
+                float result = Interop.Actor.GetSuggestedMinimumWidth(SwigCPtr);
+                if (NDalicPINVOKE.SWIGPendingException.Pending)
+                    throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                return new LayoutLength(result);
+            }
+        }
+
+        internal LayoutLength SuggestedMinimumHeight
+        {
+            get
+            {
+                float result = Interop.Actor.GetSuggestedMinimumHeight(SwigCPtr);
+                if (NDalicPINVOKE.SWIGPendingException.Pending)
+                    throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                return new LayoutLength(result);
+            }
+        }
+
         internal float WorldPositionX
         {
             get
index fc2cb64..8bc25dc 100755 (executable)
@@ -402,16 +402,7 @@ namespace Tizen.NUI
         {
             get
             {
-                float maximumWidth = Owner.MaximumSize.Width;
-                float minimumWidth = Owner.MinimumSize.Width;
-
-                float baseHeight = Owner.MaximumSize.Height > 0 ? Math.Min(Owner.MaximumSize.Height, Owner.NaturalSize.Height) : Owner.NaturalSize.Height;
-                float baseWidth = Owner.GetWidthForHeight(baseHeight);
-
-                float result = minimumWidth > 0 ? Math.Max(baseWidth, minimumWidth) : baseWidth;
-                result = maximumWidth > 0 ? Math.Min(result, maximumWidth) : result;
-
-                return new LayoutLength(result);
+                return Owner.SuggestedMinimumWidth;
             }
         }
 
@@ -424,16 +415,7 @@ namespace Tizen.NUI
         {
             get
             {
-                float maximumHeight = Owner.MaximumSize.Height;
-                float minimumHeight = Owner.MinimumSize.Height;
-
-                float baseWidth = Owner.MaximumSize.Width > 0 ? Math.Min(Owner.MaximumSize.Width, Owner.NaturalSize.Width) : Owner.NaturalSize.Width;
-                float baseHeight = Owner.GetHeightForWidth(baseWidth);
-
-                float result = minimumHeight > 0 ? Math.Max(baseHeight, minimumHeight) : baseHeight;
-                result = maximumHeight > 0 ? Math.Min(result, maximumHeight) : result;
-
-                return new LayoutLength(result);
+                return Owner.SuggestedMinimumHeight;
             }
         }