From dac7196bd61e6a4714e68b10f53f4ed5082b5b95 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sun, 11 Mar 2018 13:16:42 +0100 Subject: [PATCH] Support screens with dimensions not divisible by 8 The codec only supports dimensions which are multiple of 8. Thus, when --max-size is specified, the value is always rounded down to the nearest multiple of 8. However, it was wrongly assumed that the physical size is always a multiple of 8. To support such devices, also round down the physical screen dimensions. Fixes . --- server/src/main/java/com/genymobile/scrcpy/Device.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/Device.java b/server/src/main/java/com/genymobile/scrcpy/Device.java index d78ea1b3..07c15e2b 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Device.java +++ b/server/src/main/java/com/genymobile/scrcpy/Device.java @@ -50,8 +50,8 @@ public final class Device { DisplayInfo displayInfo = serviceManager.getDisplayManager().getDisplayInfo(); boolean rotated = (displayInfo.getRotation() & 1) != 0; Size deviceSize = displayInfo.getSize(); - int w = deviceSize.getWidth(); - int h = deviceSize.getHeight(); + int w = deviceSize.getWidth() & ~7; // in case it's not a multiple of 8 + int h = deviceSize.getHeight() & ~7; if (maxSize > 0) { if (BuildConfig.DEBUG && maxSize % 8 != 0) { throw new AssertionError("Max size must be a multiple of 8");