Skip to content

Commit

Permalink
[unity] Use EnsureCapacity for predetermined list sizes.
Browse files Browse the repository at this point in the history
  • Loading branch information
pharan committed Oct 18, 2018
1 parent 62769c3 commit d78b2fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1469,13 +1469,13 @@ public void Set (SkeletonRendererInstruction other) {
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,8 @@ public static void SetDrawOrderToSetupPose (this Skeleton skeleton) {

var drawOrder = skeleton.drawOrder;
drawOrder.Clear(false);
drawOrder.GrowIfNeeded(n);
drawOrder.EnsureCapacity(n);
drawOrder.Count = n;
System.Array.Copy(slotsItems, drawOrder.Items, n);
}

Expand Down

0 comments on commit d78b2fd

Please sign in to comment.