pub struct GpuStateManager {
pub caches: BTreeMap<DomId, GpuValueCache>,
pub fade_delay: Duration,
pub fade_duration: Duration,
}Expand description
Manages GPU-accelerated properties across all DOMs.
The GpuStateManager maintains caches for transform and opacity keys
that are used by the GPU renderer. It handles:
- Scrollbar thumb position transforms (updated on scroll)
- Opacity fading for scrollbars (fade in on activity, fade out after delay)
- Per-DOM GPU value caches for efficient rendering
Fields§
§caches: BTreeMap<DomId, GpuValueCache>GPU value caches indexed by DOM ID
fade_delay: DurationDelay before scrollbars start fading out after last activity
fade_duration: DurationDuration of the fade-out animation
Implementations§
Source§impl GpuStateManager
impl GpuStateManager
Sourcepub fn new(fade_delay: Duration, fade_duration: Duration) -> Self
pub fn new(fade_delay: Duration, fade_duration: Duration) -> Self
Creates a new GPU state manager with specified fade timing.
Sourcepub fn tick(&mut self, now: Instant) -> GpuTickResult
pub fn tick(&mut self, now: Instant) -> GpuTickResult
Advances GPU state by one tick, interpolating animated values.
This should be called each frame to update opacity transitions for smooth scrollbar fading.
Sourcepub fn get_or_create_cache(&mut self, dom_id: DomId) -> &mut GpuValueCache
pub fn get_or_create_cache(&mut self, dom_id: DomId) -> &mut GpuValueCache
Gets or creates the GPU cache for a specific DOM.
Sourcepub fn update_scrollbar_transforms(
&mut self,
dom_id: DomId,
scroll_manager: &ScrollManager,
layout_tree: &LayoutTree,
) -> GpuEventChanges
pub fn update_scrollbar_transforms( &mut self, dom_id: DomId, scroll_manager: &ScrollManager, layout_tree: &LayoutTree, ) -> GpuEventChanges
Updates scrollbar thumb transforms based on current scroll positions.
Calculates the transform needed to position scrollbar thumbs correctly based on the scroll offset and content/container sizes. Returns the GPU event changes that need to be applied by the renderer.
Sourcepub fn get_gpu_value_cache(&self) -> BTreeMap<DomId, GpuValueCache>
pub fn get_gpu_value_cache(&self) -> BTreeMap<DomId, GpuValueCache>
Returns a clone of all GPU value caches.
Trait Implementations§
Source§impl Clone for GpuStateManager
impl Clone for GpuStateManager
Source§fn clone(&self) -> GpuStateManager
fn clone(&self) -> GpuStateManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GpuStateManager
impl Debug for GpuStateManager
Auto Trait Implementations§
impl Freeze for GpuStateManager
impl RefUnwindSafe for GpuStateManager
impl Send for GpuStateManager
impl Sync for GpuStateManager
impl Unpin for GpuStateManager
impl UnwindSafe for GpuStateManager
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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