mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:28:13 +00:00
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.
This commit is contained in:
parent
5f23958abd
commit
2dea772d48
1 changed files with 1 additions and 5 deletions
|
@ -131,7 +131,7 @@ int main(int argc, char** argv)
|
||||||
if (screen >= 0)
|
if (screen >= 0)
|
||||||
screen_index = (u32)screen;
|
screen_index = (u32)screen;
|
||||||
dbgln("getting screenshot...");
|
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");
|
dbgln("got screenshot");
|
||||||
|
|
||||||
RefPtr<Gfx::Bitmap> bitmap = shared_bitmap.bitmap();
|
RefPtr<Gfx::Bitmap> bitmap = shared_bitmap.bitmap();
|
||||||
|
@ -140,10 +140,6 @@ int main(int argc, char** argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (select_region) {
|
|
||||||
bitmap = bitmap->cropped(crop_region);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (output_to_clipboard) {
|
if (output_to_clipboard) {
|
||||||
GUI::Clipboard::the().set_bitmap(*bitmap);
|
GUI::Clipboard::the().set_bitmap(*bitmap);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue