mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 02:12:09 -05:00
LibWeb: Use Gfx::Bitmap::create_shareable() in OOPWV
We were jumping through some pretty wasteful hoops in the resize event handler of OOPWV by first creating a bitmap and then immediately creating a new (shareable) clone of that bitmap. Now we go straight to the shareable bitmap instead.
This commit is contained in:
parent
0bc8d58c3b
commit
1898aa8cd4
1 changed files with 6 additions and 10 deletions
|
@ -104,18 +104,14 @@ void OutOfProcessWebView::resize_event(GUI::ResizeEvent& event)
|
|||
if (available_size().is_empty())
|
||||
return;
|
||||
|
||||
// FIXME: Don't create a temporary bitmap just to convert it to one backed by a shared buffer.
|
||||
if (auto helper = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, available_size())) {
|
||||
m_front_bitmap = helper->to_bitmap_backed_by_shared_buffer();
|
||||
ASSERT(m_front_bitmap);
|
||||
m_front_bitmap->shared_buffer()->share_with(client().server_pid());
|
||||
if (auto new_bitmap = Gfx::Bitmap::create_shareable(Gfx::BitmapFormat::RGB32, available_size())) {
|
||||
new_bitmap->shared_buffer()->share_with(client().server_pid());
|
||||
m_front_bitmap = move(new_bitmap);
|
||||
}
|
||||
|
||||
// FIXME: Don't create a temporary bitmap just to convert it to one backed by a shared buffer.
|
||||
if (auto helper = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, available_size())) {
|
||||
m_back_bitmap = helper->to_bitmap_backed_by_shared_buffer();
|
||||
ASSERT(m_back_bitmap);
|
||||
m_back_bitmap->shared_buffer()->share_with(client().server_pid());
|
||||
if (auto new_bitmap = Gfx::Bitmap::create_shareable(Gfx::BitmapFormat::RGB32, available_size())) {
|
||||
new_bitmap->shared_buffer()->share_with(client().server_pid());
|
||||
m_back_bitmap = move(new_bitmap);
|
||||
}
|
||||
|
||||
request_repaint();
|
||||
|
|
Loading…
Add table
Reference in a new issue