pub struct FrameUpdate { /* private fields */ }Expand description
A frame quick update.
A frame update causes a frame render without needing to fully rebuild the display list. It is a more performant but also more limited way of generating a frame.
Any FrameValueKey used in the creation of the frame can be used for updating the frame.
Implementations§
Source§impl FrameUpdate
impl FrameUpdate
Sourcepub fn new(
render_update_widgets: Arc<RenderUpdates>,
frame_id: FrameId,
root_id: WidgetId,
root_bounds: WidgetBoundsInfo,
clear_color: Rgba,
) -> Self
pub fn new( render_update_widgets: Arc<RenderUpdates>, frame_id: FrameId, root_id: WidgetId, root_bounds: WidgetBoundsInfo, clear_color: Rgba, ) -> Self
New frame update builder.
render_update_widgets- External update requests.frame_id- Id of the new frame.root_id- Id of the window root widget.root_bounds- Bounds info of the window root widget.clear_color- The current clear color.
Sourcepub fn is_outer(&self) -> bool
pub fn is_outer(&self) -> bool
Returns true if the widget inner transform update is still being build.
This is true when inside an update_widget call but false when inside an update_inner call.
Sourcepub fn transform(&self) -> &PxTransform
pub fn transform(&self) -> &PxTransform
Current transform.
Sourcepub fn set_clear_color(&mut self, color: Rgba)
pub fn set_clear_color(&mut self, color: Rgba)
Change the color used to clear the pixel buffer when redrawing the frame.
Sourcepub fn auto_hit_test(&self) -> bool
pub fn auto_hit_test(&self) -> bool
Returns true if all transform updates are also applied to hit-test transforms.
Sourcepub fn with_auto_hit_test(
&mut self,
auto_hit_test: bool,
render_update: impl FnOnce(&mut Self),
)
pub fn with_auto_hit_test( &mut self, auto_hit_test: bool, render_update: impl FnOnce(&mut Self), )
Runs render_update with auto_hit_test set to a value for the duration of the render call.
Sourcepub fn is_visible(&self) -> bool
pub fn is_visible(&self) -> bool
Returns true if view updates are actually collected, if false only transforms and hit-test are updated.
Calls update with is_visible set to false.
Nodes that set the visibility to Hidden must render using the FrameBuilder::hide method and update using this method.
Sourcepub fn update_transform(
&mut self,
new_value: FrameValueUpdate<PxTransform>,
hit_test: bool,
)
pub fn update_transform( &mut self, new_value: FrameValueUpdate<PxTransform>, hit_test: bool, )
Update a transform value that does not potentially affect widget bounds.
Use with_transform to update transforms that affect widget bounds.
If hit_test is true the hit-test transform is also updated.
Sourcepub fn update_transform_opt(
&mut self,
new_value: Option<FrameValueUpdate<PxTransform>>,
hit_test: bool,
)
pub fn update_transform_opt( &mut self, new_value: Option<FrameValueUpdate<PxTransform>>, hit_test: bool, )
Update a transform value, if there is one.
Sourcepub fn with_transform(
&mut self,
new_value: FrameValueUpdate<PxTransform>,
hit_test: bool,
render_update: impl FnOnce(&mut Self),
)
pub fn with_transform( &mut self, new_value: FrameValueUpdate<PxTransform>, hit_test: bool, render_update: impl FnOnce(&mut Self), )
Update a transform that potentially affects widget bounds.
The transform is updated to include this space for the call to the render_update closure. The closure
must call render update on child nodes.
If hit_test is true the hit-test transform is also updated.
Sourcepub fn with_transform_opt(
&mut self,
new_value: Option<FrameValueUpdate<PxTransform>>,
hit_test: bool,
render_update: impl FnOnce(&mut Self),
)
pub fn with_transform_opt( &mut self, new_value: Option<FrameValueUpdate<PxTransform>>, hit_test: bool, render_update: impl FnOnce(&mut Self), )
Update a transform that potentially affects widget bounds, if there is one.
The render_update is always called.
Sourcepub fn with_child(
&mut self,
offset: PxVector,
render_update: impl FnOnce(&mut Self),
)
pub fn with_child( &mut self, offset: PxVector, render_update: impl FnOnce(&mut Self), )
Calls render_update with an offset that affects the first inner child inner bounds.
Nodes that used FrameBuilder::push_child during render must use this method to update the value.
Sourcepub fn with_transform_value(
&mut self,
value: &PxTransform,
render_update: impl FnOnce(&mut Self),
)
pub fn with_transform_value( &mut self, value: &PxTransform, render_update: impl FnOnce(&mut Self), )
Calls render_update while the transform is updated to include the value space.
This is useful for cases where the inner transforms are affected by a value that is only rendered, never updated.
Sourcepub fn with_inner_transform(
&mut self,
transform: &PxTransform,
render_update: impl FnOnce(&mut Self),
)
pub fn with_inner_transform( &mut self, transform: &PxTransform, render_update: impl FnOnce(&mut Self), )
Update the transform applied after the inner bounds translate.
This is only valid if is_outer.
Sourcepub fn can_reuse_widget(&self) -> bool
pub fn can_reuse_widget(&self) -> bool
If widget update can be skipped by setting reuse in update_widget.
Sourcepub fn with_no_reuse(&mut self, render_update: impl FnOnce(&mut Self))
pub fn with_no_reuse(&mut self, render_update: impl FnOnce(&mut Self))
Calls render_update with can_reuse_widget set to false.
Sourcepub fn update_widget(&mut self, render_update: impl FnOnce(&mut Self))
pub fn update_widget(&mut self, render_update: impl FnOnce(&mut Self))
Update the widget’s outer transform.
If render-update was not requested for the widget and can_reuse_widget only update outer/inner transforms of descendants.
If the widget is reused the render_update is not called.
Sourcepub fn reuse_widget(&mut self)
pub fn reuse_widget(&mut self)
Update the info transforms of the widget and descendants.
Widgets that did not request render-update can use this method to update only the outer and inner transforms of itself and descendants as those values are global and the parent widget may have changed.
Sourcepub fn update_inner(
&mut self,
layout_translation_key: FrameValueKey<PxTransform>,
layout_translation_animating: bool,
render_update: impl FnOnce(&mut Self),
)
pub fn update_inner( &mut self, layout_translation_key: FrameValueKey<PxTransform>, layout_translation_animating: bool, render_update: impl FnOnce(&mut Self), )
Update the widget’s inner transform.
The layout_translation_animating affects some webrender caches, see FrameBuilder::push_inner for details.
Sourcepub fn update_f32(&mut self, new_value: FrameValueUpdate<f32>)
pub fn update_f32(&mut self, new_value: FrameValueUpdate<f32>)
Update a float value.
Sourcepub fn update_f32_opt(&mut self, new_value: Option<FrameValueUpdate<f32>>)
pub fn update_f32_opt(&mut self, new_value: Option<FrameValueUpdate<f32>>)
Update a float value, if there is one.
Sourcepub fn update_color(&mut self, new_value: FrameValueUpdate<Rgba>)
pub fn update_color(&mut self, new_value: FrameValueUpdate<Rgba>)
Update a color value.
See FrameBuilder::push_color for details.
Sourcepub fn update_color_opt(&mut self, new_value: Option<FrameValueUpdate<Rgba>>)
pub fn update_color_opt(&mut self, new_value: Option<FrameValueUpdate<Rgba>>)
Update a color value, if there is one.
Sourcepub fn update_extension_raw(
&mut self,
extension_id: ApiExtensionId,
extension_payload: ApiExtensionPayload,
)
pub fn update_extension_raw( &mut self, extension_id: ApiExtensionId, extension_payload: ApiExtensionPayload, )
Update a custom extension value with custom encoding.
Sourcepub fn update_extension<T: Serialize>(
&mut self,
extension_id: ApiExtensionId,
payload: &T,
)
pub fn update_extension<T: Serialize>( &mut self, extension_id: ApiExtensionId, payload: &T, )
Update a custom extension value.
Sourcepub fn parallel_split(&self) -> ParallelBuilder<Self>
pub fn parallel_split(&self) -> ParallelBuilder<Self>
Create an update builder that can be send to a parallel task and must be folded back into this builder.
This should be called just before the call to update_widget, an error is traced if called inside a widget outer bounds.
Sourcepub fn parallel_fold(&mut self, split: ParallelBuilder<Self>)
pub fn parallel_fold(&mut self, split: ParallelBuilder<Self>)
Collect updates from split into self.
Sourcepub fn with_nested_window(
&mut self,
render_update_widgets: Arc<RenderUpdates>,
root_id: WidgetId,
root_bounds: WidgetBoundsInfo,
update: impl FnOnce(&mut Self),
)
pub fn with_nested_window( &mut self, render_update_widgets: Arc<RenderUpdates>, root_id: WidgetId, root_bounds: WidgetBoundsInfo, update: impl FnOnce(&mut Self), )
Calls update to render update a separate nested window on this frame.
Sourcepub fn render_update_widgets(&self) -> &Arc<RenderUpdates>
pub fn render_update_widgets(&self) -> &Arc<RenderUpdates>
External render update requests for this frame.
Sourcepub fn finalize(self, info_tree: &WidgetInfoTree) -> BuiltFrameUpdate
pub fn finalize(self, info_tree: &WidgetInfoTree) -> BuiltFrameUpdate
Finalize the update.
Returns the property updates and the new clear color if any was set.
Auto Trait Implementations§
impl Freeze for FrameUpdate
impl !RefUnwindSafe for FrameUpdate
impl Send for FrameUpdate
impl Sync for FrameUpdate
impl Unpin for FrameUpdate
impl !UnwindSafe for FrameUpdate
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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