Skip to main content

SceneStore

Struct SceneStore 

Source
pub struct SceneStore { /* private fields */ }
Expand description

The scene a renderer draws and the hit targets come from.

Implementations§

Source§

impl SceneStore

Source

pub fn write_leaf(&mut self, id: RecordId, leaf: Leaf, items: &[Item])

Writes id as leaf: a leaf of leaf.node without properties, placed by a translation alone, whose draws changed in the update in progress, to items. The draws and children id held before stay in the store: the caller removes them.

Source

pub fn place_leaf( &mut self, id: RecordId, origin_in_parent: Point, flags: RecordFlags, )

Places id, a leaf, at origin_in_parent by a translation alone, with flags.

Source

pub fn move_leaf(&mut self, id: RecordId, origin_in_parent: Point)

Moves id, a leaf, to origin_in_parent by a translation alone, among the items of a parent whose content the update in progress changes: the caller notes that change with Self::note_content_change of the parent.

Source§

impl SceneStore

Source

pub fn describe_overlay<'a>( &mut self, window: Size, layers: impl IntoIterator<Item = &'a OverlayLayer>, )

Writes a root layer of window size that holds layers in order, in place of what the store held, in a new update. Records at the same place stay, so the update changes only what differs.

Source§

impl SceneStore

Source

pub fn content_offset(&self, id: RecordId) -> Point

The offset of the content box of id from its origin.

Source

pub fn set_content_offset(&mut self, id: RecordId, offset: Point) -> bool

Sets the offset of the content box of id, and returns whether it changed.

Source

pub fn origin_in_parent(&self, id: RecordId) -> Point

Where layout placed id in its parent’s content, before the parent’s content offset.

Source

pub fn origin(&self, id: RecordId) -> Point

The top left of id in its parent’s layer: its placement and the parent’s content offset.

Source

pub fn transform_to_parent(&self, id: RecordId) -> ProjectiveTransform

The transform from id to its parent’s content.

Source

pub fn placement(&self, id: RecordId) -> Placement

Where id sits in its parent’s layer.

Source

pub fn set_placement( &mut self, id: RecordId, origin_in_parent: Point, transform: Option<ProjectiveTransform>, ) -> bool

Places id at origin_in_parent in its parent’s content by transform, or by a translation there alone, past the parent’s content offset, for None. A transform that only moves the record there takes no entry of its own. The parent’s content offset is set before. Returns whether the placement changed.

Source§

impl SceneStore

Source

pub fn props(&self, id: RecordId) -> Option<&LayerProps>

The properties of id, when it has any.

Source

pub fn graphics_layer(&self, id: RecordId) -> Option<&GraphicsLayer>

The graphics layer set on id, None when it reads as the default.

Source

pub fn set_graphics_layer( &mut self, id: RecordId, layer: Option<&GraphicsLayer>, )

Sets the graphics layer of id; None reads as the default. A record that keeps one keeps its slot. A changed layer notes a property change.

Source

pub fn set_hit_test(&mut self, id: RecordId, hit_test: Option<HitTestNode>)

Sets the pointer handling of id: None when it has none. What the record draws stays.

Source§

impl SceneStore

Source

pub fn add_shapes( &mut self, print: u64, record: impl FnOnce(&mut ShapeRecorder), ) -> Item

Adds an item of the shapes record records into a chunk the store shares among its shape items. print is a hash of what they draw, the same for the same shapes.

Source

pub fn shapes(&self, item: Item) -> ShapeRef<'_>

The shapes of a shape item.

Source§

impl SceneStore

Source

pub fn new() -> Self

An empty store.

Source

pub fn id(&self) -> StoreId

The store’s identity among the renderers’ stores.

Source

pub fn version(&self) -> SceneVersion

The store’s identity and latest update.

Source

pub fn root(&self) -> Option<RecordId>

The root record, None before the first build.

Source

pub fn update(&self) -> SceneUpdate

The latest scene update.

Source

pub fn begin_update(&mut self) -> SceneUpdate

Starts a scene update and returns its number.

Source

pub fn changed_within(&self, id: RecordId, updates: u32) -> bool

Whether id changed itself or moved in the latest updates updates.

Source

pub fn follow(&mut self, events: RecordEvents)

Keeps the changes of the kinds in events for the store’s readers from the next update on, in place of those it kept.

Source

pub fn changes_since(&self, read: Option<SceneVersion>) -> JournalRead<'_>

The changes of the store’s records in the updates after read, the version of the store a reader read last. Lost for no version, a version of another store or one older than the store keeps.

