mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Remove IDalamudTextureWrap.ImGuiHandle
This commit is contained in:
parent
72f5da2214
commit
54ec64e159
7 changed files with 10 additions and 40 deletions
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
|
@ -469,7 +469,7 @@ internal class TexWidget : IDataWindowWidget
|
|||
{
|
||||
_ = Service<DevTextureSaveMenu>.Get().ShowTextureSaveMenuAsync(
|
||||
this.DisplayName,
|
||||
$"{wrap.ImGuiHandle:X16}",
|
||||
$"{wrap.Handle.Handle:X16}",
|
||||
Task.FromResult(wrap.CreateWrapSharingLowLevelResource()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Interface.Textures.TextureWraps;
|
||||
|
||||
namespace Dalamud.Interface.Textures;
|
||||
|
|
@ -17,6 +16,6 @@ public static class DalamudTextureWrapExtensions
|
|||
return false;
|
||||
if (a is null)
|
||||
return false;
|
||||
return a.ImGuiHandle == b.ImGuiHandle;
|
||||
return a.Handle == b.Handle;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ internal sealed partial class TextureManager
|
|||
|
||||
try
|
||||
{
|
||||
if (textureWrap.ImGuiHandle == nint.Zero)
|
||||
if (textureWrap.Handle.IsNull)
|
||||
return textureWrap;
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
|
|
@ -103,7 +103,7 @@ internal sealed partial class TextureManager
|
|||
|
||||
try
|
||||
{
|
||||
if (textureWrap.ImGuiHandle == nint.Zero)
|
||||
if (textureWrap.Handle.IsNull)
|
||||
return textureWrap;
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ using System.Numerics;
|
|||
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Interface.Textures.TextureWraps.Internal;
|
||||
using Dalamud.Utility;
|
||||
|
||||
using TerraFX.Interop.Windows;
|
||||
|
||||
|
|
@ -19,10 +18,6 @@ public interface IDalamudTextureWrap : IDisposable
|
|||
/// <summary>Gets a texture handle suitable for direct use with ImGui functions.</summary>
|
||||
ImTextureID Handle { get; }
|
||||
|
||||
/// <summary>Gets a texture handle suitable for direct use with ImGui functions.</summary>
|
||||
[ImGuiBindingsToDo("Remove.")]
|
||||
IntPtr ImGuiHandle => new((long)this.Handle.Handle);
|
||||
|
||||
/// <summary>Gets the width of the texture.</summary>
|
||||
int Width { get; }
|
||||
|
||||
|
|
@ -38,7 +33,7 @@ public interface IDalamudTextureWrap : IDisposable
|
|||
/// <returns>The new reference to this texture wrap.</returns>
|
||||
/// <remarks>
|
||||
/// On calling this function, a new instance of <see cref="IDalamudTextureWrap"/> will be returned, but with
|
||||
/// the same <see cref="ImGuiHandle"/>. The new instance must be <see cref="IDisposable.Dispose"/>d, as the backing
|
||||
/// the same <see cref="Handle"/>. The new instance must be <see cref="IDisposable.Dispose"/>d, as the backing
|
||||
/// resource will stay alive until all the references are released. The old instance may be disposed as needed,
|
||||
/// once this function returns; the new instance will stay alive regardless of whether the old instance has been
|
||||
/// disposed.<br />
|
||||
|
|
@ -46,7 +41,7 @@ public interface IDalamudTextureWrap : IDisposable
|
|||
/// across plugin boundaries for use for an indeterminate duration, the receiver should call this function to
|
||||
/// obtain a new reference to the texture received, so that it gets its own "copy" of the texture and the caller
|
||||
/// may dispose the texture anytime without any care for the receiver.<br />
|
||||
/// The default implementation will treat <see cref="ImGuiHandle"/> as an <see cref="IUnknown"/>.
|
||||
/// The default implementation will treat <see cref="Handle"/> as an <see cref="IUnknown"/>.
|
||||
/// </remarks>
|
||||
unsafe IDalamudTextureWrap CreateWrapSharingLowLevelResource()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ internal sealed unsafe partial class DrawListTextureWrap : IDrawListTextureWrap,
|
|||
this.device.Get()->GetImmediateContext(pdc);
|
||||
|
||||
this.emptyTexture = emptyTexture;
|
||||
this.srv = new((ID3D11ShaderResourceView*)emptyTexture.ImGuiHandle);
|
||||
this.srv = new((ID3D11ShaderResourceView*)emptyTexture.Handle.Handle);
|
||||
}
|
||||
|
||||
/// <summary>Finalizes an instance of the <see cref="DrawListTextureWrap"/> class.</summary>
|
||||
|
|
@ -226,7 +226,7 @@ internal sealed unsafe partial class DrawListTextureWrap : IDrawListTextureWrap,
|
|||
this.rtvPremultiplied.Reset();
|
||||
this.width = newWidth;
|
||||
this.Height = newHeight;
|
||||
this.srv = new((ID3D11ShaderResourceView*)this.emptyTexture.ImGuiHandle);
|
||||
this.srv = new((ID3D11ShaderResourceView*)this.emptyTexture.Handle.Handle);
|
||||
return S.S_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ internal sealed class DevTextureSaveMenu : IInternalDisposableService
|
|||
var initiatorScreenOffset = ImGui.GetMousePos();
|
||||
using var textureWrap = await texture;
|
||||
var textureManager = await Service<TextureManager>.GetAsync();
|
||||
var popupName = $"{nameof(this.ShowTextureSaveMenuAsync)}_{textureWrap.ImGuiHandle:X}";
|
||||
var popupName = $"{nameof(this.ShowTextureSaveMenuAsync)}_{textureWrap.Handle.Handle:X}";
|
||||
|
||||
BitmapCodecInfo? encoder;
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
namespace Dalamud.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Utility class for marking something to be changed for when the new bindings are fully adopted, for ease of lookup.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.All, Inherited = false)]
|
||||
internal sealed class ImGuiBindingsToDoAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Marks that this should be made internal.
|
||||
/// </summary>
|
||||
public const string MakeInternal = "Make internal.";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ImGuiBindingsToDoAttribute"/> class.
|
||||
/// </summary>
|
||||
/// <param name="what">The explanation.</param>
|
||||
/// <param name="what2">The explanation 2.</param>
|
||||
public ImGuiBindingsToDoAttribute(string what, string what2 = "")
|
||||
{
|
||||
_ = what;
|
||||
_ = what2;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue