Skip to main content

select_render_data

Function select_render_data 

Source
pub fn select_render_data<'a, D, I, F>(
    sprite: &SpriteFields<'_>,
    deref: D,
    file_atlases: I,
    meter: &Arc<Meter>,
) -> Result<RenderData, SpriteError>
where D: FnOnce(Pptr) -> Option<&'a Parsed>, I: IntoIterator<Item = (&'a [u8], F)>, F: FnOnce() -> Option<&'a Parsed>,
Expand description

The render data get_image_from_sprite renders sprite from (module docs, :63-81): deref resolves m_SpriteAtlas where it is set (None, no object, is SpriteError::AtlasUnresolved); else, where the Sprite has an atlas tag, file_atlases lists the file’s SpriteAtlas objects in its order, each as its name (peek_name) and a parse of it, which is called only for the first whose name is the tag; else, or with no atlas found, the Sprite’s own m_RD. Each atlas compared counts one unit of meter’s decode work, and as many more as the bytes its name’s comparison with the tag may read (compared), before it is compared; atlas_render_data counts its own (module docs).