diff --git a/ARControl/AutoRetainerControlPlugin.cs b/ARControl/AutoRetainerControlPlugin.cs index b19728f..957d1cb 100644 --- a/ARControl/AutoRetainerControlPlugin.cs +++ b/ARControl/AutoRetainerControlPlugin.cs @@ -9,13 +9,13 @@ using Dalamud.Game.Command; using Dalamud.Game.Text; using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling.Payloads; -using Dalamud.Interface; using Dalamud.Interface.Windowing; using Dalamud.Plugin; using Dalamud.Plugin.Services; using ECommons; using FFXIVClientStructs.FFXIV.Client.Game; using ImGuiNET; +using LLib; namespace ARControl; diff --git a/ARControl/IconCache.cs b/ARControl/IconCache.cs deleted file mode 100644 index ccc9c07..0000000 --- a/ARControl/IconCache.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Collections.Generic; -using Dalamud.Interface.Internal; -using Dalamud.Plugin.Services; - -namespace ARControl; - -internal sealed class IconCache : IDisposable -{ - private readonly ITextureProvider _textureProvider; - private readonly Dictionary _textureWraps = new(); - - public IconCache(ITextureProvider textureProvider) - { - _textureProvider = textureProvider; - } - - public IDalamudTextureWrap? GetIcon(uint iconId) - { - if (_textureWraps.TryGetValue(iconId, out TextureContainer? container)) - return container.Texture; - - var iconTex = _textureProvider.GetIcon(iconId); - if (iconTex != null) - { - if (iconTex.ImGuiHandle != nint.Zero) - { - _textureWraps[iconId] = new TextureContainer { Texture = iconTex }; - return iconTex; - } - - iconTex.Dispose(); - } - - _textureWraps[iconId] = new TextureContainer { Texture = null }; - return null; - } - - public void Dispose() - { - foreach (TextureContainer container in _textureWraps.Values) - container.Dispose(); - - _textureWraps.Clear(); - } - - private sealed class TextureContainer : IDisposable - { - public required IDalamudTextureWrap? Texture { get; init; } - - public void Dispose() => Texture?.Dispose(); - } -} diff --git a/LLib b/LLib index 2f6ef35..7f83ece 160000 --- a/LLib +++ b/LLib @@ -1 +1 @@ -Subproject commit 2f6ef354c401a9f1bb9b807327acad7e98662a2e +Subproject commit 7f83ece6a0c07d0fbc1902502050563b5a8c09e4