This commit is contained in:
Soreepeong 2024-02-28 21:17:50 +09:00
parent cc756c243c
commit ca986b46a2
6 changed files with 69 additions and 67 deletions

View file

@ -343,7 +343,7 @@ internal sealed class TextureManager : IServiceType, IDisposable, ITextureProvid
cancellationToken);
/// <inheritdoc/>
public bool SupportsDxgiFormat(int dxgiFormat)
public bool IsDxgiFormatSupported(int dxgiFormat)
{
if (this.interfaceManager.Scene is not { } scene)
{
@ -516,7 +516,7 @@ internal sealed class TextureManager : IServiceType, IDisposable, ITextureProvid
var buffer = file.TextureBuffer;
var (dxgiFormat, conversion) = TexFile.GetDxgiFormatFromTextureFormat(file.Header.Format, false);
if (conversion != TexFile.DxgiFormatConversion.NoConversion || !this.SupportsDxgiFormat(dxgiFormat))
if (conversion != TexFile.DxgiFormatConversion.NoConversion || !this.IsDxgiFormatSupported(dxgiFormat))
{
dxgiFormat = (int)Format.B8G8R8A8_UNorm;
buffer = buffer.Filter(0, 0, TexFile.TextureFormat.B8G8R8A8);

View file

@ -107,31 +107,31 @@ internal class TexWidget : IDataWindowWidget
ImGui.PopID();
}
if (ImGui.CollapsingHeader("Load Game File by Icon ID", ImGuiTreeNodeFlags.DefaultOpen))
if (ImGui.CollapsingHeader(nameof(ITextureProvider.GetFromGameIcon), ImGuiTreeNodeFlags.DefaultOpen))
{
ImGui.PushID(nameof(this.DrawIconInput));
this.DrawIconInput();
ImGui.PushID(nameof(this.DrawGetFromGameIcon));
this.DrawGetFromGameIcon();
ImGui.PopID();
}
if (ImGui.CollapsingHeader("Load Game File by Path", ImGuiTreeNodeFlags.DefaultOpen))
if (ImGui.CollapsingHeader(nameof(ITextureProvider.GetFromGame), ImGuiTreeNodeFlags.DefaultOpen))
{
ImGui.PushID(nameof(this.DrawGamePathInput));
this.DrawGamePathInput();
ImGui.PushID(nameof(this.DrawGetFromGame));
this.DrawGetFromGame();
ImGui.PopID();
}
if (ImGui.CollapsingHeader("Load File", ImGuiTreeNodeFlags.DefaultOpen))
if (ImGui.CollapsingHeader(nameof(ITextureProvider.GetFromFile), ImGuiTreeNodeFlags.DefaultOpen))
{
ImGui.PushID(nameof(this.DrawFileInput));
this.DrawFileInput();
ImGui.PushID(nameof(this.DrawGetFromFile));
this.DrawGetFromFile();
ImGui.PopID();
}
if (ImGui.CollapsingHeader("Load Assembly Manifest Resource", ImGuiTreeNodeFlags.DefaultOpen))
if (ImGui.CollapsingHeader(nameof(ITextureProvider.GetFromManifestResource), ImGuiTreeNodeFlags.DefaultOpen))
{
ImGui.PushID(nameof(this.DrawAssemblyManifestResourceInput));
this.DrawAssemblyManifestResourceInput();
ImGui.PushID(nameof(this.DrawGetFromManifestResource));
this.DrawGetFromManifestResource();
ImGui.PopID();
}
@ -308,7 +308,7 @@ internal class TexWidget : IDataWindowWidget
ImGuiHelpers.ScaledDummy(10);
}
private void DrawIconInput()
private void DrawGetFromGameIcon()
{
ImGui.InputText("Icon ID", ref this.iconId, 32);
ImGui.Checkbox("HQ Item", ref this.hq);
@ -342,7 +342,7 @@ internal class TexWidget : IDataWindowWidget
ImGuiHelpers.ScaledDummy(10);
}
private void DrawGamePathInput()
private void DrawGetFromGame()
{
ImGui.InputText("Tex Path", ref this.inputTexPath, 255);
@ -362,7 +362,7 @@ internal class TexWidget : IDataWindowWidget
ImGuiHelpers.ScaledDummy(10);
}
private void DrawFileInput()
private void DrawGetFromFile()
{
ImGui.InputText("File Path", ref this.inputFilePath, 255);
@ -382,7 +382,7 @@ internal class TexWidget : IDataWindowWidget
ImGuiHelpers.ScaledDummy(10);
}
private void DrawAssemblyManifestResourceInput()
private void DrawGetFromManifestResource()
{
if (this.inputManifestResourceAssemblyCandidateNames is null ||
this.inputManifestResourceAssemblyCandidates is null)

View file

@ -580,7 +580,7 @@ internal sealed partial class FontAtlasFactory
var buf = Array.Empty<byte>();
try
{
var use4 = this.factory.TextureManager.SupportsDxgiFormat((int)Format.B4G4R4A4_UNorm);
var use4 = this.factory.TextureManager.IsDxgiFormatSupported((int)Format.B4G4R4A4_UNorm);
var bpp = use4 ? 2 : 4;
var width = this.NewImAtlas.TexWidth;
var height = this.NewImAtlas.TexHeight;

View file

@ -353,7 +353,7 @@ internal sealed partial class FontAtlasFactory
var numPixels = texFile.Header.Width * texFile.Header.Height;
_ = Service<InterfaceManager.InterfaceManagerWithScene>.Get();
var targetIsB4G4R4A4 = this.TextureManager.SupportsDxgiFormat((int)Format.B4G4R4A4_UNorm);
var targetIsB4G4R4A4 = this.TextureManager.IsDxgiFormatSupported((int)Format.B4G4R4A4_UNorm);
var bpp = targetIsB4G4R4A4 ? 2 : 4;
var buffer = ArrayPool<byte>.Shared.Rent(numPixels * bpp);
try