Donner SVG 0.8.0
0.8.0 ยท ebf353960.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::geode::GeodePathCacheComponent::StrokeSlot Struct Reference

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...

#include "donner/svg/renderer/geode/GeodePathCacheComponent.h"

Public Member Functions

std::optional< std::size_t > retainedBytes () const
 Exact dynamic capacity retained by this cached stroke entry.

Public Attributes

StrokeStyle strokeKey
 Equality key. Compared against the caller's StrokeStyle to detect stroke-parameter changes.
double flattenTolerance = 0.0
 Second half of the equality key: the path-local curve-flattening tolerance this outline was built with, derived from the draw-time device transform (see GeodeStrokeTolerance.h). Without it in the key, zooming in would keep serving an outline tessellated for the old scale and curves would render as visible polygons. Quantized upstream to power-of-two scale buckets, so exact comparison is stable across a continuous zoom.
std::optional< Transform2d > hostFromLocal
 Third part of the equality key: set when the cached outline was built from a vector-effect: non-scaling-stroke centerline already transformed into host space, to the transform that produced it. A runtime change of the element's vector-effect keeps the same StrokeStyle, so without this the slot could serve a local-space outline for a host-space draw; and the entity-level invalidation only watches the spline, so a transform-only attribute write, a canvas resize, or a second <use> instance in the same frame would otherwise be served the previous CTM's geometry.
Path strokedPath
 Cached Path::strokeToFill output. Reused across draws of the same entity + stroke-key combination.
EncodedPath strokedEncode
 Cached encode of strokedPath. Produced by GeodePathEncoder::encode(strokedPath, strokeFillRule).
FillRule strokeFillRule = FillRule::NonZero
 Fill rule used for the cached stroke geometry. strokeToFill produces consistently wound pieces whose union is encoded with NonZero.

Detailed Description

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).

Member Data Documentation

◆ hostFromLocal

std::optional<Transform2d> donner::geode::GeodePathCacheComponent::StrokeSlot::hostFromLocal

Third part of the equality key: set when the cached outline was built from a vector-effect: non-scaling-stroke centerline already transformed into host space, to the transform that produced it. A runtime change of the element's vector-effect keeps the same StrokeStyle, so without this the slot could serve a local-space outline for a host-space draw; and the entity-level invalidation only watches the spline, so a transform-only attribute write, a canvas resize, or a second <use> instance in the same frame would otherwise be served the previous CTM's geometry.

One slot serves both the local-space and host-space variants of an entity, so an element that draws both in a frame rebuilds the outline each time. The tiny-skia backend keeps the two variants in separate slots. That is a cache-effectiveness asymmetry, not a correctness one: the key below distinguishes the variants, so a mismatched slot is always rebuilt.


The documentation for this struct was generated from the following file: