1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//! The borrowed run-entry type shared by shape-run collection, emission and
//! replay.
//!
//! An entry borrows its [`DrawPrimitive`] instead of copying the shape
//! payload out of it. Collection used to re-read every field of a ~17k-entry
//! run each frame just to copy ~100 bytes per entry into a parallel-safe
//! enum; on a watch-class core that second streaming pass over the run was
//! measurable by itself, and the emit/replay consumers read the same fields
//! again anyway.
//!
//! `DrawPrimitive` as a type is `!Sync` — its `Text` variant holds `Rc` —
//! so a borrowed entry cannot derive `Send`/`Sync` even though a run never
//! stores such a variant. [`ShapeRunEntry::new`] is the only constructor and
//! admits only the `Rect`, `RoundRect` and `Arc` variants, whose payloads
//! are all `Sync`; the manual impls below rest on exactly that, which is why
//! this module is kept small enough for the invariant and the impls to share
//! a screen.
use ;
/// One accumulated draw in a shape run: the blend-unwrapped shape primitive,
/// its blend mode (single-level `Blend` wrappers resolve at construction),
/// and the per-draw clip its graph node carried (`None` for every
/// [`cranpose_render_common::graph::DrawRunNode`] draw — a run node records
/// a whole canvas command, which never clips per primitive).
pub
/// Compile-time proof that every payload type reachable through an admitted
/// variant is `Sync`. If a field of `Rect`/`RoundRect`/`Arc` ever changes to
/// a non-`Sync` type, this stops compiling before the impls below can lie.
// SAFETY: `new` is the only producer and admits only the `Rect`, `RoundRect`
// and `Arc` variants, whose payloads are all `Sync` (proven above); the `Rc`
// carried by other `DrawPrimitive` variants is never reachable through an
// entry. Shared access from the frame worker pool therefore never touches
// non-`Sync` data, and the barrier in `FrameWorkerPool::run` ends all worker
// access before the borrow does.
unsafe
unsafe