mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:48:11 +00:00
GraphicsBitmap: Add a fill(Color) helper.
This only works for RGB32 and RGBA32 bitmaps at the moment, since it's not obvious what should happen in an Indexed8 bitmap.
This commit is contained in:
parent
d599544890
commit
6aa4cb6740
2 changed files with 11 additions and 0 deletions
|
@ -91,3 +91,12 @@ void GraphicsBitmap::set_mmap_name(const StringView& name)
|
|||
ASSERT(m_needs_munmap);
|
||||
::set_mmap_name(m_data, size_in_bytes(), name.characters());
|
||||
}
|
||||
|
||||
void GraphicsBitmap::fill(Color color)
|
||||
{
|
||||
ASSERT(m_format == GraphicsBitmap::Format::RGB32 || m_format == GraphicsBitmap::Format::RGBA32);
|
||||
for (int y = 0; y < height(); ++y) {
|
||||
auto* scanline = this->scanline(y);
|
||||
fast_dword_fill(scanline, color.value(), width());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue