[unity] Use EnsureCapacity for predetermined list sizes.

This commit is contained in:
pharan 2018-10-18 21:35:33 +08:00
parent 62769c3e71
commit d78b2fd024
2 changed files with 4 additions and 3 deletions

View File

@ -1469,13 +1469,13 @@ namespace Spine.Unity {
this.hasActiveClipping = other.hasActiveClipping;
this.rawVertexCount = other.rawVertexCount;
this.attachments.Clear(false);
this.attachments.GrowIfNeeded(other.attachments.Capacity);
this.attachments.EnsureCapacity(other.attachments.Capacity);
this.attachments.Count = other.attachments.Count;
other.attachments.CopyTo(this.attachments.Items);
#endif
this.submeshInstructions.Clear(false);
this.submeshInstructions.GrowIfNeeded(other.submeshInstructions.Capacity);
this.submeshInstructions.EnsureCapacity(other.submeshInstructions.Capacity);
this.submeshInstructions.Count = other.submeshInstructions.Count;
other.submeshInstructions.CopyTo(this.submeshInstructions.Items);
}

View File

@ -557,7 +557,8 @@ namespace Spine {
var drawOrder = skeleton.drawOrder;
drawOrder.Clear(false);
drawOrder.GrowIfNeeded(n);
drawOrder.EnsureCapacity(n);
drawOrder.Count = n;
System.Array.Copy(slotsItems, drawOrder.Items, n);
}