From 2dea772d48f45a5856eff39e14d615610b3c97c7 Mon Sep 17 00:00:00 2001 From: Mustafa Quraish Date: Fri, 27 Aug 2021 23:03:21 -0400 Subject: [PATCH] shot: Get only cropped region from WindowServer Previously, we were always getting the full screen(s) bitmap from the WindowServer and cropping it manually. The `get_screen_bitmap` function already took in a `crop_region`, so we are now utilizing that. --- Userland/Utilities/shot.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Userland/Utilities/shot.cpp b/Userland/Utilities/shot.cpp index f15ce17a33..2f6087d144 100644 --- a/Userland/Utilities/shot.cpp +++ b/Userland/Utilities/shot.cpp @@ -131,7 +131,7 @@ int main(int argc, char** argv) if (screen >= 0) screen_index = (u32)screen; dbgln("getting screenshot..."); - auto shared_bitmap = GUI::WindowServerConnection::the().get_screen_bitmap({}, screen_index); + auto shared_bitmap = GUI::WindowServerConnection::the().get_screen_bitmap(crop_region, screen_index); dbgln("got screenshot"); RefPtr bitmap = shared_bitmap.bitmap(); @@ -140,10 +140,6 @@ int main(int argc, char** argv) return 1; } - if (select_region) { - bitmap = bitmap->cropped(crop_region); - } - if (output_to_clipboard) { GUI::Clipboard::the().set_bitmap(*bitmap); return 0;