|
|
Donner 0.5.1
Embeddable browser-grade SVG2 engine
|
Per-entity cache of Geode's CPU encode pipeline output. More...
#include <optional>#include "donner/base/Path.h"#include "donner/svg/renderer/geode/GeodePathEncoder.h"Classes | |
| struct | donner::geode::GeodePathCacheComponent |
| Per-entity cache of Geode's encoded-path output (and strokeToFill result). Installed lazily by RendererGeode at the encode call sites via get_or_emplace; removed automatically when the source ComputedPathComponent updates or is destroyed. More... | |
| struct | donner::geode::GeodePathCacheComponent::StrokeSlot |
| Stroke-slot cache. Holds both the Path::strokeToFill output path and its encoded form, keyed by the source StrokeStyle. Invalidated whenever the fill slot is (geometry change, via the entt signal), or on stroke-key mismatch (stroke width/dash/cap/ join change via CSS — the old key no longer matches the new one, so the next access regenerates). More... | |
Namespaces | |
| namespace | donner |
| Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css. | |
Per-entity cache of Geode's CPU encode pipeline output.
Design doc: docs/design_docs/0030-geode_performance.md §Milestone 2.
GeodePathEncoder::encode (cubicToQuadratic → toMonotonic → band decomposition) is the Tier-3 hot path identified in 0030. Without a cache it runs every frame for every draw — 132 times per frame for lion.svg. This component holds the encode result across frames so re-rendering an unchanged document skips the CPU work entirely.
Invalidation is owned by RendererGeode, which listens on entt's on_update<ComputedPathComponent> + on_destroy<ComputedPathComponent> signals and removes this component whenever the underlying geometry changes. ShapeSystem's content-equality gate (see emplaceComputedPathIfChanged) ensures those signals only fire when the path actually changed, so idle re-renders leave the cache intact.
| struct donner::geode::GeodePathCacheComponent::StrokeSlot |
Stroke-slot cache. Holds both the Path::strokeToFill output path and its encoded form, keyed by the source StrokeStyle. Invalidated whenever the fill slot is (geometry change, via the entt signal), or on stroke-key mismatch (stroke width/dash/cap/ join change via CSS — the old key no longer matches the new one, so the next access regenerates).
| Class Members | ||
|---|---|---|
| EncodedPath | strokedEncode | Cached encode of strokedPath. Produced by GeodePathEncoder::encode(strokedPath, strokeFillRule). |
| Path | strokedPath | Cached Path::strokeToFill output. Reused across draws of the same entity + stroke-key combination. |
| FillRule | strokeFillRule = FillRule::NonZero | Fill rule the stroke was encoded with. strokeToFill picks NonZero vs EvenOdd based on subpath topology, so this is derived and cached alongside the encode. |
| StrokeStyle | strokeKey | Equality key. Compared against the caller's StrokeStyle to detect stroke-parameter changes. |