Kernel: Drop 24 bpp support from double buffer

I don't even know why this was supported, I am not planning on making
the fb anything other than 32 bpp
This commit is contained in:
Bananymous 2025-07-01 13:51:22 +03:00
parent 1b2aa6c2da
commit c2d09b64ca
1 changed files with 4 additions and 10 deletions

View File

@ -128,22 +128,16 @@ namespace Kernel
uint32_t FramebufferDevice::get_pixel(uint32_t x, uint32_t y) const
{
ASSERT(x < m_width && y < m_height);
const auto* video_buffer_u8 = reinterpret_cast<const uint8_t*>(m_video_buffer->vaddr());
return (video_buffer_u8[(y * m_width + x) * (BANAN_FB_BPP / 8) + 0] << 0)
| (video_buffer_u8[(y * m_width + x) * (BANAN_FB_BPP / 8) + 1] << 8)
| (video_buffer_u8[(y * m_width + x) * (BANAN_FB_BPP / 8) + 2] << 16);
static_assert(BANAN_FB_BPP == 32);
return reinterpret_cast<uint32_t*>(m_video_buffer->vaddr())[y * m_width + x];
}
void FramebufferDevice::set_pixel(uint32_t x, uint32_t y, uint32_t rgb)
{
if (x >= m_width || y >= m_height)
return;
auto* video_buffer_u8 = reinterpret_cast<uint8_t*>(m_video_buffer->vaddr());
video_buffer_u8[(y * m_width + x) * (BANAN_FB_BPP / 8) + 0] = rgb >> 0;
video_buffer_u8[(y * m_width + x) * (BANAN_FB_BPP / 8) + 1] = rgb >> 8;
video_buffer_u8[(y * m_width + x) * (BANAN_FB_BPP / 8) + 2] = rgb >> 16;
if constexpr(BANAN_FB_BPP == 32)
video_buffer_u8[(y * m_width + x) * (BANAN_FB_BPP / 8) + 3] = rgb >> 24;
static_assert(BANAN_FB_BPP == 32);
reinterpret_cast<uint32_t*>(m_video_buffer->vaddr())[y * m_width + x] = rgb;
}
void FramebufferDevice::scroll(int32_t rows, uint32_t rgb)