|
|
Donner 0.5.1
Embeddable browser-grade SVG2 engine
|
Components are the data layer of the ECS architecture. More...
Classes | |
| struct | donner::svg::components::DirtyFlagsComponent |
| Tracks which computed properties are stale and need recomputation after a DOM mutation. More... | |
| struct | donner::svg::compositor::CompositorHintComponent |
| Author-layer ECS component carrying the set of weighted hints published against an entity. More... | |
| struct | donner::svg::compositor::ComputedLayerAssignmentComponent |
| Resolved-layer ECS component written by LayerResolver each frame; must not be hand-edited. More... | |
Components are the data layer of the ECS architecture.
Each component holds a specific piece of state and is attached to an entity. Components contain no logic — systems read and write them.
Components are typically small structs or classes that store the results of a computation stage (e.g., computed styles, resolved transforms, cached geometry). They are attached to entities via the entt registry and accessed by systems during processing.
| struct donner::svg::components::DirtyFlagsComponent |
Tracks which computed properties are stale and need recomputation after a DOM mutation.
Attached to entities that have been mutated since the last render. Systems check these flags during createComputedComponents() to skip clean entities and only recompute what changed.
Public Types | |
| enum | Flags : uint16_t { None = 0 , Style = 1 << 0 , Layout = 1 << 1 , Transform = 1 << 2 , WorldTransform = 1 << 3 , Shape = 1 << 4 , Paint = 1 << 5 , Filter = 1 << 6 , RenderInstance = 1 << 7 , ShadowTree = 1 << 8 , TextGeometry = 1 << 9 , StyleCascade = Style | Paint | Filter | RenderInstance , LayoutCascade = Layout | Transform | WorldTransform | RenderInstance , All = 0xFFFF } |
| Individual dirty flags for each computation stage. More... | |
Public Member Functions | |
| void | mark (uint16_t f) |
| Mark additional flags as dirty. | |
| bool | test (uint16_t f) const |
| Test whether any of the given flags are set. | |
| void | clear (uint16_t f) |
| Clear specific flags. | |
| void | clearAll () |
| Clear all flags. | |
Public Attributes | |
| uint16_t | flags = Flags::None |
| Bitfield of dirty flags. | |
| enum donner::svg::components::DirtyFlagsComponent::Flags : uint16_t |
Individual dirty flags for each computation stage.
| Enumerator | |
|---|---|
| Style | ComputedStyleComponent needs recomputation. |
| Layout | ComputedSizedElementComponent / viewBox needs recomputation. |
| Transform | ComputedLocalTransformComponent needs recomputation. |
| WorldTransform | ComputedAbsoluteTransformComponent needs recomputation. |
| Shape | ComputedPathComponent needs recomputation. |
| Paint | ResolvedPaintServer (fill/stroke) needs re-resolution. |
| Filter | Filter effect chain needs re-resolution. |
| RenderInstance | RenderingInstanceComponent needs update. |
| ShadowTree | Shadow tree needs re-instantiation. |
| TextGeometry | ComputedTextGeometryComponent needs recomputation. |
| StyleCascade | Compound flag: style change that may affect paint, filter, and render instance. |
| LayoutCascade | Compound flag: layout change that affects transforms and render instance. |
| All | All flags set. |
| struct donner::svg::compositor::CompositorHintComponent |
Author-layer ECS component carrying the set of weighted hints published against an entity.
Multiple sources may hint the same entity at the same time. The resolver sums weights to rank candidates for layer assignment, except that any Mandatory hint short-circuits the calculation to infinite weight (UINT32_MAX) — mandatory hints are non-contestable.
Storage is a plain std::vector<HintEntry> — see Non-Goal 3 (sequential, single-threaded) in the design doc. Hints are typically 1–3 per entity.
This component mirrors StyleComponent in the CSS engine: it is the author-layer input to a resolver that produces a ComputedLayerAssignmentComponent.
Public Member Functions | |
| void | addHint (HintSource source, uint16_t weight) |
| Append a hint. Does not deduplicate — the same (source, weight) pair may appear more than once. | |
| bool | removeFirstMatching (HintSource source, uint16_t weight) |
| Remove exactly one entry whose source and weight both match. | |
| uint32_t | totalWeight () const |
| Saturating sum of all entry weights. | |
| bool | empty () const |
| Returns true if the hint list is empty. | |
Public Attributes | |
| std::vector< HintEntry > | entries |
| All hint entries currently attached to this entity. | |
|
inline |
Remove exactly one entry whose source and weight both match.
Used by ScopedCompositorHint on destruction. If duplicate entries exist, only the first matching one is removed — callers that stacked duplicates should drop their handles in LIFO order.
|
inlinenodiscard |
Saturating sum of all entry weights.
Any Mandatory hint short-circuits the result to UINT32_MAX — the infinite-weight sentinel. Otherwise returns the clamped sum of weight fields (clamped at UINT32_MAX - 1 so Mandatory remains distinguishable). With a std::vector of uint16_t weights the sum cannot realistically overflow uint32_t, but we clamp defensively.
| struct donner::svg::compositor::ComputedLayerAssignmentComponent |
Resolved-layer ECS component written by LayerResolver each frame; must not be hand-edited.
This mirrors the StyleComponent → ComputedStyleComponent split in Donner's CSS engine: author-layer hints live in CompositorHintComponent, and the resolver collapses them into this computed component.
Entities without this component render into the root layer (implicit layerId == 0).
| Class Members | ||
|---|---|---|
| uint32_t | layerId = 0 | Unique identifier for the compositor layer this entity belongs to. 0 is the root layer. |