1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +00:00

Kernel/Console: Tidy up code a little

- Remove some magic numbers
- Remove some duplicate branches
- Reduce the amount of casting between u8* and u32*
- Some renaming of confusing variables
This commit is contained in:
MacDue 2022-06-08 12:00:05 +01:00 committed by Andreas Kling
parent 805a3d5b29
commit 348750a9f4
2 changed files with 45 additions and 45 deletions

View file

@ -18,8 +18,8 @@ public:
virtual size_t bytes_per_base_glyph() const override;
virtual size_t chars_per_line() const override;
virtual size_t max_column() const override { return m_width / (m_pixels_per_column + m_glyph_spacing); }
virtual size_t max_row() const override { return m_height / m_pixels_per_row; }
virtual size_t max_column() const override { return m_width / (m_glyph_columns + m_glyph_spacing); }
virtual size_t max_row() const override { return m_height / m_glyph_rows; }
virtual bool is_hardware_paged_capable() const override { return false; }
virtual bool has_hardware_cursor() const override { return false; }
@ -48,12 +48,17 @@ protected:
virtual u8* framebuffer_data() = 0;
size_t framebuffer_pitch() const { return m_pitch; }
virtual void clear_glyph(size_t x, size_t y);
u32* framebuffer_offset(size_t x, size_t y);
union FramebufferOffset {
u8* bytes;
u32* pixels;
};
FramebufferOffset framebuffer_offset(size_t x, size_t y);
void flush_glyph(size_t x, size_t y);
size_t const m_glyph_spacing { 1 };
size_t const m_pixels_per_column { 8 };
size_t const m_pixels_per_row { 16 };
size_t const m_glyph_columns { 8 };
size_t const m_glyph_rows { 16 };
Array<u32, 8> m_cursor_overriden_pixels;