mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-25 05:40:21 -04:00
parent
90ec395b2a
commit
4bae98813b
@ -14,12 +14,10 @@ namespace AssetStudioGUI
|
|||||||
{
|
{
|
||||||
Width = image.Width;
|
Width = image.Width;
|
||||||
Height = image.Height;
|
Height = image.Height;
|
||||||
var buff = BigArrayPool<byte>.Shared.Rent(Width * Height * 4);
|
Bits = BigArrayPool<byte>.Shared.Rent(Width * Height * 4);
|
||||||
image.CopyPixelDataTo(buff);
|
image.CopyPixelDataTo(Bits);
|
||||||
Bits = buff;
|
|
||||||
m_handle = GCHandle.Alloc(Bits, GCHandleType.Pinned);
|
m_handle = GCHandle.Alloc(Bits, GCHandleType.Pinned);
|
||||||
m_bitmap = new Bitmap(Width, Height, Stride, PixelFormat.Format32bppArgb, m_handle.AddrOfPinnedObject());
|
m_bitmap = new Bitmap(Width, Height, Stride, PixelFormat.Format32bppArgb, m_handle.AddrOfPinnedObject());
|
||||||
BigArrayPool<byte>.Shared.Return(buff);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Dispose(bool disposing)
|
private void Dispose(bool disposing)
|
||||||
@ -28,6 +26,7 @@ namespace AssetStudioGUI
|
|||||||
{
|
{
|
||||||
m_bitmap.Dispose();
|
m_bitmap.Dispose();
|
||||||
m_handle.Free();
|
m_handle.Free();
|
||||||
|
BigArrayPool<byte>.Shared.Return(Bits);
|
||||||
}
|
}
|
||||||
m_bitmap = null;
|
m_bitmap = null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user