Struct PresenceLayer
pub struct PresenceLayer { /* private fields */ }Expand description
The presence a window paints over its widgets, kept from frame to frame so the next frame damages only what changed. Retains draw caches only.
Per frame: Self::widgets_need_full_repaint for the presence the
widgets were drawn from, then Self::record the layer, append
Self::scene over the widgets and add Self::damage; once the frame
is submitted, Self::presented.
Implementations§
§impl PresenceLayer
impl PresenceLayer
pub fn new() -> PresenceLayer
pub fn widgets_need_full_repaint(
&mut self,
presence: &PresenceCtx,
now: Instant,
) -> bool
pub fn widgets_need_full_repaint( &mut self, presence: &PresenceCtx, now: Instant, ) -> bool
Whether the widgets’ presence differs from the last submitted frame’s, or is animating. Widgets do not report damage for the carets, selections and marks they paint, so the window must repaint.
pub fn widgets_place_content_marks(&self) -> bool
pub fn widgets_place_content_marks(&self) -> bool
Whether this frame’s widgets paint marks placed from their content
(WidgetPresence::marks_follow_content). true until
Self::widgets_need_full_repaint has seen the frame.
pub fn record(&mut self, draw: impl FnOnce(&mut Scene))
pub fn record(&mut self, draw: impl FnOnce(&mut Scene))
Record this frame’s layer. draw paints into an empty scene and must
put every command in a scene_parts::part
with honest bounds, the same parts in the same order every frame.
pub fn paints(&self) -> bool
pub fn paints(&self) -> bool
Whether the layer on screen or this frame’s paints anything over the widgets.
pub fn damage(&self) -> Option<Vec<Rect>>
pub fn damage(&self) -> Option<Vec<Rect>>
Damage, in the layer’s scene coordinates, between the layer on
screen and this frame’s: the old and new bounds of every part that
changed. None when that cannot be proven (no frame shown yet, a
part left unbounded, commands outside every part), and the window
must repaint.
pub fn marks(&self, bounds: &mut DrawBounds) -> Option<LayerMarks>
pub fn marks(&self, bounds: &mut DrawBounds) -> Option<LayerMarks>
Where the layer on screen and this frame’s paint, in the layer’s
scene coordinates: what a scroll copy must not carry with the
content beneath (crate::scroll_copy::marks_over_copies). None
when either cannot be bounded (a part without bounds, commands
outside every part that bounds cannot bound), and the content
beneath must repaint instead of copying.
pub fn presented(&mut self)
pub fn presented(&mut self)
The frame recorded since the last call was submitted: it is what the next frame’s damage is measured against.
Trait Implementations§
§impl Default for PresenceLayer
impl Default for PresenceLayer
§fn default() -> PresenceLayer
fn default() -> PresenceLayer
Auto Trait Implementations§
impl Freeze for PresenceLayer
impl !RefUnwindSafe for PresenceLayer
impl Send for PresenceLayer
impl Sync for PresenceLayer
impl Unpin for PresenceLayer
impl UnsafeUnpin for PresenceLayer
impl !UnwindSafe for PresenceLayer
Blanket Implementations§
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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