Remove ReleaseFunction enum at PixelData (#3436)
authorEunki Hong <h.pichulia@gmail.com>
Thu, 19 Aug 2021 09:55:44 +0000 (18:55 +0900)
committerJunsuChoi <junduru019@gmail.com>
Tue, 24 Aug 2021 05:09:56 +0000 (14:09 +0900)
PixelData buffer's allocate / release function is only need for C++ side memory.
And C# cannot control that allocation method.
So ReleaseFunction enum is unneccesary arguments at NUI.

Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
Co-authored-by: Eunki, Hong <eunkiki.hong@samsung.com>
src/Tizen.NUI.Wearable/src/public/Title.cs
src/Tizen.NUI/src/internal/Interop/Interop.PixelData.cs
src/Tizen.NUI/src/public/Images/PixelData.cs
test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/public/Images/TSPixelData.cs

index 660198b..5d3fb1e 100755 (executable)
@@ -270,7 +270,7 @@ namespace Tizen.NUI.Components
             pixelBuffer[6] = (byte)(0xFF * color2.Z);
             pixelBuffer[7] = (byte)(0xFF * color2.W);
 
-            PixelData pixelData = new PixelData(pixelBuffer, size, width, height, PixelFormat.RGBA8888, PixelData.ReleaseFunction.DeleteArray );
+            PixelData pixelData = new PixelData(pixelBuffer, size, width, height, PixelFormat.RGBA8888);
             Texture texture = new Texture(TextureType.TEXTURE_2D, PixelFormat.RGBA8888, width, height);
             texture.Upload(pixelData);
 
index 75d424f..50813bb 100755 (executable)
@@ -25,7 +25,7 @@ namespace Tizen.NUI
             public static extern global::System.IntPtr Upcast(global::System.IntPtr jarg1);
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_PixelData_New")]
-            public static extern global::System.IntPtr New([global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)] byte[] jarg1, uint jarg2, uint jarg3, uint jarg4, int jarg5, int jarg6);
+            public static extern global::System.IntPtr New([global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)] byte[] jarg1, uint jarg2, uint jarg3, uint jarg4, int jarg5);
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_PixelData__SWIG_0")]
             public static extern global::System.IntPtr NewPixelData();
index a001174..6b0ec8f 100755 (executable)
@@ -45,11 +45,10 @@ namespace Tizen.NUI
         /// <param name="width">Buffer width in pixels.</param>
         /// <param name="height">Buffer height in pixels.</param>
         /// <param name="pixelFormat">The pixel format.</param>
-        /// <param name="releaseFunction">The function used to release the memory.</param>
         /// <since_tizen> 5 </since_tizen>
         /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public PixelData(byte[] buffer, uint bufferSize, uint width, uint height, PixelFormat pixelFormat, PixelData.ReleaseFunction releaseFunction) : this(Interop.PixelData.New(buffer, bufferSize, width, height, (int)pixelFormat, (int)releaseFunction), true)
+        public PixelData(byte[] buffer, uint bufferSize, uint width, uint height, PixelFormat pixelFormat) : this(Interop.PixelData.New(buffer, bufferSize, width, height, (int)pixelFormat), true)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
 
@@ -60,25 +59,6 @@ namespace Tizen.NUI
         }
 
         /// <summary>
-        /// Enumeration for function to release the pixel buffer.
-        /// </summary>
-        /// <since_tizen> 5 </since_tizen>
-        /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public enum ReleaseFunction
-        {
-            /// <summary>
-            /// Use free function to release the pixel buffer.
-            /// </summary>
-            Free,
-
-            /// <summary>
-            /// Use delete[] operator to release the pixel buffer.
-            /// </summary>
-            DeleteArray
-        }
-
-        /// <summary>
         /// Generate Url from pixel data.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
index e58cf7b..27af0d3 100755 (executable)
@@ -41,7 +41,7 @@ namespace Tizen.NUI.Devel.Tests
 
             byte[] buffer = new byte[1024];
 
-            var testingTarget = new PixelData(buffer, 1024, 100, 150, PixelFormat.L8, PixelData.ReleaseFunction.Free);
+            var testingTarget = new PixelData(buffer, 1024, 100, 150, PixelFormat.L8);
             Assert.IsNotNull(testingTarget, "Can't create success object PixelData");
             Assert.IsInstanceOf<PixelData>(testingTarget, "Should be an instance of PixelData type.");
 
@@ -63,7 +63,7 @@ namespace Tizen.NUI.Devel.Tests
 
             byte[] buffer = new byte[10];
 
-            using (PixelData pixelData = new PixelData(buffer, 10, 1, 2, PixelFormat.L8, PixelData.ReleaseFunction.Free))
+            using (PixelData pixelData = new PixelData(buffer, 10, 1, 2, PixelFormat.L8))
             {
                 var testingTarget = new PixelData(PixelData.getCPtr(pixelData).Handle, true);
                 Assert.IsNotNull(testingTarget, "Can't create success object PixelData");
@@ -89,7 +89,7 @@ namespace Tizen.NUI.Devel.Tests
 
             byte[] buffer = new byte[10];
 
-            var testingTarget = new PixelData(buffer, 10, 1, 2, PixelFormat.L8, PixelData.ReleaseFunction.Free);
+            var testingTarget = new PixelData(buffer, 10, 1, 2, PixelFormat.L8);
             Assert.IsNotNull(testingTarget, "Can't create success object PixelData");
             Assert.IsInstanceOf<PixelData>(testingTarget, "Should be an instance of PixelData type.");
 
@@ -114,7 +114,7 @@ namespace Tizen.NUI.Devel.Tests
 
             byte[] buffer = new byte[10];
 
-            var testingTarget = new PixelData(buffer, 10, 1, 2, PixelFormat.L8, PixelData.ReleaseFunction.Free);
+            var testingTarget = new PixelData(buffer, 10, 1, 2, PixelFormat.L8);
             Assert.IsNotNull(testingTarget, "Can't create success object PixelData");
             Assert.IsInstanceOf<PixelData>(testingTarget, "Should be an instance of PixelData type.");
 
@@ -139,7 +139,7 @@ namespace Tizen.NUI.Devel.Tests
 
             byte[] buffer = new byte[10];
 
-            var testingTarget = new PixelData(buffer, 10, 1, 2, PixelFormat.L8, PixelData.ReleaseFunction.Free);
+            var testingTarget = new PixelData(buffer, 10, 1, 2, PixelFormat.L8);
             Assert.IsNotNull(testingTarget, "Can't create success object PixelData");
             Assert.IsInstanceOf<PixelData>(testingTarget, "Should be an instance of PixelData type.");
 
@@ -164,7 +164,7 @@ namespace Tizen.NUI.Devel.Tests
 
             byte[] buffer = new byte[10];
 
-            var testingTarget = new PixelData(buffer, 10, 1, 2, PixelFormat.BGR8888, PixelData.ReleaseFunction.Free);
+            var testingTarget = new PixelData(buffer, 10, 1, 2, PixelFormat.BGR8888);
             Assert.IsNotNull(testingTarget, "Can't create success object PixelData");
             Assert.IsInstanceOf<PixelData>(testingTarget, "Should be an instance of PixelData type.");