Struct webrender::spatial_tree::SpatialTree

source ·
pub struct SpatialTree {
    spatial_nodes: Vec<SpatialNode>,
    coord_systems: Vec<CoordinateSystem>,
    root_reference_frame_index: SpatialNodeIndex,
    update_state_stack: Vec<TransformUpdateState>,
}
Expand description

Represents the spatial tree during frame building, which is mostly read-only, apart from the tree update at the start of the frame

Fields§

§spatial_nodes: Vec<SpatialNode>

Nodes which determine the positions (offsets and transforms) for primitives and clips.

§coord_systems: Vec<CoordinateSystem>

A list of transforms that establish new coordinate systems. Spatial nodes only establish a new coordinate system when they have a transform that is not a simple 2d translation.

§root_reference_frame_index: SpatialNodeIndex§update_state_stack: Vec<TransformUpdateState>

Stack of current state for each parent node while traversing and updating tree

Implementations§

source§

impl SpatialTree

source

pub fn new() -> Self

source

fn visit_node_impl_mut<F>(&mut self, index: SpatialNodeIndex, f: &mut F)

source

fn visit_node_impl<F>(&self, index: SpatialNodeIndex, f: &mut F)

source

pub fn visit_nodes<F>(&self, f: F)

Visit all nodes from the root of the tree, invoking a closure on each one

source

pub fn visit_nodes_mut<F>(&mut self, f: F)

Visit all nodes from the root of the tree, invoking a closure on each one

source

pub fn apply_updates(&mut self, updates: SpatialTreeUpdates)

Apply updates from a new scene to the frame spatial tree

source

pub fn get_last_sampled_scroll_offsets( &self, ) -> FastHashMap<ExternalScrollId, Vec<SampledScrollOffset>>

source

pub fn apply_last_sampled_scroll_offsets( &mut self, last_sampled_offsets: FastHashMap<ExternalScrollId, Vec<SampledScrollOffset>>, )

source

pub fn get_spatial_node(&self, index: SpatialNodeIndex) -> &SpatialNode

source

pub fn get_spatial_node_mut( &mut self, index: SpatialNodeIndex, ) -> &mut SpatialNode

source

pub fn spatial_node_count(&self) -> usize

Get total number of spatial nodes

source

pub fn find_spatial_node_by_anim_id( &self, id: PropertyBindingId, ) -> Option<SpatialNodeIndex>

source

pub fn get_relative_transform( &self, child_index: SpatialNodeIndex, parent_index: SpatialNodeIndex, ) -> CoordinateSpaceMapping<LayoutPixel, LayoutPixel>

Calculate the relative transform from child_index to parent_index. This method will panic if the nodes are not connected!

source

pub fn get_relative_transform_with_face( &self, child_index: SpatialNodeIndex, parent_index: SpatialNodeIndex, visible_face: Option<&mut VisibleFace>, ) -> CoordinateSpaceMapping<LayoutPixel, LayoutPixel>

Calculate the relative transform from child_index to parent_index. This method will panic if the nodes are not connected! Also, switch the visible face to Back if at any stage where the combined transform is flattened, we see the back face.

source

pub fn is_matching_coord_system( &self, index0: SpatialNodeIndex, index1: SpatialNodeIndex, ) -> bool

Returns true if both supplied spatial nodes are in the same coordinate system (implies the relative transform produce axis-aligned rects).

source

fn get_world_transform_impl( &self, index: SpatialNodeIndex, scroll: TransformScroll, ) -> CoordinateSpaceMapping<LayoutPixel, WorldPixel>

source

pub fn get_world_transform( &self, index: SpatialNodeIndex, ) -> CoordinateSpaceMapping<LayoutPixel, WorldPixel>

Calculate the relative transform from index to the root.

source

pub fn get_world_viewport_transform( &self, index: SpatialNodeIndex, ) -> CoordinateSpaceMapping<LayoutPixel, WorldPixel>

Calculate the relative transform from index to the root. Unlike get_world_transform, this variant doesn’t account for the local scroll offset.

source

pub fn root_reference_frame_index(&self) -> SpatialNodeIndex

The root reference frame, which is the true root of the SpatialTree.

source

pub fn set_scroll_offsets( &mut self, id: ExternalScrollId, offsets: Vec<SampledScrollOffset>, ) -> bool

source

pub fn update_tree(&mut self, scene_properties: &SceneProperties)

source

fn update_node( &mut self, node_index: SpatialNodeIndex, scene_properties: &SceneProperties, )

source

pub fn build_transform_palette(&self) -> TransformPalette

source

fn print_node<T: PrintTreePrinter>(&self, index: SpatialNodeIndex, pt: &mut T)

source

pub fn get_local_visible_face( &self, node_index: SpatialNodeIndex, ) -> VisibleFace

Get the visible face of the transfrom from the specified node to its parent.

source

pub fn print(&self)

Trait Implementations§

source§

impl PrintableTree for SpatialTree

source§

impl Serialize for SpatialTree

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl SpatialNodeContainer for SpatialTree

source§

fn get_node_info(&self, index: SpatialNodeIndex) -> SpatialNodeInfo<'_>

Get the common information for a given spatial node

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.