Revert "Modify color"
authorhuiyu.eun <huiyu.eun@samsung.com>
Thu, 26 Nov 2020 07:49:42 +0000 (16:49 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 1 Dec 2020 08:56:39 +0000 (17:56 +0900)
This reverts commit 1dd79a38cfae129f7b670d80e386f95f45bbf9d0.

src/Tizen.NUI/src/public/Color.cs

index e932b9888f3ed0730d6b0169c1e4b2a238851452..15f391903f8192f17fd52aac03dc250aa52821a1 100755 (executable)
@@ -484,12 +484,68 @@ namespace Tizen.NUI
 
         internal static Color ValueCheck(Color color)
         {
-            return new Color(InvalidChecker(color.R), InvalidChecker(color.G), InvalidChecker(color.B), InvalidChecker(color.A));
+            float r = color.R;
+            float g = color.G;
+            float b = color.B;
+            float a = color.A;
+
+            if (r < 0.0f)
+            {
+                r = 0.0f;
+                NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
+            }
+            else if (r > 1.0f)
+            {
+                r = 1.0f;
+                NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
+            }
+            if (g < 0.0f)
+            {
+                g = 0.0f;
+                NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
+            }
+            else if (g > 1.0f)
+            {
+                g = 1.0f;
+                NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
+            }
+            if (b < 0.0f)
+            {
+                b = 0.0f;
+                NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
+            }
+            else if (b > 1.0f)
+            {
+                b = 1.0f;
+                NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
+            }
+            if (a < 0.0f)
+            {
+                a = 0.0f;
+                NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
+            }
+            else if (a > 1.0f)
+            {
+                a = 1.0f;
+                NUILog.Error("The value of Result is invalid! Should be between [0, 1].");
+            }
+            color = new Color(r, g, b, a);
+            return color;
         }
 
         internal static float ValueCheck(float value)
         {
-            return InvalidChecker(value);
+            if (value < 0.0f)
+            {
+                value = 0.0f;
+                NUILog.Error("The value of Parameters is invalid! Should be between [0, 1].");
+            }
+            else if (value > 1.0f)
+            {
+                value = 1.0f;
+                NUILog.Error("The value of Parameters is invalid! Should be between [0, 1].");
+            }
+            return value;
         }
 
         internal static float[] ValueCheck(float[] arr)
@@ -501,25 +557,19 @@ namespace Tizen.NUI
 
             for (int i = 0; i < arr.Length; i++)
             {
-                arr[i] = InvalidChecker(arr[i]);
+                if (arr[i] < 0.0f)
+                {
+                    arr[i] = 0.0f;
+                    NUILog.Error("The value of Parameters is invalid! Should be between [0, 1].");
+                }
+                else if (arr[i] > 1.0f)
+                {
+                    arr[i] = 1.0f;
+                    NUILog.Error("The value of Parameters is invalid! Should be between [0, 1].");
+                }
             }
             return arr;
         }
-        
-        private static float InvalidChecker(float value)
-        {
-            if (value < 0.0f)
-            {
-                value = 0.0f;
-                NUILog.Error($"The value of Result is invalid! Should be between [0, 1]. value is {value}");
-            }
-            else if(value > 1.0f)
-            {
-                value = 1.0f;
-                NUILog.Error($"The value of Result is invalid! Should be between [0, 1]. value is {value}");
-            }
-            return value;
-        }
 
         /// This will not be public opened.
         [EditorBrowsable(EditorBrowsableState.Never)]