pub struct RendererResources {
pub currently_registered_images: OrderedMap<ImageRefHash, ResolvedImage>,
pub image_key_map: OrderedMap<ImageKey, ImageRefHash>,
pub currently_registered_fonts: OrderedMap<FontKey, (FontRef, OrderedMap<(Au, DpiScaleFactor), FontInstanceKey>)>,
pub last_frame_registered_fonts: OrderedMap<FontKey, OrderedMap<(Au, DpiScaleFactor), FontInstanceKey>>,
pub font_families_map: OrderedMap<StyleFontFamiliesHash, StyleFontFamilyHash>,
pub font_id_map: OrderedMap<StyleFontFamilyHash, FontKey>,
pub font_hash_map: OrderedMap<u64, FontKey>,
}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)
Fields§
§currently_registered_images: OrderedMap<ImageRefHash, ResolvedImage>All image keys currently active in the RenderApi
image_key_map: OrderedMap<ImageKey, ImageRefHash>Reverse lookup: ImageKey -> ImageRefHash for display list translation
currently_registered_fonts: OrderedMap<FontKey, (FontRef, OrderedMap<(Au, DpiScaleFactor), FontInstanceKey>)>All font keys currently active in the RenderApi
last_frame_registered_fonts: OrderedMap<FontKey, OrderedMap<(Au, DpiScaleFactor), FontInstanceKey>>Fonts registered on the last frame
Fonts differ from images in that regard that we can’t immediately delete them on a new frame, instead we have to delete them on “current frame + 1” This is because when the frame is being built, we do not know whether the font will actually be successfully loaded
font_families_map: OrderedMap<StyleFontFamiliesHash, StyleFontFamilyHash>Map from the calculated families vec ([“Arial”, “Helvetica”]) to the final loaded font that could be loaded (in this case “Arial” on Windows and “Helvetica” on Mac, because the fonts are loaded in fallback-order)
font_id_map: OrderedMap<StyleFontFamilyHash, FontKey>Same as AzString -> ImageId, but for fonts, i.e. “Roboto” -> FontId(9)
font_hash_map: OrderedMap<u64, FontKey>Direct mapping from font hash (from FontRef) to FontKey TODO: This should become part of SharedFontRegistry