Skip to main content

DirtyRectSet

Struct DirtyRectSet 

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

Bounded zero-allocation multi-rect dirty set tracking up to 16 disjoint physical damage rectangles.

Implementations§

Source§

impl DirtyRectSet

Surgical multi-rect dirty tracking, union-waste strategy selection, and DamageRegion interop for DirtyRectSet.

Source

pub const fn new() -> Self

Creates an empty DirtyRectSet.

§Returns
  • Self - Empty dirty rect set.
Source

pub const fn full() -> Self

Creates a DirtyRectSet representing full-viewport damage.

§Returns
  • Self - Full-frame dirty rect set.
Source

pub fn is_empty(&self) -> bool

Returns true when neither full-frame damage nor any active dirty rectangle is present.

§Arguments
  • &Self - Dirty rect set reference.
§Returns
  • bool - true when clean.
Source

pub fn rects(&self) -> &[Rect]

Returns the active slice of disjoint physical damage rectangles.

§Arguments
  • &Self - Dirty rect set reference.
§Returns
  • &[Rect] - Active dirty rectangle slice.
Source

pub fn clear(&mut self)

Clears all rectangles and resets full-frame and overflow flags.

§Arguments
  • &Self - Mutable dirty rect set.
Source

pub fn from_damage_region(damage: DamageRegion, width: u32, height: u32) -> Self

Builds a DirtyRectSet from an existing DamageRegion clipped to (width, height).

§Arguments
  • DamageRegion - Source damage region.
  • u32 - Physical viewport width in pixels.
  • u32 - Physical viewport height in pixels.
§Returns
  • Self - Equivalent bounded multi-rect dirty set.
Source

pub fn add_rect_clamped(&mut self, rect: Rect, width: u32, height: u32)

Adds a physical damage rectangle clipped to (width, height), merging only overlapping or touching rectangles so distant rects remain disjoint.

§Arguments
  • &Self - Mutable dirty rect set.
  • Rect - Incoming damage rectangle in physical pixels.
  • u32 - Physical viewport width in pixels.
  • u32 - Physical viewport height in pixels.
Source

pub fn add_rect(&mut self, rect: Rect)

Adds a physical damage rectangle, coalescing only overlapping or touching rectangles and keeping distant rectangles separate up to DIRTY_RECT_SET_CAPACITY.

§Arguments
  • &Self - Mutable dirty rect set.
  • Rect - Incoming non-empty damage rectangle.
Source

pub fn merged_bbox(&self) -> Option<Rect>

Computes the union bounding box spanning all active dirty rectangles.

§Arguments
  • &Self - Dirty rect set reference.
§Returns
  • Option<Rect> - Tight union bounding box, or None if empty.
Source

pub fn total_dirty_area(&self) -> f32

Computes the sum of areas of all active disjoint dirty rectangles.

§Arguments
  • &Self - Dirty rect set reference.
§Returns
  • f32 - Aggregate dirty pixel area.
Source

pub fn union_waste_ratio(&self) -> f32

Computes the bounding-box merge waste ratio (bbox_area - sum_area) / sum_area.

§Arguments
  • &Self - Dirty rect set reference.
§Returns
  • f32 - Non-negative waste ratio (0.0 when <= 1 rect or clean).
Source

pub fn select_strategy( &self, viewport_w: u32, viewport_h: u32, full_ratio_threshold: f32, merge_waste_ratio: f32, ) -> DirtyRectStrategy

Selects the optimal submission strategy (Empty, MultiRect, MergedBbox, or FullFrame) using viewport coverage and union-area waste ratio.

§Arguments
  • &Self - Dirty rect set reference.
  • u32 - Physical viewport width in pixels.
  • u32 - Physical viewport height in pixels.
  • f32 - Area coverage threshold in (0.1..=1.0] promoting to FullFrame.
  • f32 - Union-area waste ratio threshold above which disjoint rects stay MultiRect.
§Returns
  • DirtyRectStrategy - Selected dirty-region execution strategy.
Source

pub fn select_default_strategy( &self, viewport_w: u32, viewport_h: u32, ) -> DirtyRectStrategy

