get_glyph_atlas_info refactor (#17044)

# Objective

Return a `GlyphAtlasInfo` instead of a tuple from the inner block so we
can remove the outer mapping.
This commit is contained in:
ickshonpe 2024-12-30 21:08:12 +00:00 committed by GitHub
parent c890cc9dc3
commit d2f61e24e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -179,22 +179,15 @@ impl FontAtlasSet {
self.font_atlases
.get(&FontAtlasKey(cache_key.font_size_bits, font_smoothing))
.and_then(|font_atlases| {
font_atlases
.iter()
.find_map(|atlas| {
atlas.get_glyph_index(cache_key).map(|location| {
(
location,
atlas.texture_atlas.clone_weak(),
atlas.texture.clone_weak(),
)
font_atlases.iter().find_map(|atlas| {
atlas
.get_glyph_index(cache_key)
.map(|location| GlyphAtlasInfo {
location,
texture_atlas: atlas.texture_atlas.clone_weak(),
texture: atlas.texture.clone_weak(),
})
})
.map(|(location, texture_atlas, texture)| GlyphAtlasInfo {
texture_atlas,
location,
texture,
})
})
})
}