EvanZhu0721 / 公开仓库
SBMS
SBMS complete the calculation rules for the default logical desktop topology relationship and the physical dimensions of the displays in the Windows multi-screen collaboration system.
文件
../ architecture.md2.3 KBconfiguration.md4.9 KBgeometry.md2.4 KBlogical-desktop-size-observation.md3.4 KBmapping-plan.md4.9 KBdocs/geometry.md2.4 KB
1
# Geometry API2
3
The public types in `src/geometry.rs` are the single source of truth for4
virtual-display sizing and pointer-coordinate conversion. A frontend should5
persist `SizingRequest`, call `SizingRequest::calculate`, and pass the request6
through the existing mapping path. It should not calculate or persist a derived7
display mode itself.8
9
## Sizing10
11
```rust12
pub struct DisplayGeometry {13
pub native_pixels: PixelSize,14
pub physical: PhysicalMeasurement,15
pub aspect_ratio: Option<AspectRatio>,16
pub rotation: Rotation,17
}18
19
pub struct SizingRequest {20
pub reference: DisplayGeometry,21
pub target: DisplayGeometry,22
pub strategy: SizingStrategy,23
pub alignment: u32,24
pub preferred_refresh_millihz: Option<u32>,25
}26
27
pub enum SizingStrategy {28
MatchPhysicalSize,29
RoundedScale,30
IntegerScale,31
}32
```33
34
`reference` describes the display whose apparent pixel density should be35
matched. `target` describes the physical display that receives the mirror.36
Physical size may be supplied as width and height in millimetres or as a37
diagonal; an explicit aspect ratio can be supplied when a diagonal is used.38
39
`SizingRequest::calculate()` returns:40
41
```rust42
pub struct SizingResult {43
pub virtual_mode: PixelSize,44
pub oriented_target: PixelSize,45
pub scale_x: f64,46
pub scale_y: f64,47
pub preferred_refresh_millihz: Option<u32>,48
}49
```50
51
The alignment must be a power of two from 1 through 256. Measurements must be52
finite and positive. A preferred refresh rate, when present, must be non-zero.53
The session gate accepts dimensions from 1 through 16384 and refresh rates up54
to 1000 Hz.55
56
## Mapping path57
58
```text59
SizingRequest::calculate60
-> SizingResult.virtual_mode61
-> VirtualMode62
-> protected v5 session gate63
-> IDD monitor and target mode64
-> Windows display source65
-> GPU renderer66
```67
68
The mode is fixed before the software display device is created. Changing it69
requires stopping and starting the mapping session.70
71
## Pointer coordinates72
73
`CoordinateTransform::stretch(target, source, rotation)` builds the transform74
shared by the renderer input path. `map_target_point` maps a physical target75
point to the corresponding virtual-desktop point and returns `None` outside the76
target rectangle.77
78
```rust79
let transform = CoordinateTransform::stretch(target_rect, source_rect, rotation)?;80
let source_point = transform.map_target_point(target_point);81
```82
83
The transform supports 0, 90, 180 and 270 degree rotation.84