Struct webrender::picture::SurfaceInfo

source ·
pub struct SurfaceInfo {
    pub unclipped_local_rect: PictureRect,
    pub clipped_local_rect: PictureRect,
    pub is_opaque: bool,
    pub clipping_rect: PictureRect,
    pub map_local_to_picture: SpaceMapper<LayoutPixel, PicturePixel>,
    pub surface_spatial_node_index: SpatialNodeIndex,
    pub raster_spatial_node_index: SpatialNodeIndex,
    pub device_pixel_scale: DevicePixelScale,
    pub world_scale_factors: (f32, f32),
    pub local_scale: (f32, f32),
    pub allow_snapping: bool,
    pub force_scissor_rect: bool,
}
Expand description

Information about an offscreen surface. For now, it contains information about the size and coordinate system of the surface. In the future, it will contain information about the contents of the surface, which will allow surfaces to be cached / retained between frames and display lists.

Fields§

§unclipped_local_rect: PictureRect

A local rect defining the size of this surface, in the coordinate system of the parent surface. This contains the unclipped bounding rect of child primitives.

§clipped_local_rect: PictureRect

The local space coverage of child primitives after they are are clipped to their owning clip-chain.

§is_opaque: bool

If true, we know this surface is completely opaque

§clipping_rect: PictureRect

The (conservative) valid part of this surface rect. Used to reduce the size of render target allocation.

§map_local_to_picture: SpaceMapper<LayoutPixel, PicturePixel>

Helper structs for mapping local rects in different coordinate systems into the picture coordinates.

§surface_spatial_node_index: SpatialNodeIndex

The positioning node for the surface itself,

§raster_spatial_node_index: SpatialNodeIndex

The rasterization root for this surface.

§device_pixel_scale: DevicePixelScale

The device pixel ratio specific to this surface.

§world_scale_factors: (f32, f32)

The scale factors of the surface to world transform.

§local_scale: (f32, f32)

Local scale factors surface to raster transform

§allow_snapping: bool

If true, allow snapping on this and child surfaces

§force_scissor_rect: bool

If true, the scissor rect must be set when drawing this surface

Implementations§

source§

impl SurfaceInfo

source

pub fn new( surface_spatial_node_index: SpatialNodeIndex, raster_spatial_node_index: SpatialNodeIndex, world_rect: WorldRect, spatial_tree: &SpatialTree, device_pixel_scale: DevicePixelScale, world_scale_factors: (f32, f32), local_scale: (f32, f32), allow_snapping: bool, force_scissor_rect: bool, ) -> Self

source

pub fn clamp_blur_radius( &self, x_blur_radius: f32, y_blur_radius: f32, ) -> (f32, f32)

Clamps the blur radius depending on scale factors.

source

pub fn map_to_device_rect( &self, picture_rect: &PictureRect, spatial_tree: &SpatialTree, ) -> DeviceRect

source

pub fn get_surface_rect( &self, local_rect: &PictureRect, spatial_tree: &SpatialTree, ) -> Option<DeviceIntRect>

Clip and transform a local rect to a device rect suitable for allocating a child off-screen surface of this surface (e.g. for clip-masks)

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.