[NUI.Scene3D] Remove warning messages
authorEunki, Hong <eunkiki.hong@samsung.com>
Thu, 9 Feb 2023 11:41:33 +0000 (20:41 +0900)
committerEunki Hong <h.pichulia@gmail.com>
Mon, 13 Feb 2023 09:16:02 +0000 (18:16 +0900)
Tested by `dotnet build /p:BuildWithAnalyzer=True` and checked there is no warning.

Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
src/Tizen.NUI.Scene3D/src/public/Controls/Camera.cs
src/Tizen.NUI.Scene3D/src/public/Controls/SceneView.cs

index e7e19f8..fa2a2ef 100755 (executable)
@@ -662,13 +662,13 @@ namespace Tizen.NUI.Scene3D
         /// </summary>
         // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static Radian ConvertFovFromVerticalToHorizontal(float aspect, Radian verticalFov)
+        public static void ConvertFovFromVerticalToHorizontal(float aspect, ref Radian fov)
         {
-            if(verticalFov == null)
+            if(fov == null)
             {
-                return null;
+                return;
             }
-            return new Radian(2.0f * (float)Math.Atan(Math.Tan(verticalFov.ConvertToFloat() * 0.5f) * aspect));
+            fov.Value = 2.0f * (float)Math.Atan(Math.Tan(fov.ConvertToFloat() * 0.5f) * aspect);
         }
 
         /// <summary>
@@ -676,13 +676,13 @@ namespace Tizen.NUI.Scene3D
         /// </summary>
         // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static Radian ConvertFovFromHorizontalToVertical(float aspect, Radian horizontalFov)
+        public static void ConvertFovFromHorizontalToVertical(float aspect, ref Radian fov)
         {
-            if(horizontalFov == null)
+            if(fov == null)
             {
-                return null;
+                return;
             }
-            return new Radian(2.0f * (float)Math.Atan(Math.Tan(horizontalFov.ConvertToFloat() * 0.5f) / aspect));
+            fov.Value = 2.0f * (float)Math.Atan(Math.Tan(fov.ConvertToFloat() * 0.5f) / aspect);
         }
 
         /// <summary>
index e3aa23a..2edd4f8 100755 (executable)
@@ -18,6 +18,7 @@
 using System;
 using System.Runtime.InteropServices;
 using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
 using Tizen.NUI;
 using Tizen.NUI.Binding;
 using Tizen.NUI.BaseComponents;
@@ -385,6 +386,7 @@ namespace Tizen.NUI.Scene3D
         /// <param name="durationMilliSeconds">The duration in milliseconds.</param>
         /// <param name="alphaFunction">The alpha function to apply.</param>
         /// <since_tizen> 10 </since_tizen>
+                [SuppressMessage("Microsoft.Design", "CA2000: Dispose objects before losing scope", Justification = "The ownership of camera object is not owned by this class.")]
         public void CameraTransition(uint index, int durationMilliSeconds, AlphaFunction alphaFunction = null)
         {
             if(inCameraTransition || GetSelectedCamera() == GetCamera(index))
@@ -410,6 +412,7 @@ namespace Tizen.NUI.Scene3D
         /// <param name="durationMilliSeconds">The duration in milliseconds.</param>
         /// <param name="alphaFunction">The alpha function to apply.</param>
         /// <since_tizen> 10 </since_tizen>
+                [SuppressMessage("Microsoft.Design", "CA2000: Dispose objects before losing scope", Justification = "The ownership of camera object is not owned by this class.")]
         public void CameraTransition(string name, int durationMilliSeconds, AlphaFunction alphaFunction = null)
         {
             if(inCameraTransition || GetSelectedCamera() == GetCamera(name))
@@ -603,11 +606,11 @@ namespace Tizen.NUI.Scene3D
                     float aspect = destinationCamera.AspectRatio;
                     if (destinationCamera.ProjectionDirection == Camera.ProjectionDirectionType.Vertical)
                     {
-                        sourceFieldOfView = Camera.ConvertFovFromHorizontalToVertical(aspect, sourceFieldOfView);
+                        Camera.ConvertFovFromHorizontalToVertical(aspect, ref sourceFieldOfView);
                     }
                     else
                     {
-                        sourceFieldOfView = Camera.ConvertFovFromVerticalToHorizontal(aspect, sourceFieldOfView);
+                        Camera.ConvertFovFromVerticalToHorizontal(aspect, ref sourceFieldOfView);
                     }
                 }