Allow empty sprites to be allocated.
This commit is contained in:
@@ -55,6 +55,10 @@ namespace OpenRA.Graphics
|
||||
public Sprite Add(byte[] src, Size size) { return Add(src, size, float2.Zero); }
|
||||
public Sprite Add(byte[] src, Size size, float2 spriteOffset)
|
||||
{
|
||||
// Don't bother allocating empty sprites
|
||||
if (size.Width == 0 || size.Height == 0)
|
||||
return new Sprite(current, Rectangle.Empty, spriteOffset, channel, BlendMode.Alpha);
|
||||
|
||||
var rect = Allocate(size, spriteOffset);
|
||||
Util.FastCopyIntoChannel(rect, src);
|
||||
current.CommitData();
|
||||
|
||||
Reference in New Issue
Block a user