XRoom_Unity/Assets/Paroxe/PDFRenderer/Internal/Scripts/WebGL/PDFJS_WebGLCanvas.cs
2025-05-31 10:20:20 +03:30

43 lines
971 B
C#

using System;
using Paroxe.PdfRenderer.Internal;
namespace Paroxe.PdfRenderer.WebGL
{
public class PDFJS_WebGLCanvas : IDisposable
{
private bool m_Disposed;
private IntPtr m_NativePointer;
public PDFJS_WebGLCanvas(IntPtr nativePointer)
{
m_NativePointer = nativePointer;
}
~PDFJS_WebGLCanvas()
{
Dispose(false);
}
protected virtual void Dispose(bool disposing)
{
if (!m_Disposed)
{
if (m_NativePointer != IntPtr.Zero)
{
#if UNITY_WEBGL && !UNITY_EDITOR
NativeMethods.PDFJS_DestroyCanvas(m_NativePointer.ToInt32());
#endif
m_NativePointer = IntPtr.Zero;
}
m_Disposed = true;
}
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
}
}