From 530ea6fd7c58acdea78ff20b9deb0eb7fd5d7972 Mon Sep 17 00:00:00 2001 From: Woochan Lee Date: Wed, 8 Jan 2025 19:01:46 +0900 Subject: [PATCH] [NUI] PivotPoint - Remove unnecessary PInvoke calls --- .../src/public/Common/NUIConstants.cs | 173 ++++-------------- 1 file changed, 38 insertions(+), 135 deletions(-) diff --git a/src/Tizen.NUI/src/public/Common/NUIConstants.cs b/src/Tizen.NUI/src/public/Common/NUIConstants.cs index 58cb76e2eb1..434e9944944 100755 --- a/src/Tizen.NUI/src/public/Common/NUIConstants.cs +++ b/src/Tizen.NUI/src/public/Common/NUIConstants.cs @@ -1424,198 +1424,101 @@ public struct ParentOrigin /// 3 public struct PivotPoint { + private static readonly Position topLeft = new Position(Top, Left, Middle); + private static readonly Position topCenter = new Position(Top, Middle, Middle); + private static readonly Position topRight = new Position(Top, Right, Middle); + private static readonly Position centerLeft = new Position(Middle, Left, Middle); + private static readonly Position center = new Position(Middle, Middle, Middle); + private static readonly Position centerRight = new Position(Middle, Right, Middle); + private static readonly Position bottomLeft = new Position(Bottom, Left, Middle); + private static readonly Position bottomCenter = new Position(Bottom, Middle, Middle); + private static readonly Position bottomRight = new Position(Bottom, Right, Middle); + /// /// Top /// /// 3 - public static float Top - { - get - { - float ret = Interop.NDalicAnchorPoint.AnchorPointTopGet(); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static float Top => 0.0f; + /// /// Bottom /// /// 3 - public static float Bottom - { - get - { - float ret = Interop.NDalicAnchorPoint.AnchorPointBottomGet(); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static float Bottom => 1.0f; + /// /// Left /// /// 3 - public static float Left - { - get - { - float ret = Interop.NDalicAnchorPoint.AnchorPointLeftGet(); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static float Left => 0.0f; + /// /// Right /// /// 3 - public static float Right - { - get - { - float ret = Interop.NDalicAnchorPoint.AnchorPointRightGet(); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static float Right => 1.0f; + /// /// Middle /// /// 3 - public static float Middle - { - get - { - float ret = Interop.NDalicAnchorPoint.AnchorPointMiddleGet(); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static float Middle => 0.5f; + /// /// TopLeft /// /// 3 - public static Position TopLeft - { - get - { - global::System.IntPtr cPtr = Interop.NDalicAnchorPoint.AnchorPointTopLeftGet(); - Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static Position TopLeft => topLeft; + /// /// TopCenter /// /// 3 - public static Position TopCenter - { - get - { - global::System.IntPtr cPtr = Interop.NDalicAnchorPoint.AnchorPointTopCenterGet(); - Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static Position TopCenter => topCenter; + /// /// TopRight /// /// 3 - public static Position TopRight - { - get - { - global::System.IntPtr cPtr = Interop.NDalicAnchorPoint.AnchorPointTopRightGet(); - Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static Position TopRight => topRight; + /// /// CenterLeft /// /// 3 - public static Position CenterLeft - { - get - { - global::System.IntPtr cPtr = Interop.NDalicAnchorPoint.AnchorPointCenterLeftGet(); - Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static Position CenterLeft => centerLeft; + /// /// Center /// /// 3 - public static Position Center - { - get - { - global::System.IntPtr cPtr = Interop.NDalicAnchorPoint.AnchorPointCenterGet(); - Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static Position Center => center; + /// /// CenterRight /// /// 3 - public static Position CenterRight - { - get - { - global::System.IntPtr cPtr = Interop.NDalicAnchorPoint.AnchorPointCenterRightGet(); - Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static Position CenterRight => centerRight; + /// /// BottomLeft /// /// 3 - public static Position BottomLeft - { - get - { - global::System.IntPtr cPtr = Interop.NDalicAnchorPoint.AnchorPointBottomLeftGet(); - Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static Position BottomLeft => bottomLeft; + /// /// BottomCenter /// /// 3 - public static Position BottomCenter - { - get - { - global::System.IntPtr cPtr = Interop.NDalicAnchorPoint.AnchorPointBottomCenterGet(); - Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static Position BottomCenter => bottomCenter; + /// /// BottomRight /// /// 3 - public static Position BottomRight - { - get - { - global::System.IntPtr cPtr = Interop.NDalicAnchorPoint.AnchorPointBottomRightGet(); - Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); - return ret; - } - } + public static Position BottomRight => bottomRight; } + /// /// PositionAxis constants. ///