1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:57:35 +00:00

Add a CBitmap class. The C is for Courage.

This commit is contained in:
Andreas Kling 2018-10-12 12:49:45 +02:00
parent e23ac56017
commit c7463aad11
8 changed files with 63 additions and 18 deletions

View file

@ -22,10 +22,13 @@ Font::~Font()
{
}
const char* Font::glyph(char ch) const
const CBitmap* Font::glyphBitmap(byte ch) const
{
if (ch < m_firstGlyph || ch > m_lastGlyph)
return nullptr;
return m_glyphs[(unsigned)ch - m_firstGlyph];
if (!m_bitmaps[ch]) {
if (ch < m_firstGlyph || ch > m_lastGlyph)
return nullptr;
const char* data = m_glyphs[(unsigned)ch - m_firstGlyph];
m_bitmaps[ch] = CBitmap::createFromASCII(data, m_glyphWidth, m_glyphHeight);
}
return m_bitmaps[ch].ptr();
}