mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Ladybird/Qt: Calculate the 'physical pixels' for screens
This fixes a regression introduced by GH-23855 in [1], and re-applies a previous change I made [2]. [1] https://github.com/SerenityOS/serenity/commit/dfc7534 [2] https://github.com/SerenityOS/serenity/commit/b7bd3fd
This commit is contained in:
parent
4eaabdad34
commit
b08d43a5d3
Notes:
sideshowbarker
2024-07-17 06:45:52 +09:00
Author: https://github.com/jamierocks Commit: https://github.com/SerenityOS/serenity/commit/b08d43a5d3 Pull-request: https://github.com/SerenityOS/serenity/pull/24481 Reviewed-by: https://github.com/tcl3 ✅
1 changed files with 4 additions and 1 deletions
|
@ -543,8 +543,11 @@ void WebContentView::update_screen_rects()
|
|||
if (!screens.empty()) {
|
||||
Vector<Web::DevicePixelRect> screen_rects;
|
||||
for (auto const& screen : screens) {
|
||||
// NOTE: QScreen::geometry() returns the 'device-independent pixels', we multiply
|
||||
// by the device pixel ratio to get the 'physical pixels' of the display.
|
||||
auto geometry = screen->geometry();
|
||||
screen_rects.append(Web::DevicePixelRect(geometry.x(), geometry.y(), geometry.width(), geometry.height()));
|
||||
auto device_pixel_ratio = screen->devicePixelRatio();
|
||||
screen_rects.append(Web::DevicePixelRect(geometry.x(), geometry.y(), geometry.width() * device_pixel_ratio, geometry.height() * device_pixel_ratio));
|
||||
}
|
||||
|
||||
// NOTE: The first item in QGuiApplication::screens is always the primary screen.
|
||||
|
|
Loading…
Reference in a new issue