mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:18:11 +00:00
WindowServer: Apply screen scaling when getting bitmap around cursor
This fixes an issue for the magnifier that when the screen scaling is increased to 2 the magnifier doesn't center around the cursor. Since booting Serenity with multiple displays doesn't work at the moment the rescaling is only added for the one display case.
This commit is contained in:
parent
548ebbc233
commit
f261b68408
1 changed files with 4 additions and 1 deletions
|
@ -1005,9 +1005,11 @@ Messages::WindowServer::GetScreenBitmapAroundCursorResponse ClientConnection::ge
|
|||
return IterationDecision::Continue;
|
||||
});
|
||||
|
||||
auto screen_scale_factor = ScreenInput::the().cursor_location_screen().scale_factor();
|
||||
if (intersecting_with_screens == 1) {
|
||||
auto& screen = Screen::closest_to_rect(rect);
|
||||
auto bitmap = Compositor::the().front_bitmap_for_screenshot({}, screen).cropped(rect.translated(-screen.rect().location()));
|
||||
auto crop_rect = rect.translated(-screen.rect().location()) * screen_scale_factor;
|
||||
auto bitmap = Compositor::the().front_bitmap_for_screenshot({}, screen).cropped(crop_rect);
|
||||
return bitmap->to_shareable_bitmap();
|
||||
}
|
||||
|
||||
|
@ -1022,6 +1024,7 @@ Messages::WindowServer::GetScreenBitmapAroundCursorResponse ClientConnection::ge
|
|||
if (src_rect.is_empty())
|
||||
return IterationDecision ::Continue;
|
||||
auto& screen_bitmap = Compositor::the().front_bitmap_for_screenshot({}, screen);
|
||||
// TODO: Add scaling support for multiple screens
|
||||
auto from_rect = src_rect.translated(-screen_rect.location());
|
||||
auto target_location = rect.intersected(screen_rect).location().translated(-rect.location());
|
||||
// TODO: painter does *not* support down-sampling!!!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue