[GUI] One more bugfix

- bugfix for 44a1240f5f
This commit is contained in:
VaDiM 2023-04-13 19:51:57 +03:00
parent 90ec395b2a
commit 4bae98813b

View File

@ -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;
} }