diff --git a/Dalamud/Interface/Internal/SharedImmediateTextures/FileSystemSharedImmediateTexture.cs b/Dalamud/Interface/Internal/SharedImmediateTextures/FileSystemSharedImmediateTexture.cs index aac2169b9..f74379c28 100644 --- a/Dalamud/Interface/Internal/SharedImmediateTextures/FileSystemSharedImmediateTexture.cs +++ b/Dalamud/Interface/Internal/SharedImmediateTextures/FileSystemSharedImmediateTexture.cs @@ -6,16 +6,12 @@ using Dalamud.Utility; namespace Dalamud.Interface.Internal.SharedImmediateTextures; -/// -/// Represents a sharable texture, based on a file on the system filesystem. -/// +/// Represents a sharable texture, based on a file on the system filesystem. internal sealed class FileSystemSharedImmediateTexture : SharedImmediateTexture { private readonly string path; - /// - /// Initializes a new instance of the class. - /// + /// Initializes a new instance of the class. /// The path. /// If set to true, this class will hold a reference to self. /// Otherwise, it is expected that the caller to hold the reference. @@ -30,18 +26,14 @@ internal sealed class FileSystemSharedImmediateTexture : SharedImmediateTexture /// public override string SourcePathForDebug => this.path; - /// - /// Creates a new instance of . - /// The new instance will hold a reference to itself. - /// + /// Creates a new instance of . + /// The new instance will hold a reference to itself. /// The path. /// The new instance. public static SharedImmediateTexture CreateImmediate(string path) => new FileSystemSharedImmediateTexture(path, true); - /// - /// Creates a new instance of . - /// The caller is expected to manage ownership of the new instance. - /// + /// Creates a new instance of . + /// The caller is expected to manage ownership of the new instance. /// The path. /// The new instance. public static SharedImmediateTexture CreateAsync(string path) => new FileSystemSharedImmediateTexture(path, false); diff --git a/Dalamud/Interface/Internal/SharedImmediateTextures/GamePathSharedImmediateTexture.cs b/Dalamud/Interface/Internal/SharedImmediateTextures/GamePathSharedImmediateTexture.cs index 6c709321f..c06669372 100644 --- a/Dalamud/Interface/Internal/SharedImmediateTextures/GamePathSharedImmediateTexture.cs +++ b/Dalamud/Interface/Internal/SharedImmediateTextures/GamePathSharedImmediateTexture.cs @@ -9,16 +9,12 @@ using Lumina.Data.Files; namespace Dalamud.Interface.Internal.SharedImmediateTextures; -/// -/// Represents a sharable texture, based on a file in game resources. -/// +/// Represents a sharable texture, based on a file in game resources. internal sealed class GamePathSharedImmediateTexture : SharedImmediateTexture { private readonly string path; - /// - /// Initializes a new instance of the class. - /// + /// Initializes a new instance of the class. /// The path. /// If set to true, this class will hold a reference to self. /// Otherwise, it is expected that the caller to hold the reference. @@ -33,18 +29,14 @@ internal sealed class GamePathSharedImmediateTexture : SharedImmediateTexture /// public override string SourcePathForDebug => this.path; - /// - /// Creates a new instance of . - /// The new instance will hold a reference to itself. - /// + /// Creates a new instance of . + /// The new instance will hold a reference to itself. /// The path. /// The new instance. public static SharedImmediateTexture CreateImmediate(string path) => new GamePathSharedImmediateTexture(path, true); - /// - /// Creates a new instance of . - /// The caller is expected to manage ownership of the new instance. - /// + /// Creates a new instance of . + /// The caller is expected to manage ownership of the new instance. /// The path. /// The new instance. public static SharedImmediateTexture CreateAsync(string path) => new GamePathSharedImmediateTexture(path, false); diff --git a/Dalamud/Interface/Internal/SharedImmediateTextures/SharedImmediateTexture.cs b/Dalamud/Interface/Internal/SharedImmediateTextures/SharedImmediateTexture.cs index 88316b135..b929a6faf 100644 --- a/Dalamud/Interface/Internal/SharedImmediateTextures/SharedImmediateTexture.cs +++ b/Dalamud/Interface/Internal/SharedImmediateTextures/SharedImmediateTexture.cs @@ -8,9 +8,7 @@ using Dalamud.Utility; namespace Dalamud.Interface.Internal.SharedImmediateTextures; -/// -/// Represents a texture that may have multiple reference holders (owners). -/// +/// Represents a texture that may have multiple reference holders (owners). internal abstract class SharedImmediateTexture : ISharedImmediateTexture, IRefCountable, TextureLoadThrottler.IThrottleBasisProvider { @@ -28,9 +26,7 @@ internal abstract class SharedImmediateTexture private CancellationTokenSource? cancellationTokenSource; private NotOwnedTextureWrap? nonOwningWrap; - /// - /// Initializes a new instance of the class. - /// + /// Initializes a new instance of the class. /// If set to true, this class will hold a reference to self. /// Otherwise, it is expected that the caller to hold the reference. protected SharedImmediateTexture(bool holdSelfReference) @@ -58,37 +54,26 @@ internal abstract class SharedImmediateTexture this.FirstRequestedTick = this.LatestRequestedTick = Environment.TickCount64; } - /// - /// Gets the instance ID. Debug use only. - /// + /// Gets the instance ID. Debug use only. public long InstanceIdForDebug { get; } - /// - /// Gets the remaining time for self reference in milliseconds. Debug use only. - /// + /// Gets the remaining time for self reference in milliseconds. Debug use only. public long SelfReferenceExpiresInForDebug => this.selfReferenceExpiry == SelfReferenceExpiryExpired ? 0 : Math.Max(0, this.selfReferenceExpiry - Environment.TickCount64); - /// - /// Gets the reference count. Debug use only. - /// + /// Gets the reference count. Debug use only. public int RefCountForDebug => this.refCount; - /// - /// Gets the source path. Debug use only. - /// + /// Gets the source path. Debug use only. public abstract string SourcePathForDebug { get; } - /// - /// Gets a value indicating whether this instance of supports revival. + /// Gets a value indicating whether this instance of supports revival. /// public bool HasRevivalPossibility => this.RevivalPossibility?.TryGetTarget(out _) is true; - /// - /// Gets or sets the underlying texture wrap. - /// + /// Gets or sets the underlying texture wrap. public Task? UnderlyingWrap { get; set; } /// @@ -100,21 +85,15 @@ internal abstract class SharedImmediateTexture /// public long LatestRequestedTick { get; private set; } - /// - /// Gets a value indicating whether the content has been queried, - /// i.e. or is called. - /// + /// Gets a value indicating whether the content has been queried, + /// i.e. or is called. public bool ContentQueried { get; private set; } - /// - /// Gets a cancellation token for cancelling load. - /// Intended to be called from implementors' constructors and . - /// + /// Gets a cancellation token for cancelling load. + /// Intended to be called from implementors' constructors and . protected CancellationToken LoadCancellationToken => this.cancellationTokenSource?.Token ?? default; - /// - /// Gets or sets a weak reference to an object that demands this objects to be alive. - /// + /// Gets or sets a weak reference to an object that demands this objects to be alive. /// /// TextureManager must keep references to all shared textures, regardless of whether textures' contents are /// flushed, because API9 functions demand that the returned textures may be stored so that they can used anytime, @@ -184,9 +163,7 @@ internal abstract class SharedImmediateTexture } } - /// - /// Releases self-reference, if conditions are met. - /// + /// Releases self-reference, if conditions are met. /// If set to true, the self-reference will be released immediately. /// Number of the new reference count that may or may not have changed. public int ReleaseSelfReference(bool immediate) @@ -280,9 +257,7 @@ internal abstract class SharedImmediateTexture return new RefCountableWrappingTextureWrap(dtw, this); } - /// - /// Gets a texture wrap which ensures that the values will be populated on access. - /// + /// Gets a texture wrap which ensures that the values will be populated on access. /// The texture wrap, or null if failed. [Api10ToDo(Api10ToDoAttribute.DeleteCompatBehavior)] public IDalamudTextureWrap? GetAvailableOnAccessWrapForApi9() @@ -311,14 +286,10 @@ internal abstract class SharedImmediateTexture return this.availableOnAccessWrapForApi9; } - /// - /// Cleans up this instance of . - /// + /// Cleans up this instance of . protected abstract void ReleaseResources(); - /// - /// Attempts to restore the reference to this texture. - /// + /// Attempts to restore the reference to this texture. protected abstract void ReviveResources(); private IRefCountable.RefCountResult TryAddRef(out int newRefCount) diff --git a/Dalamud/Interface/Internal/TextureManager.cs b/Dalamud/Interface/Internal/TextureManager.cs index 65b290076..bd35ab97b 100644 --- a/Dalamud/Interface/Internal/TextureManager.cs +++ b/Dalamud/Interface/Internal/TextureManager.cs @@ -26,9 +26,7 @@ using SharpDX.DXGI; namespace Dalamud.Interface.Internal; -/// -/// Service responsible for loading and disposing ImGui texture wraps. -/// +/// Service responsible for loading and disposing ImGui texture wraps. [PluginInterface] [InterfaceVersion("1.0")] [ServiceManager.BlockingEarlyLoadedService] @@ -73,25 +71,19 @@ internal sealed class TextureManager : IServiceType, IDisposable, ITextureProvid /// public event ITextureSubstitutionProvider.TextureDataInterceptorDelegate? InterceptTexDataLoad; - /// - /// Gets all the loaded textures from the game resources. Debug use only. - /// - public ICollection GamePathTextures => this.gamePathTextures.Values; + /// Gets all the loaded textures from the game resources. + public ICollection GamePathTexturesForDebug => this.gamePathTextures.Values; - /// - /// Gets all the loaded textures from the game resources. Debug use only. - /// - public ICollection FileSystemTextures => this.fileSystemTextures.Values; + /// Gets all the loaded textures from the game resources. + public ICollection FileSystemTexturesForDebug => this.fileSystemTextures.Values; - /// - /// Gets all the loaded textures that are invalidated from . Debug use only. - /// + /// Gets all the loaded textures that are invalidated from . /// lock on use of the value returned from this property. [SuppressMessage( "ReSharper", "InconsistentlySynchronizedField", Justification = "Debug use only; users are expected to lock around this")] - public ICollection InvalidatedTextures => this.invalidatedTextures; + public ICollection InvalidatedTexturesForDebug => this.invalidatedTextures; /// public void Dispose() @@ -435,10 +427,8 @@ internal sealed class TextureManager : IServiceType, IDisposable, ITextureProvid } } - /// - /// Gets a texture from the given image. Skips the load throttler; intended to be used from implementation of - /// s. - /// + /// Gets a texture from the given image. Skips the load throttler; intended to be used from implementation + /// of s. /// The data. /// The loaded texture. internal IDalamudTextureWrap NoThrottleGetFromImage(ReadOnlyMemory bytes) @@ -454,10 +444,8 @@ internal sealed class TextureManager : IServiceType, IDisposable, ITextureProvid ?? throw new("Failed to load image because of an unknown reason.")); } - /// - /// Gets a texture from the given . Skips the load throttler; intended to be used from - /// implementation of s. - /// + /// Gets a texture from the given . Skips the load throttler; intended to be used from + /// implementation of s. /// The data. /// The loaded texture. internal IDalamudTextureWrap NoThrottleGetFromTexFile(TexFile file) diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs index 2a4222c5b..c75a0c629 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs @@ -65,21 +65,21 @@ internal class TexWidget : IDataWindowWidget GC.Collect(); ImGui.PushID("loadedGameTextures"); - if (ImGui.CollapsingHeader($"Loaded Game Textures: {this.textureManager.GamePathTextures.Count:g}###header")) - this.DrawLoadedTextures(this.textureManager.GamePathTextures); + if (ImGui.CollapsingHeader($"Loaded Game Textures: {this.textureManager.GamePathTexturesForDebug.Count:g}###header")) + this.DrawLoadedTextures(this.textureManager.GamePathTexturesForDebug); ImGui.PopID(); ImGui.PushID("loadedFileTextures"); - if (ImGui.CollapsingHeader($"Loaded File Textures: {this.textureManager.FileSystemTextures.Count:g}###header")) - this.DrawLoadedTextures(this.textureManager.FileSystemTextures); + if (ImGui.CollapsingHeader($"Loaded File Textures: {this.textureManager.FileSystemTexturesForDebug.Count:g}###header")) + this.DrawLoadedTextures(this.textureManager.FileSystemTexturesForDebug); ImGui.PopID(); - lock (this.textureManager.InvalidatedTextures) + lock (this.textureManager.InvalidatedTexturesForDebug) { ImGui.PushID("invalidatedTextures"); - if (ImGui.CollapsingHeader($"Invalidated: {this.textureManager.InvalidatedTextures.Count:g}###header")) + if (ImGui.CollapsingHeader($"Invalidated: {this.textureManager.InvalidatedTexturesForDebug.Count:g}###header")) { - this.DrawLoadedTextures(this.textureManager.InvalidatedTextures); + this.DrawLoadedTextures(this.textureManager.InvalidatedTexturesForDebug); } ImGui.PopID();