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).
This commit is contained in:
parent
13d09651de
commit
e96573ad0e
@ -80,6 +80,9 @@ public class NewDisplayCapture extends SurfaceCapture {
|
|||||||
DisplayInfo displayInfo = ServiceManager.getDisplayManager().getDisplayInfo(0);
|
DisplayInfo displayInfo = ServiceManager.getDisplayManager().getDisplayInfo(0);
|
||||||
if (displayInfo != null) {
|
if (displayInfo != null) {
|
||||||
mainDisplaySize = displayInfo.getSize();
|
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();
|
mainDisplayDpi = displayInfo.getDpi();
|
||||||
} else {
|
} else {
|
||||||
Ln.w("Main display not found, fallback to 1920x1080 240dpi");
|
Ln.w("Main display not found, fallback to 1920x1080 240dpi");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user