Selects the optimal submission strategy using default thresholds (0.70 full-frame coverage, 0.35 merge waste ratio).

§Arguments
  • &Self - Dirty rect set reference.
  • u32 - Physical viewport width in pixels.
  • u32 - Physical viewport height in pixels.
§Returns
  • DirtyRectStrategy - Selected dirty-region execution strategy.
Source

pub fn intersects_rect(&self, region: Rect) -> bool

Returns true when any active dirty rectangle intersects region (or when full_frame is set).

§Arguments
  • &Self - Dirty rect set reference.
  • Rect - Physical query rectangle.
§Returns
  • bool - true if region overlaps any damaged area.
Source

pub fn to_damage_region( &self, viewport_w: u32, viewport_h: u32, strategy: DirtyRectStrategy, ) -> DamageRegion

Converts this DirtyRectSet into a DamageRegion honoring strategy without collapsing disjoint MultiRect regions into a single giant bbox.

§Arguments
  • &Self - Dirty rect set reference.
  • u32 - Physical viewport width in pixels.
  • u32 - Physical viewport height in pixels.
  • DirtyRectStrategy - Chosen dirty-region submission strategy.
§Returns
  • DamageRegion - Resulting renderer/platform damage region.
Source

pub fn apply_effect_dependency_damage( &mut self, regions: &[PortalBackdropRegion], viewport_w: u32, viewport_h: u32, scale: f32, full_ratio_threshold: f32, ) -> EffectDamageReport

Evaluates surgical effect-dependency damage across visible portals and backdrop-blur regions, expanding ONLY intersecting or dirty regions by ceil(2.0 * blur_radius).

§Arguments
  • &Self - Mutable dirty rect set in physical pixels.
  • &[PortalBackdropRegion] - Visible portal and backdrop-blur descriptors in logical coordinates.
  • u32 - Physical viewport width in pixels.
  • u32 - Physical viewport height in pixels.
  • f32 - Active display scale factor.
  • f32 - Area coverage threshold in (0.1..=1.0] promoting to FullFrame.
§Returns
  • EffectDamageReport - Counts of expanded/skipped regions and whether full-frame escalation occurred.
Source

pub fn upload_strategy( &self, viewport_w: u32, viewport_h: u32, ) -> UploadStrategy

Bridges this dirty-rect set’s selected DirtyRectStrategy directly into the unified UploadStrategy.

§Arguments
  • &Self - Dirty rect set reference.
  • u32 - Physical viewport width in pixels.
  • u32 - Physical viewport height in pixels.
§Returns
  • UploadStrategy - Unified upload strategy (None, MultiRect, MergedBbox, or FullFrame).
Source

pub fn mobile_upload_strategy( &self, viewport_w: u32, viewport_h: u32, ) -> MobileUploadStrategy

Bridges this dirty-rect set’s selected DirtyRectStrategy directly into MobileUploadStrategy.

§Arguments
  • &Self - Dirty rect set reference.
  • u32 - Physical viewport width in pixels.
  • u32 - Physical viewport height in pixels.
§Returns
  • MobileUploadStrategy - Mobile upload strategy (None, MultiRect, MergedBbox, or FullFrame).
Source§

impl DirtyRectSet

Source

pub fn get_len(&self) -> usize

Source

pub fn get_full_frame(&self) -> bool

Source

pub fn get_mut_full_frame(&mut self) -> &mut bool

Source

pub fn set_full_frame(&mut self, val: bool) -> &mut Self

Source

pub fn get_overflowed(&self) -> bool

Source

pub fn get_mut_overflowed(&mut self) -> &mut bool

Source

pub fn set_overflowed(&mut self, val: bool) -> &mut Self

Trait Implementations§

Source§

impl Clone for DirtyRectSet

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for DirtyRectSet

Source§

impl Debug for DirtyRectSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DirtyRectSet

Default empty DirtyRectSet.

Source§

fn default() -> Self

Creates an empty DirtyRectSet with zero active rectangles.

§Returns
  • Self - Clean multi-rect dirty set.
Source§

impl PartialEq for DirtyRectSet

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DirtyRectSet

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.