1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +00:00

LibGfx: Give GlyphBitmap its rows data as Bytes

Instead of giving it a raw pointer to the start of the font's rows data
and an offset, give it the Bytes for its rows only.
This commit is contained in:
Sam Atkins 2023-10-02 16:17:15 +01:00 committed by Tim Schumacher
parent a3b91378df
commit f6c40abdb1
2 changed files with 7 additions and 7 deletions

View file

@ -260,8 +260,9 @@ Glyph BitmapFont::glyph(u32 code_point) const
// character, fall back to painting '?' if necessary.
auto index = glyph_index(code_point).value_or('?');
auto width = m_glyph_widths[index];
auto glyph_byte_count = m_glyph_height * GlyphBitmap::bytes_per_row();
return Glyph(
GlyphBitmap(m_rows.data(), index * m_glyph_height, { width, m_glyph_height }),
GlyphBitmap(m_rows.slice(index * glyph_byte_count, glyph_byte_count), { width, m_glyph_height }),
0,
width,
m_glyph_height);
@ -270,8 +271,9 @@ Glyph BitmapFont::glyph(u32 code_point) const
Glyph BitmapFont::raw_glyph(u32 code_point) const
{
auto width = m_glyph_widths[code_point];
auto glyph_byte_count = m_glyph_height * GlyphBitmap::bytes_per_row();
return Glyph(
GlyphBitmap(m_rows.data(), code_point * m_glyph_height, { width, m_glyph_height }),
GlyphBitmap(m_rows.slice(code_point * glyph_byte_count, glyph_byte_count), { width, m_glyph_height }),
0,
width,
m_glyph_height);