Donner SVG 0.8.0
0.8.0 ยท ebf353960.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::svg::components::FontResourceGraphCache Class Reference

Bounded reuse within one render preparation or font-refresh traversal. No entry survives the operation, and preparation changes invalidate both the graph and its target collections. More...

#include "donner/svg/components/FontResourceGraph.h"

Classes

struct  Stats
 Work and reuse counters for one cache lifetime. More...

Public Member Functions

 FontResourceGraphCache (Stats *stats=nullptr)
 Create a cache using caller-owned counters or internal counters.
void preserveBeforeRefresh (const SVGDocumentHandle &document)
 Snapshot dependency evidence before a font-resource refresh changes geometry.
void finishRefresh (const SVGDocumentHandle &document, std::span< const Entity > changedOwners)
 Invalidate consumers of changed geometry and refresh retained font metadata.
FontResourceGraph::Collection collect (const SVGDocumentHandle &document, Entity target, FontResourceGraph::Purpose purpose=FontResourceGraph::Purpose::CompleteTarget)
 Collect a target's font dependencies, reusing valid evidence within this cache lifetime.

Static Public Attributes

static constexpr std::size_t kMaximumWork = 32 * 1024 * 1024
 New compute ceiling: 1024 passes over the existing 32 Ki parsed-child entity envelope.

Detailed Description

Bounded reuse within one render preparation or font-refresh traversal. No entry survives the operation, and preparation changes invalidate both the graph and its target collections.


Class Documentation

◆ donner::svg::components::FontResourceGraphCache::Stats

struct donner::svg::components::FontResourceGraphCache::Stats

Work and reuse counters for one cache lifetime.

Class Members
size_t cacheHits = 0 Target collections reused.
size_t graphBuilds = 0 Dependency graphs constructed.
bool resourceLimit = false True after the work ceiling is exhausted.
size_t targetCollections = 0 Target traversals computed.
size_t work = 0 Charged units against the cache work ceiling.

Constructor & Destructor Documentation

◆ FontResourceGraphCache()

donner::svg::components::FontResourceGraphCache::FontResourceGraphCache ( Stats * stats = nullptr)
inlineexplicit

Create a cache using caller-owned counters or internal counters.

Parameters
statsOptional counters that must outlive the cache.

Member Function Documentation

◆ collect()

FontResourceGraph::Collection donner::svg::components::FontResourceGraphCache::collect ( const SVGDocumentHandle & document,
Entity target,
FontResourceGraph::Purpose purpose = FontResourceGraph::Purpose::CompleteTarget )

Collect a target's font dependencies, reusing valid evidence within this cache lifetime.

Parameters
documentDocument containing the target.
targetEntity whose dependency closure is requested.
purposeWhether to use full prepared or completed rendered-frame evidence.
Returns
Dependencies and render/limit state for the target.

◆ finishRefresh()

void donner::svg::components::FontResourceGraphCache::finishRefresh ( const SVGDocumentHandle & document,
std::span< const Entity > changedOwners )

Invalidate consumers of changed geometry and refresh retained font metadata.

Parameters
documentDocument whose font resources were refreshed.
changedOwnersGeometry owners whose dependents may need repainting.

◆ preserveBeforeRefresh()

void donner::svg::components::FontResourceGraphCache::preserveBeforeRefresh ( const SVGDocumentHandle & document)

Snapshot dependency evidence before a font-resource refresh changes geometry.

Parameters
documentDocument whose prepared graph should be retained for invalidation.

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