Source

pub fn stamps_since(&self, read: Option<SceneVersion>) -> Option<&[RecordRef]>

The records the updates after read made, changed or moved, while the store follows RecordEvents::STAMPS; a record may come more than once. None for no version, a version of another store or one older than the store keeps, or when an update stamped more records than the store keeps.

Source

pub fn changed_since(&self, read: Option<SceneVersion>) -> bool

Whether an update after read, the version of the store a reader read last, changed a record. True for no version, a version of another store or one the store was cleared after.

Source

pub fn finish_update(&mut self)

Ends the update in progress: logs the records whose children it put in another order and the own draws it redrew. Readers read the store after it.

Source

pub fn trim(&mut self) -> bool

Gives back the room the store’s arrays hold past their records and draws: the room a burst took, such as a first build’s or a long list’s. The store’s owner calls it at rest, when no frame waits, as a frame would take the room again. Returns whether most rows stay free past records made after them, room that only a store cleared and built anew gives back.

Source

pub fn refresh_reach(&mut self)

Works out the reach of every record whose reach a change beneath it left to be worked out again, as LayerRef::reach reads it.

Source

pub fn layer(&self, id: RecordId) -> LayerRef<'_>

The record id as its readers see it.

Source

pub fn root_layer(&self) -> Option<LayerRef<'_>>

The root record as its readers see it.

Source

pub fn heap_bytes(&self) -> usize

Estimated heap memory the store holds, in bytes, for memory reports.

Source

pub fn node_count(&self) -> usize

How many records and draws the store holds: each record counts once, each primitive of a draw run on its own.

Source

pub fn record_count(&self) -> usize

How many records the store holds.

Source

pub fn clear(&mut self)

Removes every record.

Source

pub fn insert(&mut self, seed: RecordSeed) -> RecordId

Makes a record from seed, changed in the update in progress, with no items, at the origin of its parent and of zero size. Its ancestors take the update as their subtree’s; the caller adds it to its parent’s items.

Source

pub fn remove_subtree(&mut self, id: RecordId)

Removes id, its draws, its properties and every record beneath it.

Source

pub fn remove_item(&mut self, item: Item)

Removes what item holds: a child record’s subtree or a draw.

Source

pub fn record_ref(&self, id: RecordId) -> RecordRef

A handle to id that tells a later holder whether the row went to another record since.

Source

pub fn resolve(&self, held: RecordRef) -> Option<RecordId>

The record held names, while its row still holds that record.

Source

pub fn items(&self, id: RecordId) -> &[Item]

The items of id in draw order.

Source

pub fn add_draw(&mut self, draw: DrawPrimitiveNode) -> Item

Adds a draw primitive for an item.

Source

pub fn add_text(&mut self, text: TextPrimitiveNode) -> Item

Adds a text for an item.

Source

pub fn add_run(&mut self, run: DrawRunNode) -> Item

Adds a draw run for an item.

Source

pub fn draw(&self, item: Item) -> &DrawPrimitiveNode

The draw primitive of a draw item.

Source

pub fn text(&self, item: Item) -> &TextPrimitiveNode

The text of a text item.

Source

pub fn run(&self, item: Item) -> &DrawRunNode

The draw run of a run item.

Source

pub fn kind(&self, id: RecordId) -> RecordKind

What id draws for.

Source

pub fn node(&self, id: RecordId) -> Option<NodeId>

The layout node id draws for.

Source

pub fn parent(&self, id: RecordId) -> Option<RecordId>

The record that holds id.

Source

pub fn flags(&self, id: RecordId) -> RecordFlags

The flags of id.

Source

pub fn node_rect(&self, id: RecordId) -> Rect

The size of the node rect of id.

Source

pub fn set_kind( &mut self, id: RecordId, kind: RecordKind, node: Option<NodeId>, ) -> bool

Sets what id draws for and the layout node it draws for, and returns whether either changed. A RecordKind::Leaf holds no layer properties and no child layers.

Source

pub fn note_content_change(&mut self, id: RecordId)

Notes that the update in progress changed what id draws: its own draws, properties or children. Its ancestors take the update as their subtree’s.

Source

pub fn note_property_change(&mut self, id: RecordId)

Notes that the update in progress changed the properties of id without changing what it draws: its hashes go, while a raster cache keyed on its content does not count the update as a content change.

Source

pub fn content_rev(&self, id: RecordId) -> SceneUpdate

The update that last changed what id itself draws.

Trait Implementations§

Source§

impl Default for SceneStore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> ErasedDestructor for T
where T: 'static,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.