A replay of a DisplayList into one backend that runs in time slices: Continue(TimeSpan) hands operations over until its budget is used, and the next call resumes at the operation where it stopped. Start one with BeginReplay(IRenderingBackend, CancellationToken, IProgress<Double>?).
public sealed class DisplayListReplay
Viewer capability 2 (issue #97), PDFium's progressive rendering. Between slices the backend keeps the state the operations so far gave it (graphics state stack, transform, clip) and whatever it drew, so its output after any slice is a valid partial image, and the whole replay hands the backend exactly the calls of Replay(IRenderingBackend). The budget is checked after each operation, so a slice runs at least one operation and ends at most one operation after its budget; one operation (a large image, a long glyph run) is never split.
Nothing here blocks or waits, and no thread is used: a single-threaded host (Blazor WebAssembly) replays a slice, yields to its
event loop, and continues, for example while (!replay.Continue(TimeSpan.FromMilliseconds(8))) await Task.Yield();.
Cancelling the token stops the replay before its next operation; Continue(TimeSpan) then throws
, now and on every later call until the replay is complete. Not thread-safe: one thread at a time continues a replay.
kind:method, kind:property, kind:ctor. Press Esc to clear.BackendGets the backend the operations go to.IsCompletedGets a value indicating whether every operation has been handed over.ListGets the list being replayed.PositionGets the number of operations handed over so far: the index of the operation the next slice starts at.ProgressGets the share of the operations handed over so far, from 0 to 1 (1 for an empty list).Continue(TimeSpan)Hands operations over from Position until the end of the list or, after at least one, until budget has passed.