This commit is contained in:
Liza 2024-07-03 18:58:01 +02:00
parent 7027d291ef
commit 93fac6efb0
Signed by: liza
GPG Key ID: 7199F8D727D55F67

View File

@ -17,14 +17,15 @@ public sealed class IconCache : IDisposable
_textureProvider = textureProvider; _textureProvider = textureProvider;
} }
public ISharedImmediateTexture GetIcon(uint iconId) public IDalamudTextureWrap? GetIcon(uint iconId)
{
if (!_textureWraps.TryGetValue(iconId, out ISharedImmediateTexture? iconTex))
{ {
if (_textureWraps.TryGetValue(iconId, out ISharedImmediateTexture? iconTex))
return iconTex;
iconTex = _textureProvider.GetFromGameIcon(new GameIconLookup(iconId)); iconTex = _textureProvider.GetFromGameIcon(new GameIconLookup(iconId));
_textureWraps[iconId] = iconTex; _textureWraps[iconId] = iconTex;
return iconTex; }
return iconTex.TryGetWrap(out IDalamudTextureWrap? wrap, out _) ? wrap : null;
} }
public void Dispose() public void Dispose()