1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:37:42 +00:00

LibGUI: Use new Bitmap::minimum_pitch method

Also, make sure that the painter actually draws on a RGB(A) bitmap.

Closes #3460.
This commit is contained in:
Ben Wiederhake 2020-09-12 11:14:44 +02:00 committed by Andreas Kling
parent 568d53c9b1
commit e3101c74c6
2 changed files with 2 additions and 1 deletions

View file

@ -635,7 +635,7 @@ RefPtr<Gfx::Bitmap> Window::create_shared_bitmap(Gfx::BitmapFormat format, const
{
ASSERT(WindowServerConnection::the().server_pid());
ASSERT(!size.is_empty());
size_t pitch = round_up_to_power_of_two(size.width() * sizeof(Gfx::RGBA32), 16);
size_t pitch = Gfx::Bitmap::minimum_pitch(size.width(), format);
size_t size_in_bytes = size.height() * pitch;
auto shared_buffer = SharedBuffer::create_with_size(size_in_bytes);
ASSERT(shared_buffer);