mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:37:34 +00:00
LibAccelGfx: Skip glyphs with missing bitmaps
Fixes crashing when we can't produce a bitmap for a glyph.
This commit is contained in:
parent
48faa0e706
commit
790bfd7ef9
1 changed files with 7 additions and 3 deletions
|
@ -382,10 +382,12 @@ void Painter::prepare_glyph_texture(HashMap<Gfx::Font const*, HashTable<u32>> co
|
||||||
for (auto const& [font, code_points] : unique_glyphs) {
|
for (auto const& [font, code_points] : unique_glyphs) {
|
||||||
for (auto const& code_point : code_points) {
|
for (auto const& code_point : code_points) {
|
||||||
auto glyph = font->glyph(code_point);
|
auto glyph = font->glyph(code_point);
|
||||||
|
if (glyph.bitmap()) {
|
||||||
auto atlas_key = GlyphsTextureKey { font, code_point };
|
auto atlas_key = GlyphsTextureKey { font, code_point };
|
||||||
glyph_bitmaps.set(atlas_key, *glyph.bitmap());
|
glyph_bitmaps.set(atlas_key, *glyph.bitmap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (glyph_bitmaps.is_empty())
|
if (glyph_bitmaps.is_empty())
|
||||||
return;
|
return;
|
||||||
|
@ -444,7 +446,9 @@ void Painter::draw_glyph_run(Vector<Gfx::DrawGlyphOrEmoji> const& glyph_run, Col
|
||||||
auto point = glyph.position;
|
auto point = glyph.position;
|
||||||
|
|
||||||
auto maybe_texture_rect = m_glyphs_texture_map.get(GlyphsTextureKey { font, code_point });
|
auto maybe_texture_rect = m_glyphs_texture_map.get(GlyphsTextureKey { font, code_point });
|
||||||
VERIFY(maybe_texture_rect.has_value());
|
if (!maybe_texture_rect.has_value()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
auto texture_rect = to_texture_space(maybe_texture_rect.value().to_type<float>(), m_glyphs_texture_size);
|
auto texture_rect = to_texture_space(maybe_texture_rect.value().to_type<float>(), m_glyphs_texture_size);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue