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

LibGfx+LibGUI+WindowServer: Use move() on Core::AnonymousBuffer more

This commit is contained in:
Andreas Kling 2021-07-07 17:33:35 +02:00
parent 4cb0bbef9d
commit 86d0145260
3 changed files with 5 additions and 5 deletions

View file

@ -808,7 +808,7 @@ OwnPtr<WindowBackingStore> Window::create_backing_store(const Gfx::IntSize& size
} }
// FIXME: Plumb scale factor here eventually. // FIXME: Plumb scale factor here eventually.
auto bitmap = Gfx::Bitmap::create_with_anonymous_buffer(format, buffer, size, 1, {}); auto bitmap = Gfx::Bitmap::create_with_anonymous_buffer(format, move(buffer), size, 1, {});
if (!bitmap) { if (!bitmap) {
VERIFY(size.width() <= INT16_MAX); VERIFY(size.width() <= INT16_MAX);
VERIFY(size.height() <= INT16_MAX); VERIFY(size.height() <= INT16_MAX);

View file

@ -193,7 +193,7 @@ RefPtr<Bitmap> Bitmap::create_with_anonymous_buffer(BitmapFormat format, Core::A
if (size_would_overflow(format, size, scale_factor)) if (size_would_overflow(format, size, scale_factor))
return nullptr; return nullptr;
return adopt_ref(*new Bitmap(format, buffer, size, scale_factor, palette)); return adopt_ref(*new Bitmap(format, move(buffer), size, scale_factor, palette));
} }
/// Read a bitmap as described by: /// Read a bitmap as described by:
@ -290,7 +290,7 @@ Bitmap::Bitmap(BitmapFormat format, Core::AnonymousBuffer buffer, const IntSize&
, m_pitch(minimum_pitch(size.width() * scale_factor, format)) , m_pitch(minimum_pitch(size.width() * scale_factor, format))
, m_format(format) , m_format(format)
, m_purgeable(true) , m_purgeable(true)
, m_buffer(buffer) , m_buffer(move(buffer))
{ {
VERIFY(!is_indexed() || !palette.is_empty()); VERIFY(!is_indexed() || !palette.is_empty());
VERIFY(!size_would_overflow(format, size, scale_factor)); VERIFY(!size_would_overflow(format, size, scale_factor));
@ -501,7 +501,7 @@ RefPtr<Bitmap> Bitmap::to_bitmap_backed_by_anonymous_buffer() const
auto buffer = Core::AnonymousBuffer::create_with_size(round_up_to_power_of_two(size_in_bytes(), PAGE_SIZE)); auto buffer = Core::AnonymousBuffer::create_with_size(round_up_to_power_of_two(size_in_bytes(), PAGE_SIZE));
if (!buffer.is_valid()) if (!buffer.is_valid())
return nullptr; return nullptr;
auto bitmap = Bitmap::create_with_anonymous_buffer(m_format, buffer, size(), scale(), palette_to_vector()); auto bitmap = Bitmap::create_with_anonymous_buffer(m_format, move(buffer), size(), scale(), palette_to_vector());
if (!bitmap) if (!bitmap)
return nullptr; return nullptr;
memcpy(bitmap->scanline(0), scanline(0), size_in_bytes()); memcpy(bitmap->scanline(0), scanline(0), size_in_bytes());

View file

@ -682,7 +682,7 @@ void ClientConnection::set_window_backing_store(i32 window_id, [[maybe_unused]]
} }
auto backing_store = Gfx::Bitmap::create_with_anonymous_buffer( auto backing_store = Gfx::Bitmap::create_with_anonymous_buffer(
has_alpha_channel ? Gfx::BitmapFormat::BGRA8888 : Gfx::BitmapFormat::BGRx8888, has_alpha_channel ? Gfx::BitmapFormat::BGRA8888 : Gfx::BitmapFormat::BGRx8888,
buffer, move(buffer),
size, size,
1, 1,
{}); {});