pub struct ShapeCache { /* private fields */ }Implementations§
Source§impl ShapeCache
impl ShapeCache
pub fn new(capacity: usize) -> ShapeCache
Sourcepub fn growing(capacity: usize, max_capacity: usize) -> ShapeCache
pub fn growing(capacity: usize, max_capacity: usize) -> ShapeCache
A cache that may grow from capacity up to max_capacity once all of
its entries are live, i.e. every one was touched within the last
capacity lookups. Evicting an on-screen shape forces the next frame to
re-tessellate it, so growing once is the cheaper response to a working
set that outgrew the cache.
pub fn capacity(&self) -> usize
pub fn max_capacity(&self) -> usize
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn stats(&self) -> ShapeStats
pub fn reset_stats(&self)
pub fn clear(&self)
pub fn fill( &self, path: &Path, rule: FillRule, opts: RasterOptions, ) -> Rc<Shape>
pub fn fill_styled(&self, path: &Path, style: FillStyle) -> Rc<Shape>
pub fn fill_offset( &self, path: &Path, rule: FillRule, opts: RasterOptions, offset: Vec2, ) -> Rc<Shape>
pub fn stroke( &self, path: &Path, style: &StrokeStyle, opts: RasterOptions, ) -> Rc<Shape>
pub fn stroke_offset( &self, path: &Path, style: &StrokeStyle, opts: RasterOptions, offset: Vec2, ) -> Rc<Shape>
pub fn fill_contours( &self, contours: &[Contour], rule: FillRule, opts: RasterOptions, ) -> Rc<Shape>
pub fn disk(&self, center: Point, radius: f32) -> Rc<Shape>
pub fn rounded_rect(&self, rect: Rect, radius: f32) -> Rc<Shape>
pub fn rect(&self, rect: Rect) -> Rc<Shape>
Sourcepub fn begin_prefetch(&self)
pub fn begin_prefetch(&self)
Starts a prefetch pass.
While the pass is active, cache misses are recorded instead of
tessellated, and each miss returns an empty placeholder Shape. The
caller is expected to paint again after
ShapeCache::tessellate_prefetch, so the placeholders never reach the
screen. Do not retain placeholder shapes across the pass.
Sourcepub fn end_prefetch(&self) -> usize
pub fn end_prefetch(&self) -> usize
Ends a prefetch pass and returns how many distinct shapes missed the cache. Nothing has been tessellated yet.
Sourcepub fn tessellate_prefetch(&self) -> usize
pub fn tessellate_prefetch(&self) -> usize
Tessellates the shapes recorded by the last prefetch pass and inserts them into the cache, returning how many were built.
Big batches are split across worker threads; each worker builds its
shapes with parallel(false) because the batch already keeps the cores
busy. Small batches stay on the calling thread, and a lone shape keeps
its own band-parallel rasterizer. Results are inserted in request order
so a batch produces the same spans every time.