-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a042ec9
commit 1d8be18
Showing
6 changed files
with
82 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
using Dalamud.Interface.Textures; | ||
using Dalamud.Interface.Textures.TextureWraps; | ||
|
||
namespace Dalamud.Storage.Assets; | ||
|
||
/// <summary> | ||
/// Wraps a dalamud asset texture allowing interoperability with certain services. | ||
/// </summary> | ||
internal class DalamudAssetTexture : ISharedImmediateTexture | ||
{ | ||
private readonly IDalamudTextureWrap textureWrap; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="DalamudAssetTexture"/> class. | ||
/// </summary> | ||
/// <param name="textureWrap">A textureWrap loaded by <see cref="DalamudAssetManager"/>.</param> | ||
internal DalamudAssetTexture(IDalamudTextureWrap textureWrap) | ||
{ | ||
this.textureWrap = textureWrap; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public IDalamudTextureWrap GetWrapOrEmpty() | ||
{ | ||
return this.textureWrap; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public IDalamudTextureWrap? GetWrapOrDefault(IDalamudTextureWrap? defaultWrap = null) | ||
{ | ||
return this.textureWrap; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public bool TryGetWrap(out IDalamudTextureWrap? texture, out Exception? exception) | ||
{ | ||
texture = this.textureWrap; | ||
exception = null; | ||
return true; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public Task<IDalamudTextureWrap> RentAsync(CancellationToken cancellationToken = default) | ||
{ | ||
return Task.FromResult(this.textureWrap); | ||
} | ||
} |