From 183047bee19b2ddc8c7dc7bda9dc5b085bd38e6c Mon Sep 17 00:00:00 2001 From: jmm Date: Wed, 11 Dec 2024 14:45:40 +0900 Subject: [PATCH] [NUI] Add View.OffScreenRendering property Signed-off-by: jmm --- .../internal/Interop/Interop.ViewProperty.cs | 3 ++ .../src/public/BaseComponents/View.cs | 33 ++++++++++++++++++- .../src/public/BaseComponents/ViewEnum.cs | 27 +++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.ViewProperty.cs b/src/Tizen.NUI/src/internal/Interop/Interop.ViewProperty.cs index 879dfea3c2c..4be6ff4dbf2 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.ViewProperty.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.ViewProperty.cs @@ -92,6 +92,9 @@ internal static partial class ViewProperty [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_View_Property_AUTOMATION_ID_get")] public static extern int AutomationIdGet(); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_View_Property_OFFSCREEN_RENDERING_get")] + public static extern int OffScreenRenderingGet(); } } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index cceabf2b545..5afa20ab158 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -429,7 +429,6 @@ static View() DispatchHoverMotionProperty = BindableProperty.Create(nameof(DispatchHoverMotion), typeof(bool), typeof(View), false, propertyChanged: SetInternalDispatchHoverMotionProperty, defaultValueCreator: GetInternalDispatchHoverMotionProperty); - RegisterPropertyGroup(PositionProperty, positionPropertyGroup); RegisterPropertyGroup(Position2DProperty, positionPropertyGroup); RegisterPropertyGroup(PositionXProperty, positionPropertyGroup); @@ -5990,5 +5989,37 @@ public string VoiceInteractionName return AutomationId; } } + + /// + /// Gets of sets the current offscreen rendering type of the view. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public OffScreenRenderingType OffScreenRendering + { + get + { + return GetInternalOffScreenRendering(); + } + set + { + SetInternalOffScreenRendering(value); + NotifyPropertyChanged(); + } + } + private void SetInternalOffScreenRendering(OffScreenRenderingType value) + { + Object.InternalSetPropertyInt(SwigCPtr, Property.OffScreenRendering, (int)value); + } + private OffScreenRenderingType GetInternalOffScreenRendering() + { + int temp = Object.InternalGetPropertyInt(SwigCPtr, Property.OffScreenRendering); + switch (temp) + { + case 0: return OffScreenRenderingType.None; + case 1: return OffScreenRenderingType.RefreshOnce; + case 2: return OffScreenRenderingType.RefreshAlways; + default: return OffScreenRenderingType.None; + } + } } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewEnum.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewEnum.cs index c7bc20d6663..35792fd1ad6 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewEnum.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewEnum.cs @@ -163,6 +163,32 @@ public enum FocusDirection CounterClockwise, } + /// + /// Describes offscreen rendering types. + /// View with this property enabled renders at offscreen buffer, with all its children. + /// The property expects to reduce many repetitive render calls. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public enum OffScreenRenderingType + { + /// + /// No offscreen rendering. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + None, + /// + /// Draw offscreen only once. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + RefreshOnce, + /// + /// Draw offscreen every frame. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + RefreshAlways, + }; + + /// /// Actions property value to update visual property. /// Note : Only few kind of properies can be update. Update with invalid property action is undefined. @@ -266,6 +292,7 @@ internal class Property internal static readonly int UpdateAreaHint = Interop.ActorProperty.UpdateAreaHintGet(); internal static readonly int DispatchTouchMotion = Interop.ActorProperty.DispatchTouchMotionGet(); internal static readonly int DispatchHoverMotion = Interop.ActorProperty.DispatchHoverMotionGet(); + internal static readonly int OffScreenRendering = Interop.ViewProperty.OffScreenRenderingGet(); } } }