Donner SVG main
0.8.0 · 766e862a0.8.0 main
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 <array>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <memory>
#include <optional>
#include "donner/base/Path.h"
#include "donner/base/Transform.h"
#include "donner/svg/renderer/geode/GeodeFillVariants.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 results). 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::FillVariant
 One fill encode, built for one device-derived cubic tolerance bucket. More...
struct  donner::geode::GeodePathCacheComponent::StrokeVariant
 One cached stroke outline: the Path::strokeToFill output of the entity's geometry for one stroke key, and its encode. The key is everything the outline depends on besides the geometry, whose changes remove the whole component: the stroke style, the device-derived flattening tolerance, and the host transform of a non-scaling-stroke centerline. 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.