ShapeStripCache class

Content-keyed cache of rasterized stroke/fill strips, replayed by StripGenerator.fillPath and StripGenerator.strokePath.

The glyph cache's design (relocatable strip blobs, subpixel-phase quantization with the y phase kept inside the 4-px strip row, cache-on-second-sight) applied to geometry without shared object identity: dense CAD sheets redraw the same hatch strokes, dimension arrows, and symbol fills thousands of times as distinct PdfPath instances, so the key is the shape's content - segment opcodes + point deltas from the first point quantized to 1/64 px, stroke/fill parameters, flatten tolerance, and the anchor's subpixel phase. Quantization moves geometry by at most 1/16 px (anchor snap) + 1/128 px (deltas) - half the glyph cache's budget, because snapping a fill shifts whole edges rather than one glyph.

Only paths with at most maxSegments segments attempt the cache (the content walk costs one transform pass + hash, which huge one-off clip/boundary paths must not pay), and - like glyphs - shapes larger than maxShapeSide device px or not fully inside the viewport bypass to the direct unquantized raster.

Constructors

ShapeStripCache({int maxEntries = 131072, int maxBytes = 64 << 20})

Properties

bypasses int
getter/setter pair
collisions int
Draws whose 32-bit content hash matched a stored entry with different content; rendered directly (correctness never rides on the hash).
getter/setter pair
dataBytes int
no setter
entryCount int
no setter
firstSights int
First-sight draws that rendered directly (cache-on-second-sight gate).
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
hits int
getter/setter pair
maxBytes int
Byte budget over CachedShapeStrips.dataBytes (strip blob + content), across both generations.
final
maxEntries int
Live-entry cap across both generations. Dense CAD documents carry ~25-40k distinct small-shape keys per 10-page render; each generation (half this cap) must hold a whole document's working set or its own render rotates its early keys out and every recurrence turns into a full rebuild (measured slower than no cache at all on ly9-far-cad at a 16k cap). Steady state on the heavy corpus is ~40k entries / ~20 MB; the cap is headroom, not expected occupancy.
final
misses int
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resetStats() → void
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

shared ShapeStripCache
Process-wide default instance.
final

Constants

maxSegments → const int
Paths with more segments than this never attempt the cache: the content walk + hash would tax every huge one-off boundary path, and plotted symbols/hatches stay far below it.
maxShapeSide → const int
Shapes larger than this on either side (device px, stroke pad included) bypass the cache.