pub struct ImageCache { /* private fields */ }Implementations§
Source§impl ImageCache
impl ImageCache
pub fn new() -> Self
Sourcepub fn drop_changed(&mut self) -> usize
pub fn drop_changed(&mut self) -> usize
Reads again the images whose files changed since they were read (a sheet rebuilt, a frame re-rendered in place): their old copies are dropped and they decode anew, as on first use. Returns how many; costs a stat each.
pub fn set_base_dir(&mut self, dir: &Path)
Sourcepub fn set_device(&mut self, device: &Device)
pub fn set_device(&mut self, device: &Device)
Decode into buffers device reads (sparing the render thread the
upload copy).
Sourcepub fn prefetch(&mut self, src: &str)
pub fn prefetch(&mut self, src: &str)
Starts decoding src ahead of need (a sequence’s coming frames).
Sourcepub fn request(&mut self, src: &str)
pub fn request(&mut self, src: &str)
Starts decoding src if it is not known yet; an exact render waits
for it.
Sourcepub fn poll(&mut self, device: &Device, block: bool) -> Vec<(String, Texture)>
pub fn poll(&mut self, device: &Device, block: bool) -> Vec<(String, Texture)>
Advances loading images. Newly decoded images are uploaded (counted as
uploads); the returned textures still need the working-space pass,
which the caller encodes and then reports with mark_ready.
pub fn mark_ready(&mut self, src: &str, tex: Texture)
pub fn get(&mut self, src: &str) -> Option<&ImageState>
Sourcepub fn end_frame(&mut self)
pub fn end_frame(&mut self)
Advances the LRU clock and evicts the least recently used ready images beyond the cap (never ones used in the last few frames, which in-flight GPU work may still read).
Sourcepub fn is_known(&self, src: &str) -> bool
pub fn is_known(&self, src: &str) -> bool
Whether src is loading, loaded or failed (not dropped or never asked for).