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 <https://github.com/Genymobile/scrcpy/issues/39>.
This commit is contained in:
parent
c87d94ee27
commit
dac7196bd6
1 changed files with 2 additions and 2 deletions
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue