Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebase API11 to DevelNUI #5855

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ internal static partial class NativeImageQueue
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_NativeImageQueuePtr")]
public static extern IntPtr NewHandle(uint width, uint height, int colorFormat);

[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_NativeImageQueuePtr_2")]
public static extern IntPtr NewHandle(uint queueCount, uint width, uint height, int colorFormat);

[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_NativeImageQueue_GetPtr")]
public static extern IntPtr Get(IntPtr queue);

Expand All @@ -41,6 +44,9 @@ internal static partial class NativeImageQueue
[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
public static extern bool EnqueueBuffer(IntPtr queue, IntPtr buffer);

[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_NativeImageQueue_GetQueueCount")]
public static extern uint GetQueueCount(IntPtr queue);

[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_NativeImageQueue_GenerateUrl")]
public static extern IntPtr GenerateUrl(IntPtr queue);
}
Expand Down
38 changes: 38 additions & 0 deletions src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ private string InternalURL
currentStates.framePlayRangeMin = -1;
currentStates.framePlayRangeMax = -1;
currentStates.totalFrame = -1;
currentStates.enableFrameCache = false;

string ret = (value == null ? "" : value);
currentStates.url = ret;
Expand Down Expand Up @@ -534,6 +535,42 @@ private bool InternalRedrawInScalingDown
return currentStates.redrawInScalingDown;
}
}


[EditorBrowsable(EditorBrowsableState.Never)]
public bool EnableFrameCache
{
get
{
return (bool)GetValue(EnableFrameCacheProperty);
}
set
{
SetValue(EnableFrameCacheProperty, value);
NotifyPropertyChanged();
}
}

private bool InternalEnableFrameCache
{
set
{
if (currentStates.enableFrameCache != value)
{
currentStates.changed = true;
currentStates.enableFrameCache = value;

NUILog.Debug($"<[{GetId()}]SET currentStates.EnableFrameCache={currentStates.enableFrameCache}>");

Interop.View.InternalUpdateVisualPropertyBool(this.SwigCPtr, ImageView.Property.IMAGE, ImageVisualProperty.EnableFrameCache, currentStates.enableFrameCache);
}
}
get
{
NUILog.Debug($"EnableFrameCache get! {currentStates.enableFrameCache}");
return currentStates.enableFrameCache;
}
}
#endregion Property


Expand Down Expand Up @@ -1252,6 +1289,7 @@ private struct states
internal bool redrawInScalingDown;
internal int desiredWidth, desiredHeight;
internal bool synchronousLoading;
internal bool enableFrameCache;
internal bool changed;
};
private states currentStates;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,23 @@ public partial class LottieAnimationView
var instance = (Tizen.NUI.BaseComponents.LottieAnimationView)bindable;
return instance.InternalRedrawInScalingDown;
});

/// <summary>
/// EnableFrameCacheProperty
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static readonly BindableProperty EnableFrameCacheProperty = BindableProperty.Create(nameof(EnableFrameCache), typeof(bool), typeof(Tizen.NUI.BaseComponents.LottieAnimationView), false, propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Tizen.NUI.BaseComponents.LottieAnimationView)bindable;
if (newValue != null)
{
instance.InternalEnableFrameCache = (bool)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Tizen.NUI.BaseComponents.LottieAnimationView)bindable;
return instance.InternalEnableFrameCache;
});
}
}
29 changes: 28 additions & 1 deletion src/Tizen.NUI/src/public/Images/NativeImageQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,22 @@ public enum ColorFormat
/// <param name="colorFormat">A color format of queue.</param>
/// <returns>A NativeImageQueue.</returns>
[EditorBrowsable(EditorBrowsableState.Never)]
public NativeImageQueue(uint width, uint height, ColorFormat colorFormat) : this(Interop.NativeImageQueue.NewHandle(width, height, (int)colorFormat), true)
public NativeImageQueue(uint width, uint height, ColorFormat colorFormat) : this(0, width, height, colorFormat)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}

/// <summary>
/// Creates an initialized NativeImageQueue with queue count and size and color format.
/// </summary>
/// <remarks>Since queueCount can increase the memory usage, we recommened queueCount value is less or equal than 3.</remarks>
/// <param name="queueCount">The number of queue count. Use system default value if it is 0.</param>
/// <param name="width">A Width of queue.</param>
/// <param name="height">A Height of queue.</param>
/// <param name="colorFormat">A color format of queue.</param>
/// <returns>A NativeImageQueue.</returns>
[EditorBrowsable(EditorBrowsableState.Never)]
public NativeImageQueue(uint queueCount, uint width, uint height, ColorFormat colorFormat) : this(Interop.NativeImageQueue.NewHandle(queueCount, width, height, (int)colorFormat), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
Expand All @@ -97,6 +112,18 @@ internal NativeImageQueue(IntPtr cPtr, bool cMemoryOwn) : base(Interop.NativeIma
handle = cPtr;
}

/// <summary>
/// The number of queue.
/// </summary>
/// <remarks>Hidden API: Only for inhouse or developing usage. The behavior and interface can be changed anytime.</remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
public uint GetQueueCount()
{
uint ret = Interop.NativeImageQueue.GetQueueCount(this.SwigCPtr.Handle);
NDalicPINVOKE.ThrowExceptionIfExists();
return ret;
}

/// <summary>
/// Generate Url from native image queue.
/// </summary>
Expand Down
11 changes: 11 additions & 0 deletions src/Tizen.NUI/src/public/Visuals/VisualConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,17 @@ public struct ImageVisualProperty
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static readonly int MarkerInfo = NDalic.ImageVisualOrientationCorrection + 15;

/// <summary>
/// @brief Whether to animated image visual uses fixed cache or not.
/// @details type Property::BOOLEAN.
/// If this property is true, animated image visual uses fixed cache for loading and keeps loaded frame
/// until the visual is removed. It reduces CPU cost when the animated image will be looping.
/// But it can spend a lot of memory if the resource has high resolution image or many frame count.
/// @note It is used in the AnimatedImageVisual. The default is false
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static readonly int EnableFrameCache = NDalic.ImageVisualOrientationCorrection + 16;
}

/// <summary>
Expand Down
Loading