Introduce PositionMapper

Extract the function that converts coordinates from video space to
display space into a separate component.

It only requires the specific data it uses and does not need a full
ScreenInfo object (although it can be created from a ScreenInfo
instance).

PR #5370 <https://github.com/Genymobile/scrcpy/pull/5370>
This commit is contained in:
Romain Vimont
2024-10-12 09:23:31 +02:00
parent d916429566
commit f1368d9a8f
3 changed files with 58 additions and 26 deletions

View File

@@ -1,6 +1,7 @@
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;
@@ -132,7 +133,8 @@ public class ScreenCapture extends SurfaceCapture {
}
}
device.setScreenInfo(screenInfo);
PositionMapper positionMapper = PositionMapper.from(screenInfo);
device.setPositionMapper(positionMapper);
}
@Override