Skip to content
This repository has been archived by the owner on Jan 21, 2023. It is now read-only.

Commit

Permalink
Fixed #570
Browse files Browse the repository at this point in the history
  • Loading branch information
Perfare committed Aug 6, 2020
1 parent ef38471 commit 1766dcb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions AssetStudioUtility/Texture2DConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ public Bitmap ConvertToBitmap(bool flip)
{
return null;
}
var handle = GCHandle.Alloc(buff, GCHandleType.Pinned);
var scan0 = handle.AddrOfPinnedObject();
var bitmap = new Bitmap(m_Width, m_Height, m_Width * 4, PixelFormat.Format32bppArgb, scan0);
handle.Free();
var bitmap = new Bitmap(m_Width, m_Height, PixelFormat.Format32bppArgb);
var bmpData = bitmap.LockBits(new Rectangle(0, 0, m_Width, m_Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
Marshal.Copy(buff, 0, bmpData.Scan0, buff.Length);
bitmap.UnlockBits(bmpData);
if (flip)
{
bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);
Expand Down

0 comments on commit 1766dcb

Please sign in to comment.