mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 21:24:16 +01:00
remove/internalize unused
This commit is contained in:
parent
6ccc982d2b
commit
912cf991dc
1 changed files with 15 additions and 29 deletions
|
|
@ -314,6 +314,7 @@ public static class ImGuiHelpers
|
||||||
glyph->U1,
|
glyph->U1,
|
||||||
glyph->V1,
|
glyph->V1,
|
||||||
glyph->AdvanceX * scale);
|
glyph->AdvanceX * scale);
|
||||||
|
target.Mark4KPageUsedAfterGlyphAdd((ushort)glyph->Codepoint);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
else if (!missingOnly)
|
else if (!missingOnly)
|
||||||
|
|
@ -415,6 +416,8 @@ public static class ImGuiHelpers
|
||||||
/// <exception cref="OutOfMemoryException">If <see cref="ImGuiNative.igMemAlloc"/> returns null.</exception>
|
/// <exception cref="OutOfMemoryException">If <see cref="ImGuiNative.igMemAlloc"/> returns null.</exception>
|
||||||
public static unsafe void* AllocateMemory(int length)
|
public static unsafe void* AllocateMemory(int length)
|
||||||
{
|
{
|
||||||
|
// TODO: igMemAlloc takes size_t, which is nint; ImGui.NET apparently interpreted that as uint.
|
||||||
|
// fix that in ImGui.NET.
|
||||||
switch (length)
|
switch (length)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
|
@ -436,35 +439,6 @@ public static class ImGuiHelpers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Mark 4K page as used, after adding a codepoint to a font.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="font">The font.</param>
|
|
||||||
/// <param name="codepoint">The codepoint.</param>
|
|
||||||
public static unsafe void Mark4KPageUsedAfterGlyphAdd(this ImFontPtr font, ushort codepoint)
|
|
||||||
{
|
|
||||||
// Mark 4K page as used
|
|
||||||
var pageIndex = unchecked((ushort)(codepoint / 4096));
|
|
||||||
font.NativePtr->Used4kPagesMap[pageIndex >> 3] |= unchecked((byte)(1 << (pageIndex & 7)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a new instance of <see cref="ImFontAtlasPtr"/> with a natively backed memory.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="font">The created instance.</param>
|
|
||||||
/// <returns>Disposable you can call.</returns>
|
|
||||||
public static unsafe IDisposable NewFontAtlasPtrScoped(out ImFontAtlasPtr font)
|
|
||||||
{
|
|
||||||
font = new(ImGuiNative.ImFontAtlas_ImFontAtlas());
|
|
||||||
var ptr = font.NativePtr;
|
|
||||||
return Disposable.Create(() =>
|
|
||||||
{
|
|
||||||
if (ptr != null)
|
|
||||||
ImGuiNative.ImFontAtlas_destroy(ptr);
|
|
||||||
ptr = null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new instance of <see cref="ImFontGlyphRangesBuilderPtr"/> with a natively backed memory.
|
/// Creates a new instance of <see cref="ImFontGlyphRangesBuilderPtr"/> with a natively backed memory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -558,6 +532,18 @@ public static class ImGuiHelpers
|
||||||
public static unsafe ImFontPtr OrElse(this ImFontPtr self, ImFontPtr other) =>
|
public static unsafe ImFontPtr OrElse(this ImFontPtr self, ImFontPtr other) =>
|
||||||
self.NativePtr is null ? other : self;
|
self.NativePtr is null ? other : self;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Mark 4K page as used, after adding a codepoint to a font.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="font">The font.</param>
|
||||||
|
/// <param name="codepoint">The codepoint.</param>
|
||||||
|
internal static unsafe void Mark4KPageUsedAfterGlyphAdd(this ImFontPtr font, ushort codepoint)
|
||||||
|
{
|
||||||
|
// Mark 4K page as used
|
||||||
|
var pageIndex = unchecked((ushort)(codepoint / 4096));
|
||||||
|
font.NativePtr->Used4kPagesMap[pageIndex >> 3] |= unchecked((byte)(1 << (pageIndex & 7)));
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Finds the corresponding ImGui viewport ID for the given window handle.
|
/// Finds the corresponding ImGui viewport ID for the given window handle.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue