mirror of
https://github.com/Genymobile/scrcpy.git
synced 2026-02-23 06:44:28 +01:00
Send PositionMapper to Controller directly
When a new capture starts, send a new PositionMapper to the Controller without using the global Device as an intermediate. Now all Device methods are static. PR #5370 <https://github.com/Genymobile/scrcpy/pull/5370>
This commit is contained in:
@@ -3,7 +3,6 @@ package com.genymobile.scrcpy.video;
|
||||
import com.genymobile.scrcpy.AndroidVersions;
|
||||
import com.genymobile.scrcpy.control.PositionMapper;
|
||||
import com.genymobile.scrcpy.device.ConfigurationException;
|
||||
import com.genymobile.scrcpy.device.Device;
|
||||
import com.genymobile.scrcpy.device.DisplayInfo;
|
||||
import com.genymobile.scrcpy.device.Size;
|
||||
import com.genymobile.scrcpy.util.Ln;
|
||||
@@ -21,8 +20,7 @@ import android.view.Surface;
|
||||
|
||||
public class ScreenCapture extends SurfaceCapture {
|
||||
|
||||
private final Device device;
|
||||
|
||||
private final VirtualDisplayListener vdListener;
|
||||
private final int displayId;
|
||||
private int maxSize;
|
||||
private final Rect crop;
|
||||
@@ -37,8 +35,8 @@ public class ScreenCapture extends SurfaceCapture {
|
||||
private IRotationWatcher rotationWatcher;
|
||||
private IDisplayFoldListener displayFoldListener;
|
||||
|
||||
public ScreenCapture(Device device, int displayId, int maxSize, Rect crop, int lockVideoOrientation) {
|
||||
this.device = device;
|
||||
public ScreenCapture(VirtualDisplayListener vdListener, int displayId, int maxSize, Rect crop, int lockVideoOrientation) {
|
||||
this.vdListener = vdListener;
|
||||
this.displayId = displayId;
|
||||
this.maxSize = maxSize;
|
||||
this.crop = crop;
|
||||
@@ -133,8 +131,10 @@ public class ScreenCapture extends SurfaceCapture {
|
||||
}
|
||||
}
|
||||
|
||||
PositionMapper positionMapper = PositionMapper.from(screenInfo);
|
||||
device.setPositionMapper(positionMapper);
|
||||
if (vdListener != null) {
|
||||
PositionMapper positionMapper = PositionMapper.from(screenInfo);
|
||||
vdListener.onNewVirtualDisplay(positionMapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user