pub struct RendererResources { /* private fields */ }Expand description
Renderer resources that manage font, image and font instance keys. RendererResources are local to each renderer / window, since the keys are not shared across renderers
The resources are automatically managed, meaning that they each new frame (signified by start_frame_gc and end_frame_gc)
Implementations§
Source§impl RendererResources
impl RendererResources
pub fn get_image(&self, hash: &ImageRefHash) -> Option<&ResolvedImage>
pub fn get_font_family( &self, style_font_families_hash: &StyleFontFamiliesHash, ) -> Option<&StyleFontFamilyHash>
pub fn get_font_key( &self, style_font_family_hash: &StyleFontFamilyHash, ) -> Option<&FontKey>
pub fn get_registered_font( &self, font_key: &FontKey, ) -> Option<&(FontRef, FastHashMap<(Au, DpiScaleFactor), FontInstanceKey>)>
pub fn update_image( &mut self, image_ref_hash: &ImageRefHash, descriptor: ImageDescriptor, )
Sourcepub fn do_gc(
&mut self,
all_resource_updates: &mut Vec<ResourceUpdate>,
css_image_cache: &ImageCache,
new_layout_results: &[LayoutResult],
gl_texture_cache: &GlTextureCache,
)
pub fn do_gc( &mut self, all_resource_updates: &mut Vec<ResourceUpdate>, css_image_cache: &ImageCache, new_layout_results: &[LayoutResult], gl_texture_cache: &GlTextureCache, )
Updates the internal cache, adds ResourceUpdate::Remove()
to the all_resource_updates
This function will query all current images and fonts submitted into the cache and set them for the next frame so that unused resources will be cleaned up.
This function should be called after the StyledDom has been exchanged for the next frame and AFTER all OpenGL textures and image callbacks have been resolved.
pub fn rerender_image_callback( &mut self, dom_id: DomId, node_id: NodeId, document_id: DocumentId, epoch: Epoch, id_namespace: IdNamespace, gl_context: &OptionGlContextPtr, image_cache: &ImageCache, system_fonts: &FcFontCache, hidpi_factor: f32, callbacks: &RenderCallbacks, layout_results: &mut [LayoutResult], gl_texture_cache: &mut GlTextureCache, ) -> Option<UpdateImageResult>
pub fn update_image_resources( &mut self, layout_results: &[LayoutResult], images_to_update: BTreeMap<DomId, BTreeMap<NodeId, (ImageRef, UpdateImageType)>>, image_masks_to_update: BTreeMap<DomId, BTreeMap<NodeId, ImageMask>>, callbacks: &RenderCallbacks, image_cache: &ImageCache, gl_texture_cache: &mut GlTextureCache, document_id: DocumentId, epoch: Epoch, ) -> Vec<UpdateImageResult>
Trait Implementations§
Source§impl Debug for RendererResources
impl Debug for RendererResources
Auto Trait Implementations§
impl Freeze for RendererResources
impl RefUnwindSafe for RendererResources
impl Send for RendererResources
impl Sync for RendererResources
impl Unpin for RendererResources
impl UnwindSafe for RendererResources
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more