Merge pull request #26660 from EVAST9919/carousel-alloc

Reduce allocation overhead in `BeatmapCarousel`
This commit is contained in:
Dean Herbert 2024-01-22 16:47:28 +09:00 committed by GitHub
commit 62965549e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -868,7 +868,7 @@ namespace osu.Game.Screens.Select
{ {
var toDisplay = visibleItems.GetRange(displayedRange.first, displayedRange.last - displayedRange.first + 1); var toDisplay = visibleItems.GetRange(displayedRange.first, displayedRange.last - displayedRange.first + 1);
foreach (var panel in Scroll.Children) foreach (var panel in Scroll)
{ {
Debug.Assert(panel.Item != null); Debug.Assert(panel.Item != null);
@ -899,7 +899,7 @@ namespace osu.Game.Screens.Select
// Update externally controlled state of currently visible items (e.g. x-offset and opacity). // Update externally controlled state of currently visible items (e.g. x-offset and opacity).
// This is a per-frame update on all drawable panels. // This is a per-frame update on all drawable panels.
foreach (DrawableCarouselItem item in Scroll.Children) foreach (DrawableCarouselItem item in Scroll)
{ {
updateItem(item); updateItem(item);
@ -1094,7 +1094,7 @@ namespace osu.Game.Screens.Select
// to enter clamp-special-case mode where it animates completely differently to normal. // to enter clamp-special-case mode where it animates completely differently to normal.
float scrollChange = scrollTarget.Value - Scroll.Current; float scrollChange = scrollTarget.Value - Scroll.Current;
Scroll.ScrollTo(scrollTarget.Value, false); Scroll.ScrollTo(scrollTarget.Value, false);
foreach (var i in Scroll.Children) foreach (var i in Scroll)
i.Y += scrollChange; i.Y += scrollChange;
break; break;
} }