1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:47:34 +00:00

LibCore: Use ErrorOr<T> in Core::AnonymousBuffer

This commit is contained in:
Andreas Kling 2021-11-06 01:20:51 +01:00
parent c4edb9f6c2
commit e2eabb4132
15 changed files with 56 additions and 53 deletions

View file

@ -635,14 +635,14 @@ void ClientConnection::set_window_backing_store(i32 window_id, [[maybe_unused]]
window.swap_backing_stores();
} else {
// FIXME: Plumb scale factor here eventually.
Core::AnonymousBuffer buffer = Core::AnonymousBuffer::create_from_anon_fd(anon_file.take_fd(), pitch * size.height());
if (!buffer.is_valid()) {
auto buffer_or_error = Core::AnonymousBuffer::create_from_anon_fd(anon_file.take_fd(), pitch * size.height());
if (buffer_or_error.is_error()) {
did_misbehave("SetWindowBackingStore: Failed to create anonymous buffer for window backing store");
return;
}
auto backing_store = Gfx::Bitmap::try_create_with_anonymous_buffer(
has_alpha_channel ? Gfx::BitmapFormat::BGRA8888 : Gfx::BitmapFormat::BGRx8888,
move(buffer),
buffer_or_error.release_value(),
size,
1,
{});