Skip to content

Commit

Permalink
Fixed padding
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed Oct 12, 2024
1 parent 5b6a527 commit 8b33efd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
12 changes: 5 additions & 7 deletions src/BUTR.CrashReport.Renderer.ImGui/ImGui/CmGui.Methods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,11 @@ public void TextSameLine(ReadOnlySpan<byte> fmt)
[MethodImpl(MethodImplOptions.AggressiveInlining | AggressiveOptimization)]
public void PadRight(int toAppend)
{
fixed (byte* paddingPtr = _padding)
{
var offset = _padding.Length - toAppend;
var paddingPtrWithOffset = (byte*) Unsafe.Add<byte>(paddingPtr, offset);
igText(paddingPtrWithOffset);
SameLine(0, 0);
}
Span<byte> padding = stackalloc byte[toAppend + 1];
padding.Fill((byte) ' ');
padding[toAppend] = 0;
Text(padding);
SameLine(0, 0);
}
public void TextSameLine(ref readonly byte fmt)
{
Expand Down
1 change: 0 additions & 1 deletion src/BUTR.CrashReport.Renderer.ImGui/ImGui/CmGui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ internal partial class CmGui
{
private const MethodImplOptions AggressiveOptimization = (MethodImplOptions) 512;

private static readonly byte[] _padding = UnsafeHelper.ToUtf8Array(string.Empty.PadRight(64));
private static readonly Vector2 Zero2 = Vector2.Zero;
private static readonly Vector3 Zero3 = Vector3.Zero;
private static readonly Vector4 Zero4 = Vector4.Zero;
Expand Down

0 comments on commit 8b33efd

Please sign in to comment.