1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:07:34 +00:00

LibGfx+LibAccelGfx+LibWeb: Use RefPtr for font in DrawGlyphOrEmoji

This commit is contained in:
Aliaksandr Kalenik 2023-12-09 23:14:07 +01:00 committed by Andreas Kling
parent 451df70275
commit 0d03257e69
5 changed files with 11 additions and 11 deletions

View file

@ -399,18 +399,18 @@ void Painter::draw_glyph_run(Span<Gfx::DrawGlyphOrEmoji const> glyph_run, Color
if (glyph_or_emoji.has<Gfx::DrawGlyph>()) {
auto const& glyph = glyph_or_emoji.get<Gfx::DrawGlyph>();
auto const* font = glyph.font;
auto const& font = *glyph.font;
auto code_point = glyph.code_point;
auto point = glyph.position;
auto maybe_texture_rect = glyph_atlas.get_glyph_rect(font, code_point);
auto maybe_texture_rect = glyph_atlas.get_glyph_rect(&font, code_point);
if (!maybe_texture_rect.has_value()) {
continue;
}
auto texture_rect = to_texture_space(maybe_texture_rect.value().to_type<float>(), *glyph_atlas.texture().size);
auto glyph_position = point + Gfx::FloatPoint(font->glyph_left_bearing(code_point), 0);
auto glyph_position = point + Gfx::FloatPoint(font.glyph_left_bearing(code_point), 0);
auto glyph_size = maybe_texture_rect->size().to_type<float>();
auto glyph_rect = transform().map(Gfx::FloatRect { glyph_position, glyph_size });
auto rect_in_clip_space = to_clip_space(glyph_rect);