Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
GeodePathCacheComponent.h File Reference

Per-entity cache of Geode's CPU encode pipeline output. More...

#include <cstddef>
#include <limits>
#include <optional>
#include "donner/base/Path.h"
#include "donner/svg/renderer/geode/GeodePathEncoder.h"
#include "donner/svg/renderer/geode/GeodeResourceBudget.h"
Include dependency graph for GeodePathCacheComponent.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 plus the device-derived curve-flattening tolerance. Invalidated whenever the fill slot is (geometry change, via the entt signal), 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), or on tolerance mismatch (the view scale crossed a flattening bucket). More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Detailed Description

Per-entity cache of Geode's CPU encode pipeline output.

GeodePathEncoder::encode (cubicToQuadratic → toMonotonic → band decomposition) is a measured per-frame hot path. 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.