[NUI] Remove GetDescription() in TextLabelBindableProperty
authorBowon Ryu <bowon.ryu@samsung.com>
Tue, 7 Jun 2022 04:22:32 +0000 (13:22 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Fri, 10 Jun 2022 05:42:51 +0000 (14:42 +0900)
remove GetDescription() for better performance.
and there is no need to convert string to enum.
because the HORIZONTAL_ALIGNMENT and VERTICAL_ALIGNMENT properties of DALi
can be set to an integer or string, and there is no burden if it is an integer(enum).

Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs

index f0970ff..d20632c 100755 (executable)
@@ -161,11 +161,9 @@ namespace Tizen.NUI.BaseComponents
         public static readonly BindableProperty HorizontalAlignmentProperty = BindableProperty.Create(nameof(HorizontalAlignment), typeof(HorizontalAlignment), typeof(TextLabel), HorizontalAlignment.Begin, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
         {
             var textLabel = (TextLabel)bindable;
-            string valueToString = "";
             if (newValue != null)
             {
-                valueToString = ((HorizontalAlignment)newValue).GetDescription();
-                Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.HorizontalAlignment, new Tizen.NUI.PropertyValue(valueToString));
+                Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.HorizontalAlignment, new Tizen.NUI.PropertyValue((int)newValue));
             }
         }),
         defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
@@ -183,11 +181,9 @@ namespace Tizen.NUI.BaseComponents
         public static readonly BindableProperty VerticalAlignmentProperty = BindableProperty.Create(nameof(VerticalAlignment), typeof(VerticalAlignment), typeof(TextLabel), VerticalAlignment.Bottom, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
         {
             var textLabel = (TextLabel)bindable;
-            string valueToString = "";
             if (newValue != null)
             {
-                valueToString = ((VerticalAlignment)newValue).GetDescription();
-                Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.VerticalAlignment, new Tizen.NUI.PropertyValue(valueToString));
+                Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.VerticalAlignment, new Tizen.NUI.PropertyValue((int)newValue));
             }
         }),
         defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>