mirror of
https://github.com/Genymobile/scrcpy.git
synced 2026-04-21 01:33:36 +00:00
Make PositionMapper use affine transforms
This will allow to apply transformations performed by video filters.
This commit is contained in:
parent
b05bfa73b1
commit
c0056637e9
3 changed files with 14 additions and 9 deletions
|
|
@ -7,6 +7,7 @@ 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.AffineMatrix;
|
||||
import com.genymobile.scrcpy.util.Ln;
|
||||
import com.genymobile.scrcpy.util.LogUtils;
|
||||
import com.genymobile.scrcpy.wrappers.DisplayManager;
|
||||
|
|
@ -145,7 +146,7 @@ public class ScreenCapture extends SurfaceCapture {
|
|||
.createVirtualDisplay("scrcpy", videoSize.getWidth(), videoSize.getHeight(), displayId, surface);
|
||||
virtualDisplayId = virtualDisplay.getDisplay().getDisplayId();
|
||||
// The position are relative to the virtual display, not the original display
|
||||
positionMapper = new PositionMapper(videoSize, videoSize);
|
||||
positionMapper = new PositionMapper(videoSize, null);
|
||||
Ln.d("Display: using DisplayManager API");
|
||||
} catch (Exception displayManagerException) {
|
||||
try {
|
||||
|
|
@ -156,7 +157,9 @@ public class ScreenCapture extends SurfaceCapture {
|
|||
|
||||
setDisplaySurface(display, surface, deviceSize.toRect(), videoSize.toRect(), layerStack);
|
||||
virtualDisplayId = displayId;
|
||||
positionMapper = new PositionMapper(deviceSize, videoSize);
|
||||
|
||||
AffineMatrix videoToDeviceMatrix = videoSize.equals(deviceSize) ? null : AffineMatrix.scale(videoSize, deviceSize);
|
||||
positionMapper = new PositionMapper(videoSize, videoToDeviceMatrix);
|
||||
Ln.d("Display: using SurfaceControl API");
|
||||
} catch (Exception surfaceControlException) {
|
||||
Ln.e("Could not create display using DisplayManager", displayManagerException);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue