summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMustafa Quraish <mustafaq9@gmail.com>2021-08-27 22:58:31 -0400
committerLinus Groh <mail@linusgroh.de>2021-08-28 08:18:41 +0100
commit5f23958abd45559d7882629a4554a671c98aa249 (patch)
tree463f7d32638039635582c584a6922fe2a9059680
parent16830a60ec4972b5fd137ab42e2c8fb88285888e (diff)
downloadserenity-5f23958abd45559d7882629a4554a671c98aa249.zip
WindowServer: Always return properly cropped bitmap
Previously, when `screen_index` was not provided when calling `ClientConnection::get_screen_bitmap`, the bitmap that was created was always the size of the bounding rect of the screen. The actual screen bitmap was being cropped, but the bitmap being returned was of the original size with just black pixels everywhere else.
-rw-r--r--Userland/Services/WindowServer/ClientConnection.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/Userland/Services/WindowServer/ClientConnection.cpp b/Userland/Services/WindowServer/ClientConnection.cpp
index 38ae778882..3b98050d6d 100644
--- a/Userland/Services/WindowServer/ClientConnection.cpp
+++ b/Userland/Services/WindowServer/ClientConnection.cpp
@@ -973,7 +973,8 @@ Messages::WindowServer::GetScreenBitmapResponse ClientConnection::get_screen_bit
return bitmap.to_shareable_bitmap();
}
// TODO: Mixed scale setups at what scale? Lowest? Highest? Configurable?
- if (auto bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, Screen::bounding_rect().size(), 1)) {
+ auto bitmap_size = rect.value_or(Screen::bounding_rect()).size();
+ if (auto bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, bitmap_size, 1)) {
Gfx::Painter painter(*bitmap);
Screen::for_each([&](auto& screen) {
auto screen_rect = screen.rect();