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::RendererTextMaterializationBudget Class Reference

Aggregate text outline, bitmap, path-copy, and cache-storage budget for one renderer frame. More...

#include "donner/svg/renderer/RendererInterface.h"

Classes

struct  Cost
 Aggregate limits or conservative charges for text work and storage. More...

Public Member Functions

 RendererTextMaterializationBudget ()
 Creates a text budget with the default glyph cap and aggregate limits.
 RendererTextMaterializationBudget (const Cost &limits)
 Creates a budget with explicit limits.
void reset ()
 Clears per-frame text costs and the sticky rejection state.
bool reserve (const Cost &cost)
 Charges bounded text work and storage, or latches rejection when a limit is exceeded.
void reject ()
 Latches rejection after an external text-materialization failure.
bool reserveGlyphOccurrences (std::size_t count)
 Reserves drawn glyph occurrences independently of distinct outlines.
bool reservePathCopy (const Path &path)
 Charges a copied path and its retained bytes to the aggregate budget.
void setLimitsForTesting (Cost limits)
 Tightens aggregate test limits without raising existing capacities.
void setGlyphOccurrenceLimitForTesting (std::size_t maximum)
 Tightens the glyph-occurrence cap for a test without raising it.
void setMaximumGlyphs (std::size_t maximumGlyphs)
 Sets the glyph cap, replacing any lower limit a test installed.
std::size_t maximumGlyphs () const
 The glyph cap set by setMaximumGlyphs.
const Cost & limits () const
 Active per-frame text-materialization limits.
std::size_t uniqueOutlines () const
 Unique glyph resources charged in this frame, including bitmap glyphs.
std::size_t commands () const
 Charged path-command bounds in this frame.
std::size_t points () const
 Charged path-point bounds in this frame.
std::uint64_t bytes () const
 Charged text materialization and storage bytes in this frame.
std::size_t decodeWork () const
 Charged outline-decode work bound in this frame.
std::size_t glyphOccurrences () const
 Drawn glyph occurrences charged in this frame.
bool rejected () const
 Whether a materialization charge or external operation failed.

Static Public Attributes

static constexpr std::size_t kDefaultMaximumGlyphs = 64 * 1024
 Default cap on glyph occurrences and unique glyph resources admitted per frame.
static constexpr std::size_t kMaximumCommands = 16 * 1024 * 1024
 Default cap on charged path-command bounds per frame.
static constexpr std::size_t kMaximumPoints = 32 * 1024 * 1024
 Default cap on charged path-point bounds per frame.
static constexpr std::uint64_t kMaximumBytes = 256ULL * 1024 * 1024
 Default cap on charged text storage and materialization bytes per frame.
static constexpr std::size_t kMaximumDecodeWork = 64 * 1024 * 1024
 Default cap on charged outline-decode work per frame.

Detailed Description

Aggregate text outline, bitmap, path-copy, and cache-storage budget for one renderer frame.


Class Documentation

◆ donner::svg::RendererTextMaterializationBudget::Cost

struct donner::svg::RendererTextMaterializationBudget::Cost

Aggregate limits or conservative charges for text work and storage.

Class Members
uint64_t bytes = 0 Charged outline, bitmap, copy, and cache bytes.
size_t commands = 0 Charged path-command bound.
size_t decodeWork = 0 Charged outline-decode work bound.
size_t points = 0 Charged path-point bound.
size_t uniqueOutlines = 0 Charged unique glyph admissions, outline or bitmap.

Constructor & Destructor Documentation

◆ RendererTextMaterializationBudget()

donner::svg::RendererTextMaterializationBudget::RendererTextMaterializationBudget ( const Cost & limits)
inlineexplicit

Creates a budget with explicit limits.

Parameters
limitsPer-frame limits; limits.uniqueOutlines also caps glyph occurrences.

Member Function Documentation

◆ setMaximumGlyphs()

void donner::svg::RendererTextMaterializationBudget::setMaximumGlyphs ( std::size_t maximumGlyphs)
inline

Sets the glyph cap, replacing any lower limit a test installed.

Parameters
maximumGlyphsGlyph occurrences and unique glyph resources admitted per frame.

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