From f825e86e861a901dc46164970888ce878e045494 Mon Sep 17 00:00:00 2001 From: Soreepeong Date: Sat, 17 Feb 2024 22:44:33 +0900 Subject: [PATCH] Fix B4G4R4A4->B8G8R8A8 channel extraction On systems without support for B4G4R4A4 pixel format (when DirectX feature level 11_1 is missing), the conversion will take place; a copy-and-paste error made the read pointer advance twice as fast as it should have been. --- .../Internals/FontAtlasFactory.cs | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.cs b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.cs index 021fc953f..6a3d3e1a3 100644 --- a/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.cs +++ b/Dalamud/Interface/ManagedFontAtlas/Internals/FontAtlasFactory.cs @@ -290,6 +290,25 @@ internal sealed partial class FontAtlasFactory private static T ExtractResult(Task t) => t.IsCompleted ? t.Result : t.GetAwaiter().GetResult(); + /// + /// Clones a texture wrap, by getting a new reference to the underlying and the + /// texture behind. + /// + /// The to clone from. + /// The cloned . + private static IDalamudTextureWrap CloneTextureWrap(IDalamudTextureWrap wrap) + { + var srv = CppObject.FromPointer(wrap.ImGuiHandle); + using var res = srv.Resource; + using var tex2D = res.QueryInterface(); + var description = tex2D.Description; + return new DalamudTextureWrap( + new D3DTextureWrap( + srv.QueryInterface(), + description.Width, + description.Height)); + } + private static unsafe void ExtractChannelFromB8G8R8A8( Span target, ReadOnlySpan source, @@ -327,25 +346,6 @@ internal sealed partial class FontAtlasFactory } } - /// - /// Clones a texture wrap, by getting a new reference to the underlying and the - /// texture behind. - /// - /// The to clone from. - /// The cloned . - private static IDalamudTextureWrap CloneTextureWrap(IDalamudTextureWrap wrap) - { - var srv = CppObject.FromPointer(wrap.ImGuiHandle); - using var res = srv.Resource; - using var tex2D = res.QueryInterface(); - var description = tex2D.Description; - return new DalamudTextureWrap( - new D3DTextureWrap( - srv.QueryInterface(), - description.Width, - description.Height)); - } - private static unsafe void ExtractChannelFromB4G4R4A4( Span target, ReadOnlySpan source, @@ -378,7 +378,7 @@ internal sealed partial class FontAtlasFactory v |= v << 4; *wptr = (uint)((v << 24) | 0x00FFFFFF); wptr++; - rptr += 4; + rptr += 2; } } }