1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 22:33:05 +08:00

Merge pull request #28170 from peppy/fix-catch-dho-performance

Set a rudimentary lifetime end to improve seek performance in scrolling rulesets
This commit is contained in:
Bartłomiej Dach 2024-05-14 19:27:40 +02:00 committed by GitHub
commit 7c1640e124
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -136,7 +136,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
// Scroll info is not available until loaded. // Scroll info is not available until loaded.
// The lifetime of all entries will be updated in the first Update. // The lifetime of all entries will be updated in the first Update.
if (IsLoaded) if (IsLoaded)
setComputedLifetimeStart(entry); setComputedLifetime(entry);
base.Add(entry); base.Add(entry);
} }
@ -171,7 +171,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
layoutComputed.Clear(); layoutComputed.Clear();
foreach (var entry in Entries) foreach (var entry in Entries)
setComputedLifetimeStart(entry); setComputedLifetime(entry);
algorithm.Value.Reset(); algorithm.Value.Reset();
@ -234,12 +234,13 @@ namespace osu.Game.Rulesets.UI.Scrolling
return algorithm.Value.GetDisplayStartTime(entry.HitObject.StartTime, startOffset, timeRange.Value, scrollLength); return algorithm.Value.GetDisplayStartTime(entry.HitObject.StartTime, startOffset, timeRange.Value, scrollLength);
} }
private void setComputedLifetimeStart(HitObjectLifetimeEntry entry) private void setComputedLifetime(HitObjectLifetimeEntry entry)
{ {
double computedStartTime = computeDisplayStartTime(entry); double computedStartTime = computeDisplayStartTime(entry);
// always load the hitobject before its first judgement offset // always load the hitobject before its first judgement offset
entry.LifetimeStart = Math.Min(entry.HitObject.StartTime - entry.HitObject.MaximumJudgementOffset, computedStartTime); entry.LifetimeStart = Math.Min(entry.HitObject.StartTime - entry.HitObject.MaximumJudgementOffset, computedStartTime);
entry.LifetimeEnd = entry.HitObject.GetEndTime() + timeRange.Value;
} }
private void updateLayoutRecursive(DrawableHitObject hitObject, double? parentHitObjectStartTime = null) private void updateLayoutRecursive(DrawableHitObject hitObject, double? parentHitObjectStartTime = null)
@ -261,7 +262,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
// Nested hitobjects don't need to scroll, but they do need accurate positions and start lifetime // Nested hitobjects don't need to scroll, but they do need accurate positions and start lifetime
updatePosition(obj, hitObject.HitObject.StartTime, parentHitObjectStartTime); updatePosition(obj, hitObject.HitObject.StartTime, parentHitObjectStartTime);
setComputedLifetimeStart(obj.Entry); setComputedLifetime(obj.Entry);
} }
} }