diff --git a/Example/Example.xcodeproj/xcshareddata/xcschemes/OSUI_Example.xcscheme b/Example/Example.xcodeproj/xcshareddata/xcschemes/OSUI_Example.xcscheme index f9ebc5585..b1b0b8e82 100644 --- a/Example/Example.xcodeproj/xcshareddata/xcschemes/OSUI_Example.xcscheme +++ b/Example/Example.xcodeproj/xcshareddata/xcschemes/OSUI_Example.xcscheme @@ -69,6 +69,11 @@ + + + + + + AnySequence { AnySequence(entries(within: range, mode: mode, limit: limit)) } +} + +extension TimelineSchedule { + package func nextEntry( + after date: Date, + mode: TimelineScheduleMode, + limit: UInt? + ) -> Date { + entries(from: date, mode: mode) + .lazy + .abort(after: limit) + .first { $0 > date } ?? .distantFuture + } private func entries( within range: Range, diff --git a/Sources/OpenSwiftUICore/Render/DisplayList/DisplayList.swift b/Sources/OpenSwiftUICore/Render/DisplayList/DisplayList.swift index 2f9dda039..4647ad690 100644 --- a/Sources/OpenSwiftUICore/Render/DisplayList/DisplayList.swift +++ b/Sources/OpenSwiftUICore/Render/DisplayList/DisplayList.swift @@ -107,6 +107,24 @@ package struct DisplayList: Equatable { package var isEmpty: Bool { items.isEmpty } + + // TODO + + package func nextUpdate(after time: Time) -> Time { + guard !features.contains(.animations) else { + return time + } + var nextUpdate = Time.infinity + if features.contains(.dynamicContent) { + for item in items { + nextUpdate = min(nextUpdate, item.nextUpdate(after: time)) + if nextUpdate == time { + break + } + } + } + return nextUpdate + } } @available(*, unavailable) @@ -177,6 +195,38 @@ extension DisplayList { indirect case drawing(any ORBDisplayListContents, CGPoint, RasterizationOptions) indirect case view(any _DisplayList_ViewFactory) case placeholder(id: Identity) + + @inline(__always) + var caseName: String { + switch self { + case .backdrop: + return "backdrop" + case .color: + return "color" + case .chameleonColor: + return "chameleonColor" + case .image: + return "image" + case .shape: + return "shape" + case .shadow: + return "shadow" + case .platformView: + return "platformView" + case .platformLayer: + return "platformLayer" + case .text: + return "text" + case .flattened: + return "flattened" + case .drawing: + return "drawing" + case .view: + return "view" + case .placeholder: + return "placeholder" + } + } } package init(_ value: Content.Value, seed: Seed) { @@ -618,6 +668,8 @@ extension DisplayList.Item { extension DisplayList { // FIXME package class InterpolatorGroup { + var maxDuration: Double = .zero + private struct Contents { var list: DisplayList var origin: CGPoint @@ -664,6 +716,10 @@ extension DisplayList { [] } + func nextUpdate(after _: Time) -> Time { + .infinity + } + func rewriteDisplayList( _ list: inout DisplayList, time: Attribute