remove another bit of insignificant but silly allocation

This commit is contained in:
Chris Forbes
2011-03-05 18:49:50 +13:00
parent 03bda8b511
commit feecc70a4f

View File

@@ -61,15 +61,15 @@ namespace OpenRA.Graphics
indices[ni + 1] = indices[ni + 3] = (ushort)(nv + 1); indices[ni + 1] = indices[ni + 3] = (ushort)(nv + 1);
indices[ni + 2] = indices[ni + 5] = (ushort)(nv + 2); indices[ni + 2] = indices[ni + 5] = (ushort)(nv + 2);
indices[ni + 4] = (ushort)(nv + 3); indices[ni + 4] = (ushort)(nv + 3);
} }
static readonly int[] channelMasks = { 2, 1, 0, 3 }; // yes, our channel order is nuts.
public static void FastCopyIntoChannel(Sprite dest, byte[] src) public static void FastCopyIntoChannel(Sprite dest, byte[] src)
{ {
var masks = new int[] { 2, 1, 0, 3 }; // hack, our channel order is nuts.
var data = dest.sheet.Data; var data = dest.sheet.Data;
var srcStride = dest.bounds.Width; var srcStride = dest.bounds.Width;
var destStride = dest.sheet.Size.Width * 4; var destStride = dest.sheet.Size.Width * 4;
var destOffset = destStride * dest.bounds.Top + dest.bounds.Left * 4 + masks[(int)dest.channel]; var destOffset = destStride * dest.bounds.Top + dest.bounds.Left * 4 + channelMasks[(int)dest.channel];
var destSkip = destStride - 4 * srcStride; var destSkip = destStride - 4 * srcStride;
var height = dest.bounds.Height; var height = dest.bounds.Height;