From cf47dae6a5c6696dfe324b8e1deab8bf7ff9c55f Mon Sep 17 00:00:00 2001 From: FrHun <28605587+frhun@users.noreply.github.com> Date: Tue, 6 Dec 2022 00:04:41 +0100 Subject: [PATCH] LibGfx: Repair SharableBitmap scaling support --- Userland/Libraries/LibGfx/ShareableBitmap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibGfx/ShareableBitmap.cpp b/Userland/Libraries/LibGfx/ShareableBitmap.cpp index 3edffe0696..97bc55fd94 100644 --- a/Userland/Libraries/LibGfx/ShareableBitmap.cpp +++ b/Userland/Libraries/LibGfx/ShareableBitmap.cpp @@ -31,7 +31,7 @@ bool encode(Encoder& encoder, Gfx::ShareableBitmap const& shareable_bitmap) auto& bitmap = *shareable_bitmap.bitmap(); encoder << IPC::File(bitmap.anonymous_buffer().fd()); encoder << bitmap.size(); - encoder << bitmap.scale(); + encoder << static_cast(bitmap.scale()); encoder << (u32)bitmap.format(); if (bitmap.is_indexed()) { auto palette = bitmap.palette_to_vector(); @@ -64,7 +64,7 @@ ErrorOr decode(Decoder& decoder, Gfx::ShareableBitmap& shareable_bitmap) if (Gfx::Bitmap::is_indexed(bitmap_format)) { TRY(decoder.decode(palette)); } - auto buffer = TRY(Core::AnonymousBuffer::create_from_anon_fd(anon_file.take_fd(), Gfx::Bitmap::size_in_bytes(Gfx::Bitmap::minimum_pitch(size.width(), bitmap_format), size.height()))); + auto buffer = TRY(Core::AnonymousBuffer::create_from_anon_fd(anon_file.take_fd(), Gfx::Bitmap::size_in_bytes(Gfx::Bitmap::minimum_pitch(size.width() * scale, bitmap_format), size.height() * scale))); auto bitmap = TRY(Gfx::Bitmap::try_create_with_anonymous_buffer(bitmap_format, move(buffer), size, scale, palette)); shareable_bitmap = Gfx::ShareableBitmap { move(bitmap), Gfx::ShareableBitmap::ConstructWithKnownGoodBitmap }; return {};