Merge pull request #27357 from EVAST9919/smoke-alloc

Reduce allocations in `SmokeSegment`
This commit is contained in:
Dean Herbert 2024-02-24 19:23:50 +08:00 committed by GitHub
commit 28917446ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

View File

@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
@ -228,7 +227,9 @@ public override void ApplyState()
int futurePointIndex = ~Source.SmokePoints.BinarySearch(new SmokePoint { Time = CurrentTime }, new SmokePoint.UpperBoundComparer());
points.Clear();
points.AddRange(Source.SmokePoints.Skip(firstVisiblePointIndex).Take(futurePointIndex - firstVisiblePointIndex));
for (int i = firstVisiblePointIndex; i < futurePointIndex; i++)
points.Add(Source.SmokePoints[i]);
}
protected sealed override void Draw(IRenderer renderer)