pub struct Viewport {
pub extents: Option<[[f32; 2]; 2]>,
pub viewport_to_context_transform: Option<[f32; 9]>,
/* private fields */
}
Expand description
A rectangular region that directs injected events into a target.
The viewport relates a pointer’s position across multiple independent coordinate systems: the context, the viewport, and the dispatch clients. Intuitively, the viewport is how a pointer’s position is mapped to an interactive part of the scene.
A matrix is used to relate the viewport coordinate system to the context coordinate system. A pair of extents defines the viewport’s size in the viewport coordinate system. Together, they define the viewport’s placement in the context coordinate system.
The viewport coordinate system is used to convey a pointer’s coordinates in a scale-invariant way to dispatch clients, so that pointer movement can be interpreted correctly under effects like magnification. The context defines the viewport’s minimal and maximal extents in the viewport coordinate system.
- The boundary of the viewport, a rectangle, is axis aligned with the viewport coordinate system; however it may otherwise be freely positioned (“float”) within it: there is translation and scaling, but no rotation.
- Floating gives the injector some choice in how to convey coordinates, such as in Vulkan NDC, or in display pixel coordinates.
- The viewport rectangle defines a latch region used in dispatch (described below).
A dispatch client receives a pointer’s coordinates in the viewport coordinate system, along with a matrix to convert coordinates from the viewport coordinate system to the dispatch client’s coordinate system.
All fields required.
TODO(https://fxbug.dev/42162296): Rename Viewport, it is used in Flatland.
Fields§
§extents: Option<[[f32; 2]; 2]>
The viewport’s minimal and maximal extents in the viewport coordinate system.
viewport_to_context_transform: Option<[f32; 9]>
A transformation matrix that describes how to map the viewport coordinate system to the context coordinate system.
This transform, together with |extents|, defines the viewport’s placement in the context coordinate system.
This transform must be an invertible matrix (i.e., has a non-zero determinant), which guarantees it describes a bijection between the viewport coordinate system and the context coordinate system. A non-invertible matrix is rejected.
Trait Implementations§
Source§impl<D: ResourceDialect> Decode<Viewport, D> for Viewport
impl<D: ResourceDialect> Decode<Viewport, D> for Viewport
Source§impl TypeMarker for Viewport
impl TypeMarker for Viewport
Source§fn inline_align(_context: Context) -> usize
fn inline_align(_context: Context) -> usize
Source§fn inline_size(_context: Context) -> usize
fn inline_size(_context: Context) -> usize
inline_align
.§fn encode_is_copy() -> bool
fn encode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and encoding requires no validation. When true, we can optimize
encoding arrays and vectors of Self::Owned
to a single memcpy. Read more§fn decode_is_copy() -> bool
fn decode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and decoding requires no validation. When true, we can optimize
decoding arrays and vectors of Self::Owned
to a single memcpy.Source§impl ValueTypeMarker for Viewport
impl ValueTypeMarker for Viewport
impl Persistable for Viewport
impl StructuralPartialEq for Viewport
Auto Trait Implementations§
impl Freeze for Viewport
impl RefUnwindSafe for Viewport
impl Send for Viewport
impl Sync for Viewport
impl Unpin for Viewport
impl UnwindSafe for Viewport
Blanket Implementations§
§impl<T> Body for Twhere
T: Persistable,
impl<T> Body for Twhere
T: Persistable,
§type MarkerAtTopLevel = T
type MarkerAtTopLevel = T
§type MarkerInResultUnion = T
type MarkerInResultUnion = T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)