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

LibGfx+FontEditor: Consolidate BitmapFont width and height limits

And make them more self-documenting. Previously these constraints
were duplicated across multiple files.
This commit is contained in:
thankyouverycool 2021-11-29 10:33:34 -05:00 committed by Andreas Kling
parent 541f1de3a8
commit e29abc5395
5 changed files with 20 additions and 16 deletions

View file

@ -38,10 +38,14 @@ public:
int width() const { return m_size.width(); }
int height() const { return m_size.height(); }
static constexpr size_t bytes_per_row() { return sizeof(u32); }
static constexpr int max_width() { return bytes_per_row() * 8; }
static constexpr int max_height() { return max_width() + bytes_per_row(); }
private:
AK::Bitmap bitmap(size_t y) const
{
return { const_cast<u8*>(m_rows) + sizeof(u32) * (m_start_index + y), sizeof(u32) * 8 };
return { const_cast<u8*>(m_rows) + bytes_per_row() * (m_start_index + y), bytes_per_row() * 8 };
}
const u8* m_rows { nullptr };