Remove System.Bitmap from UI artwork loading.

This commit is contained in:
Paul Chote
2018-12-23 00:23:48 +00:00
parent 52be0192f6
commit 4f10d4a302
2 changed files with 46 additions and 7 deletions

View File

@@ -14,6 +14,7 @@ using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Runtime.InteropServices;
using OpenRA.FileFormats;
namespace OpenRA.Graphics
{
@@ -50,13 +51,10 @@ namespace OpenRA.Graphics
public Sheet(SheetType type, Stream stream)
{
using (var bitmap = (Bitmap)Image.FromStream(stream))
{
Size = bitmap.Size;
data = new byte[4 * Size.Width * Size.Height];
Util.FastCopyIntoSprite(new Sprite(this, bitmap.Bounds(), TextureChannel.Red), bitmap);
}
var png = new Png(stream);
Size = new Size(png.Width, png.Height);
data = new byte[4 * Size.Width * Size.Height];
Util.FastCopyIntoSprite(new Sprite(this, new Rectangle(0, 0, png.Width, png.Height), TextureChannel.Red), png);
Type = type;
ReleaseBuffer();