/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! A collection of coordinate spaces and their corresponding Point, Size and Rect types. //! //! Physical pixels take into account the device pixel ratio and their dimensions tend //! to correspond to the allocated size of resources in memory, while logical pixels //! don't have the device pixel ratio applied which means they are agnostic to the usage //! of hidpi screens and the like. //! //! The terms "layer" and "stacking context" can be used interchangeably //! in the context of coordinate systems. //! //! See also webrender/doc/coordinate-spaces.md
pubuse app_units::Au; use euclid::{Length, Rect, Scale, Size2D, Transform3D, Translation2D}; use euclid::{Point2D, Point3D, Vector2D, Vector3D, SideOffsets2D, Box2D}; use euclid::HomogeneousVector; use peek_poke::PeekPoke; // local imports usecrate::image::DirtyRect;
/// Geometry in the coordinate system of the render target (screen or intermediate /// surface) in physical pixels. #[derive(Hash, Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Serialize, Deserialize)] pubstruct DevicePixel;
/// Geometry in the coordinate system of the framebuffer in physical pixels. /// It's Y-flipped comparing to DevicePixel. #[derive(Hash, Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Serialize, Deserialize)] pubstruct FramebufferPixel;
/// Geometry gets rasterized in a given root coordinate space. This /// is often the root spatial node (world space), but may be a local /// space for a variety of reasons (e.g. perspective). #[derive(Hash, Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)] pubstruct RasterPixel;
/// Geometry in the space in which we decided to perform visibility/clipping/invalidation /// calculations. /// This is intended to be a temporary type while transitioning some calculation from world /// to raster space. #[derive(Hash, Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, Ord, PartialOrd, Deserialize, Serialize, PeekPoke)] pubstruct VisPixel;
pubtype VisRect = Box2D<f32, VisPixel>;
/// TODO: Remove this once visibility rects have moved to raster space. pubfn vis_rect_as_world(r: VisRect) -> WorldRect {
r.cast_unit()
}
/// Offset in number of tiles. #[derive(Hash, Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)] pubstruct Tiles; pubtype TileOffset = Point2D<i32, Tiles>; pubtype TileRange = Box2D<i32, Tiles>;
/// Scaling ratio from world pixels to device pixels. pubtype DevicePixelScale = Scale<f32, WorldPixel, DevicePixel>; /// Scaling ratio from layout to world. Used for cases where we know the layout /// is in world space, or specifically want to treat it this way. pubtype LayoutToWorldScale = Scale<f32, LayoutPixel, WorldPixel>; /// A complete scaling ratio from layout space to device pixel space. pubtype LayoutToDeviceScale = Scale<f32, LayoutPixel, DevicePixel>;
/// Scaling ratio from picture pixels to raster pixels (e.g. if scaling a picture surface up/down). pubtype RasterPixelScale = Scale<f32, PicturePixel, RasterPixel>;
/// Stores two coordinates in texel space. The coordinates /// are stored in texel coordinates because the texture atlas /// may grow. Storing them as texel coords and normalizing /// the UVs in the vertex shader means nothing needs to be /// updated on the CPU when the texture size changes. #[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] #[repr(C)] pubstruct TexelRect { pub uv0: DevicePoint, pub uv1: DevicePoint,
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.