Make IFontHandle.Push return IDisposable, and add IFontHandle.Pop

This commit is contained in:
Soreepeong 2024-01-21 13:15:36 +09:00
parent a409ea60d6
commit 29b3e0aa97
9 changed files with 185 additions and 47 deletions

View file

@ -230,6 +230,11 @@ internal class InterfaceManager : IDisposable, IServiceType
/// </summary>
public Task FontBuildTask => WhenFontsReady().dalamudAtlas!.BuildTask;
/// <summary>
/// Gets the number of calls to <see cref="PresentDetour"/> so far.
/// </summary>
public long CumulativePresentCalls { get; private set; }
/// <summary>
/// Dispose of managed and unmanaged resources.
/// </summary>
@ -647,6 +652,8 @@ internal class InterfaceManager : IDisposable, IServiceType
*/
private IntPtr PresentDetour(IntPtr swapChain, uint syncInterval, uint presentFlags)
{
this.CumulativePresentCalls++;
Debug.Assert(this.presentHook is not null, "How did PresentDetour get called when presentHook is null?");
Debug.Assert(this.dalamudAtlas is not null, "dalamudAtlas should have been set already");