RendererResources

Struct RendererResources 

Source
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

Source

pub fn get_image(&self, hash: &ImageRefHash) -> Option<&ResolvedImage>

Source

pub fn get_font_family( &self, style_font_families_hash: &StyleFontFamiliesHash, ) -> Option<&StyleFontFamilyHash>

Source

pub fn get_font_key( &self, style_font_family_hash: &StyleFontFamilyHash, ) -> Option<&FontKey>

Source

pub fn get_registered_font( &self, font_key: &FontKey, ) -> Option<&(FontRef, FastHashMap<(Au, DpiScaleFactor), FontInstanceKey>)>

Source

pub fn update_image( &mut self, image_ref_hash: &ImageRefHash, descriptor: ImageDescriptor, )

Source

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.

Source

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>

Source

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RendererResources

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.