Return to ImageSharp

coz the perfomance issue was fixed by Perfare in later commits
This commit is contained in:
VaDiM
2022-11-17 03:59:59 +03:00
parent 74f2c3190b
commit 8ebfa16e19
8 changed files with 156 additions and 6082 deletions

View File

@ -17,12 +17,15 @@ namespace AssetStudioGUI
var type = Properties.Settings.Default.convertType;
if (!TryExportFile(exportPath, item, "." + type.ToString().ToLower(), out var exportFullPath))
return false;
var stream = m_Texture2D.ConvertToStream(type, true);
if (stream == null)
var image = m_Texture2D.ConvertToImage(true);
if (image == null)
return false;
using (stream)
using (image)
{
File.WriteAllBytes(exportFullPath, stream.ToArray());
using (var file = File.OpenWrite(exportFullPath))
{
image.WriteToStream(file, type);
}
return true;
}
}
@ -230,12 +233,15 @@ namespace AssetStudioGUI
var type = Properties.Settings.Default.convertType;
if (!TryExportFile(exportPath, item, "." + type.ToString().ToLower(), out var exportFullPath))
return false;
var stream = ((Sprite)item.Asset).GetImage(type);
if (stream != null)
var image = ((Sprite)item.Asset).GetImage();
if (image != null)
{
using (stream)
using (image)
{
File.WriteAllBytes(exportFullPath, stream.ToArray());
using (var file = File.OpenWrite(exportFullPath))
{
image.WriteToStream(file, type);
}
return true;
}
}