using System;
using ImGuiScene;
namespace Dalamud.Interface.Internal;
///
/// Safety harness for ImGuiScene textures that will defer destruction until
/// the end of the frame.
///
public class DalamudTextureWrap : TextureWrap
{
private readonly TextureWrap wrappedWrap;
///
/// Initializes a new instance of the class.
///
/// The texture wrap to wrap.
internal DalamudTextureWrap(TextureWrap wrappingWrap)
{
this.wrappedWrap = wrappingWrap;
}
///
/// Gets the ImGui handle of the texture.
///
public IntPtr ImGuiHandle => this.wrappedWrap.ImGuiHandle;
///
/// Gets the width of the texture.
///
public int Width => this.wrappedWrap.Width;
///
/// Gets the height of the texture.
///
public int Height => this.wrappedWrap.Height;
///
/// Queue the texture to be disposed once the frame ends.
///
public void Dispose()
{
Service.Get().EnqueueDeferredDispose(this);
}
///
/// Actually dispose the wrapped texture.
///
internal void RealDispose()
{
this.wrappedWrap.Dispose();
}
}