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

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

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

Public Member Functions

bool serves (const StrokeStyle &style, double tolerance, const std::optional< Transform2d > &drawHostFromLocal) const
 True when this variant holds the outline a draw with the given key would build.
std::optional< std::size_t > retainedBytes () const
 Bytes this variant retains: the variant itself, which is allocated on its own, plus the dynamic capacity of its outline, encode, and dash key. Nullopt on overflow.

Public Attributes

StrokeStyle strokeKey
 Stroke parameters the outline was built with: width, cap, join, miter limit, dash array, dash offset, and pathLength.
double flattenTolerance = 0.0
 Path-local curve-flattening tolerance the outline was built with, derived from the draw-time device transform (see GeodeStrokeTolerance.h) and quantized to power-of-two scale buckets, so exact comparison is stable across a continuous zoom.
std::optional< Transform2d > hostFromLocal
 Set when the 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, and the entity-level invalidation only watches the spline, so a transform-only attribute write, a canvas resize, or another <use> instance would otherwise be served another CTM's geometry.
Path strokedPath
 Cached Path::strokeToFill output.
EncodedPath strokedEncode
 Cached encode of strokedPath, produced with strokeFillRule.
FillRule strokeFillRule = FillRule::NonZero
 Fill rule of the cached stroke geometry. strokeToFill produces consistently wound pieces whose union is encoded with NonZero.
GeodeGeometryCacheReservation reservation
 Live retained-byte charge for this variant, as reported by retainedBytes.
std::uint64_t lastUse = 0
 Value of strokeUseClock when this variant last served a draw; picks the one to replace.
std::uint64_t lastUseFrame = 0
 Frame generation of the last draw this variant served, on the device lastUseDeviceId. While a frame of that device at or before this generation is open, a pending batch may still point at this variant, so it is neither replaced nor freed.
std::uint64_t lastUseDeviceId = 0
 GeodeDevice::deviceId() of the device whose generation lastUseFrame is.

Detailed Description

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.

Member Function Documentation

◆ serves()

bool donner::geode::GeodePathCacheComponent::StrokeVariant::serves ( const StrokeStyle & style,
double tolerance,
const std::optional< Transform2d > & drawHostFromLocal ) const
inline

True when this variant holds the outline a draw with the given key would build.

Only an exact tolerance match serves a draw: an outline flattened for a coarser device scale would show its segments at a finer one, and serving a finer outline at a coarser scale would make a draw's pixels depend on which scale stroked the entity first.

Parameters
styleStroke parameters of the draw.
toleranceDevice-derived flattening tolerance of the draw.
drawHostFromLocalHost transform of a non-scaling-stroke draw, or nullopt for a local-space draw.

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