mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-23 00:07:49 +01:00
fix: return DalamudTextureWrap from LoadImageFromDxgiFormat(), cast explicitly
This commit is contained in:
parent
426e7f53ef
commit
ebc4baca58
2 changed files with 7 additions and 3 deletions
|
|
@ -325,7 +325,7 @@ internal class InterfaceManager : IDisposable, IServiceType
|
||||||
/// <param name="height">The height in pixels.</param>
|
/// <param name="height">The height in pixels.</param>
|
||||||
/// <param name="dxgiFormat">Format of the texture.</param>
|
/// <param name="dxgiFormat">Format of the texture.</param>
|
||||||
/// <returns>A texture, ready to use in ImGui.</returns>
|
/// <returns>A texture, ready to use in ImGui.</returns>
|
||||||
public TextureWrap LoadImageFromDxgiFormat(Span<byte> data, int pitch, int width, int height, Format dxgiFormat)
|
public IDalamudTextureWrap LoadImageFromDxgiFormat(Span<byte> data, int pitch, int width, int height, Format dxgiFormat)
|
||||||
{
|
{
|
||||||
if (this.scene == null)
|
if (this.scene == null)
|
||||||
throw new InvalidOperationException("Scene isn't ready.");
|
throw new InvalidOperationException("Scene isn't ready.");
|
||||||
|
|
@ -360,7 +360,7 @@ internal class InterfaceManager : IDisposable, IServiceType
|
||||||
}
|
}
|
||||||
|
|
||||||
// no sampler for now because the ImGui implementation we copied doesn't allow for changing it
|
// no sampler for now because the ImGui implementation we copied doesn't allow for changing it
|
||||||
return new D3DTextureWrap(resView, width, height);
|
return new DalamudTextureWrap(new D3DTextureWrap(resView, width, height));
|
||||||
}
|
}
|
||||||
|
|
||||||
#nullable restore
|
#nullable restore
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ internal class TextureManager : IDisposable, IServiceType, ITextureSubstitutionP
|
||||||
throw new InvalidOperationException("Cannot create textures before scene is ready");
|
throw new InvalidOperationException("Cannot create textures before scene is ready");
|
||||||
|
|
||||||
#pragma warning disable CS0618
|
#pragma warning disable CS0618
|
||||||
return this.dataManager.GetImGuiTexture(file) as IDalamudTextureWrap;
|
return (IDalamudTextureWrap)this.dataManager.GetImGuiTexture(file);
|
||||||
#pragma warning restore CS0618
|
#pragma warning restore CS0618
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -332,6 +332,10 @@ internal class TextureManager : IDisposable, IServiceType, ITextureSubstitutionP
|
||||||
// and we can't do anything about it. Return a dummy texture so that the plugin still
|
// and we can't do anything about it. Return a dummy texture so that the plugin still
|
||||||
// has something to draw.
|
// has something to draw.
|
||||||
wrap = this.fallbackTextureWrap;
|
wrap = this.fallbackTextureWrap;
|
||||||
|
|
||||||
|
// Prevent divide-by-zero
|
||||||
|
if (info.Extents == Vector2.Zero)
|
||||||
|
info.Extents = Vector2.One;
|
||||||
}
|
}
|
||||||
|
|
||||||
info.Wrap = wrap;
|
info.Wrap = wrap;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue