diff --git a/Dalamud/Interface/Textures/DalamudTextureWrap.cs b/Dalamud/Interface/Textures/DalamudTextureWrap.cs index 3795abad2..668e5a177 100644 --- a/Dalamud/Interface/Textures/DalamudTextureWrap.cs +++ b/Dalamud/Interface/Textures/DalamudTextureWrap.cs @@ -5,68 +5,42 @@ using ImGuiScene; // ReSharper disable once CheckNamespace namespace Dalamud.Interface.Internal; -/// -/// Safety harness for ImGuiScene textures that will defer destruction until -/// the end of the frame. -/// +/// Safety harness for ImGuiScene textures that will defer destruction until the end of the frame. +[Obsolete($"Use {nameof(IDalamudTextureWrap)}.")] +[Api10ToDo(Api10ToDoAttribute.DeleteCompatBehavior)] public class DalamudTextureWrap : IDalamudTextureWrap, IDeferredDisposable { private readonly TextureWrap wrappedWrap; - /// - /// Initializes a new instance of the class. - /// + /// Initializes a new instance of the class. /// The texture wrap to wrap. - internal DalamudTextureWrap(TextureWrap wrappingWrap) - { - this.wrappedWrap = wrappingWrap; - } + internal DalamudTextureWrap(TextureWrap wrappingWrap) => this.wrappedWrap = wrappingWrap; - /// - /// Finalizes an instance of the class. - /// - ~DalamudTextureWrap() - { - this.Dispose(false); - } + /// Finalizes an instance of the class. + ~DalamudTextureWrap() => this.Dispose(false); - /// - /// 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. - /// + /// Queue the texture to be disposed once the frame ends. public void Dispose() { this.Dispose(true); GC.SuppressFinalize(this); } - /// - /// Actually dispose the wrapped texture. - /// - void IDeferredDisposable.RealDispose() - { - this.wrappedWrap.Dispose(); - } + /// Actually dispose the wrapped texture. + void IDeferredDisposable.RealDispose() => this.wrappedWrap.Dispose(); private void Dispose(bool disposing) { if (disposing) - { Service.GetNullable()?.EnqueueDeferredDispose(this); - } } } diff --git a/Dalamud/Interface/Textures/ExistingTextureModificationArgs.cs b/Dalamud/Interface/Textures/ExistingTextureModificationArgs.cs index 9c70b52cc..d4558c7eb 100644 --- a/Dalamud/Interface/Textures/ExistingTextureModificationArgs.cs +++ b/Dalamud/Interface/Textures/ExistingTextureModificationArgs.cs @@ -20,7 +20,7 @@ public record struct ExistingTextureModificationArgs() /// . This may not necessarily /// match . /// - public int DxgiFormat { get; set; } = (int)DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM; + public int DxgiFormat { get; set; } = (int)DXGI_FORMAT.DXGI_FORMAT_UNKNOWN; /// Gets or sets the new width. /// Set to 0 to automatically calculate according to the original texture size, , and diff --git a/Dalamud/Interface/Textures/IDalamudTextureWrap.cs b/Dalamud/Interface/Textures/IDalamudTextureWrap.cs index d2915b5a0..dad453cb9 100644 --- a/Dalamud/Interface/Textures/IDalamudTextureWrap.cs +++ b/Dalamud/Interface/Textures/IDalamudTextureWrap.cs @@ -6,6 +6,7 @@ using TerraFX.Interop.Windows; // ReSharper disable once CheckNamespace namespace Dalamud.Interface.Internal; +// TODO(api10): fix namespace maybe? /// /// Base TextureWrap interface for all Dalamud-owned texture wraps. @@ -13,24 +14,16 @@ namespace Dalamud.Interface.Internal; /// public interface IDalamudTextureWrap : IDisposable { - /// - /// Gets a texture handle suitable for direct use with ImGui functions. - /// + /// Gets a texture handle suitable for direct use with ImGui functions. IntPtr ImGuiHandle { get; } - /// - /// Gets the width of the texture. - /// + /// Gets the width of the texture. int Width { get; } - /// - /// Gets the height of the texture. - /// + /// Gets the height of the texture. int Height { get; } - /// - /// Gets the size vector of the texture using Width, Height. - /// + /// Gets the size vector of the texture using Width, Height. Vector2 Size => new(this.Width, this.Height); /// diff --git a/Dalamud/Interface/Textures/ISharedImmediateTexture.cs b/Dalamud/Interface/Textures/ISharedImmediateTexture.cs index f8c727557..f9683e6c5 100644 --- a/Dalamud/Interface/Textures/ISharedImmediateTexture.cs +++ b/Dalamud/Interface/Textures/ISharedImmediateTexture.cs @@ -42,7 +42,7 @@ public interface ISharedImmediateTexture /// [return: NotNullIfNotNull(nameof(defaultWrap))] IDalamudTextureWrap? GetWrapOrDefault(IDalamudTextureWrap? defaultWrap = null); - + /// Attempts to get the texture for use with the current frame. /// An instance of that is guaranteed to be available for /// the current frame being drawn, or null if texture is not loaded (yet). diff --git a/Dalamud/Interface/Textures/ImGuiViewportTextureArgs.cs b/Dalamud/Interface/Textures/ImGuiViewportTextureArgs.cs index b53bd0f48..8193d65e6 100644 --- a/Dalamud/Interface/Textures/ImGuiViewportTextureArgs.cs +++ b/Dalamud/Interface/Textures/ImGuiViewportTextureArgs.cs @@ -17,7 +17,7 @@ public record struct ImGuiViewportTextureArgs() /// Gets or sets a value indicating whether to automatically update the texture. /// Enabling this will also update as needed. public bool AutoUpdate { get; set; } - + /// Gets or sets a value indicating whether to get the texture before rendering ImGui. /// It probably makes no sense to enable this unless points to the main viewport. /// diff --git a/Dalamud/Interface/Textures/Internal/SharedImmediateTextures/FileSystemSharedImmediateTexture.cs b/Dalamud/Interface/Textures/Internal/SharedImmediateTextures/FileSystemSharedImmediateTexture.cs index 6cdd0aa25..a98f5c940 100644 --- a/Dalamud/Interface/Textures/Internal/SharedImmediateTextures/FileSystemSharedImmediateTexture.cs +++ b/Dalamud/Interface/Textures/Internal/SharedImmediateTextures/FileSystemSharedImmediateTexture.cs @@ -43,7 +43,7 @@ internal sealed class FileSystemSharedImmediateTexture : SharedImmediateTexture private async Task CreateTextureAsync(CancellationToken cancellationToken) { - var tm = await Service.GetAsync(); + var tm = await Service.GetAsync(); return await tm.NoThrottleCreateFromFileAsync(this.path, cancellationToken); } } diff --git a/Dalamud/Interface/Textures/Internal/SharedImmediateTextures/GamePathSharedImmediateTexture.cs b/Dalamud/Interface/Textures/Internal/SharedImmediateTextures/GamePathSharedImmediateTexture.cs index 1dfe96fe2..0af66c457 100644 --- a/Dalamud/Interface/Textures/Internal/SharedImmediateTextures/GamePathSharedImmediateTexture.cs +++ b/Dalamud/Interface/Textures/Internal/SharedImmediateTextures/GamePathSharedImmediateTexture.cs @@ -48,7 +48,7 @@ internal sealed class GamePathSharedImmediateTexture : SharedImmediateTexture private async Task CreateTextureAsync(CancellationToken cancellationToken) { var dm = await Service.GetAsync(); - var tm = await Service.GetAsync(); + var tm = await Service.GetAsync(); var substPath = tm.GetSubstitutedPath(this.path); if (dm.GetFile(substPath) is not { } file) throw new FileNotFoundException(); diff --git a/Dalamud/Interface/Textures/Internal/SharedImmediateTextures/ManifestResourceSharedImmediateTexture.cs b/Dalamud/Interface/Textures/Internal/SharedImmediateTextures/ManifestResourceSharedImmediateTexture.cs index c9bdea067..62f315809 100644 --- a/Dalamud/Interface/Textures/Internal/SharedImmediateTextures/ManifestResourceSharedImmediateTexture.cs +++ b/Dalamud/Interface/Textures/Internal/SharedImmediateTextures/ManifestResourceSharedImmediateTexture.cs @@ -57,7 +57,7 @@ internal sealed class ManifestResourceSharedImmediateTexture : SharedImmediateTe if (stream is null) throw new FileNotFoundException("The resource file could not be found."); - var tm = await Service.GetAsync(); + var tm = await Service.GetAsync(); var ms = new MemoryStream(stream.CanSeek ? (int)stream.Length : 0); await stream.CopyToAsync(ms, cancellationToken); return tm.NoThrottleCreateFromImage(ms.GetBuffer().AsMemory(0, (int)ms.Length), cancellationToken); diff --git a/Dalamud/Interface/Textures/Internal/UnknownTextureWrap.cs b/Dalamud/Interface/Textures/Internal/UnknownTextureWrap.cs index 24e9a8bc1..c159f9b36 100644 --- a/Dalamud/Interface/Textures/Internal/UnknownTextureWrap.cs +++ b/Dalamud/Interface/Textures/Internal/UnknownTextureWrap.cs @@ -7,16 +7,12 @@ using TerraFX.Interop.Windows; namespace Dalamud.Interface.Textures.Internal; -/// -/// A texture wrap that is created by cloning the underlying . -/// +/// A texture wrap that is created from an . internal sealed unsafe class UnknownTextureWrap : IDalamudTextureWrap, IDeferredDisposable { private IntPtr imGuiHandle; - /// - /// Initializes a new instance of the class. - /// + /// Initializes a new instance of the class. /// The pointer to that is suitable for use with /// . /// The width of the texture. @@ -32,9 +28,7 @@ internal sealed unsafe class UnknownTextureWrap : IDalamudTextureWrap, IDeferred unknown->AddRef(); } - /// - /// Finalizes an instance of the class. - /// + /// Finalizes an instance of the class. ~UnknownTextureWrap() => this.Dispose(false); /// @@ -49,18 +43,14 @@ internal sealed unsafe class UnknownTextureWrap : IDalamudTextureWrap, IDeferred /// public int Height { get; } - /// - /// Queue the texture to be disposed once the frame ends. - /// + /// Queue the texture to be disposed once the frame ends. public void Dispose() { this.Dispose(true); GC.SuppressFinalize(this); } - /// - /// Actually dispose the wrapped texture. - /// + /// Actually dispose the wrapped texture. void IDeferredDisposable.RealDispose() { var handle = Interlocked.Exchange(ref this.imGuiHandle, nint.Zero); diff --git a/Dalamud/Interface/Textures/Internal/ViewportTextureWrap.cs b/Dalamud/Interface/Textures/Internal/ViewportTextureWrap.cs index 28e8f6e3d..099361907 100644 --- a/Dalamud/Interface/Textures/Internal/ViewportTextureWrap.cs +++ b/Dalamud/Interface/Textures/Internal/ViewportTextureWrap.cs @@ -89,7 +89,7 @@ internal sealed class ViewportTextureWrap : IDalamudTextureWrap, IDeferredDispos bottom = (uint)MathF.Round(newDesc.Height * this.args.Uv1Effective.Y), front = 0, back = 1, - }; + }; if (this.desc.Width != copyBox.right - copyBox.left || this.desc.Height != copyBox.bottom - copyBox.top diff --git a/Dalamud/Interface/Textures/RawImageSpecification.cs b/Dalamud/Interface/Textures/RawImageSpecification.cs index 083e12bad..2abf3729d 100644 --- a/Dalamud/Interface/Textures/RawImageSpecification.cs +++ b/Dalamud/Interface/Textures/RawImageSpecification.cs @@ -21,8 +21,8 @@ public record struct RawImageSpecification throw new NotSupportedException(FormatNotSupportedMessage); pitch = isBlockCompression - ? Math.Max(1, (width + 3) / 4) * 2 * bitsPerPixel - : ((width * bitsPerPixel) + 7) / 8; + ? Math.Max(1, (width + 3) / 4) * 2 * bitsPerPixel + : ((width * bitsPerPixel) + 7) / 8; } this.Width = width;