mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-04-19 19:15:08 +00:00
Use natural device orientation for --new-display
If no size is provided with --new-display, the main display size is used. But the actual size depended on the current device orientation. To make it deterministic, use the size of the natural device orientation (portrait for phones, landscape for tablets). PR #5455 <https://github.com/Genymobile/scrcpy/pull/5455>
This commit is contained in:
parent
0904880816
commit
443f315f60
1 changed files with 3 additions and 0 deletions
|
@ -80,6 +80,9 @@ public class NewDisplayCapture extends SurfaceCapture {
|
|||
DisplayInfo displayInfo = ServiceManager.getDisplayManager().getDisplayInfo(0);
|
||||
if (displayInfo != null) {
|
||||
mainDisplaySize = displayInfo.getSize();
|
||||
if ((displayInfo.getRotation() % 2) != 0) {
|
||||
mainDisplaySize = mainDisplaySize.rotate(); // Use the natural device orientation (at rotation 0), not the current one
|
||||
}
|
||||
mainDisplayDpi = displayInfo.getDpi();
|
||||
} else {
|
||||
Ln.w("Main display not found, fallback to 1920x1080 240dpi");
|
||||
|
|
Loading…
Add table
Reference in a new issue