pub struct PathAtlas { /* private fields */ }Expand description
Shelf-packed atlas for rasterized paths with LRU eviction.
Implementations§
Source§impl PathAtlas
impl PathAtlas
Sourcepub fn new(width: u32, height: u32) -> Self
pub fn new(width: u32, height: u32) -> Self
Create a new path atlas with the given initial dimensions.
Sourcepub fn oversize_skips(&self) -> u64
pub fn oversize_skips(&self) -> u64
How many paths have been skipped for being too large to ever fit the atlas.
Each one is a path that simply was not drawn. Non-zero means some geometry is
rasterizing bigger than max_size — upstream, that is a
layout that has run away (an overlay spanning a whole scrolled document, a
shape scaled by a runaway transform), and it is worth chasing rather than
leaving as a hole in the frame.
Sourcepub fn begin_frame(&mut self)
pub fn begin_frame(&mut self)
Call at the start of each frame to advance the LRU counter.
This is also the only point at which the atlas may safely repack
itself: no AtlasRegion has been handed out for the new frame yet, so
moving surviving entries to fresh coordinates cannot invalidate any
region the renderer is still holding from the current frame. When the
atlas is near-full and there are stale entries (not touched on the last
completed frame), we compact — dropping the stale entries and repacking
the rest tightly — so steady-state reclamation never has to happen
mid-frame (which would corrupt already-placed paths).
Sourcepub fn mark_clean(&mut self)
pub fn mark_clean(&mut self)
Mark the atlas as uploaded.
Sourcepub fn lookup_or_rasterize(
&mut self,
path: &Path,
style: &StrokeStyle,
fill_rule: FillRule,
bounds: [f32; 4],
scale_factor: f32,
zoom: f32,
) -> Option<AtlasRegion>
pub fn lookup_or_rasterize( &mut self, path: &Path, style: &StrokeStyle, fill_rule: FillRule, bounds: [f32; 4], scale_factor: f32, zoom: f32, ) -> Option<AtlasRegion>
Look up or rasterize a path, returning its atlas region.
The rasterized bitmap is always an opaque-white AA coverage
mask — color is applied by the GPU at draw time (solid fills tint
it via the quad pipeline; gradients sample an analytic gradient in
path_gradient.wgsl and modulate by the mask’s alpha channel), so
this function takes no color and two fills of identical geometry
share one atlas entry regardless of their paint.
zoom is the uniform scale of the view transform active where the path
is drawn. For a cosmetic stroke (StrokeSpace::Device) the body
is rasterized at the current zoom (so it stays sharp, matching the
transform-scaled display quad 1:1) while the stroke is baked at a
zoom-independent device width — the border holds a constant
device-pixel thickness at any zoom. Logical strokes ignore zoom
(the body bitmap is stretched by the display quad, as before).