pub(crate) struct PaintedRegion {
rects: Vec<Box2D<f32, LayoutPixel>>,
}Expand description
A set of disjoint, axis-aligned rectangles that tracks exactly which area has
already been painted for a Container Timing container, so that overlapping
fragments (e.g. two overlapping <img>s) aren’t double-counted.
Mirrors the approach Chromium’s Container Timing implementation takes with
cc::Region
Fields§
§rects: Vec<Box2D<f32, LayoutPixel>>No two rects in this list overlap.
Implementations§
Source§impl PaintedRegion
impl PaintedRegion
Sourcepub(crate) fn area(&self) -> f32
pub(crate) fn area(&self) -> f32
The total painted area, i.e. the sum of the (disjoint) rects’ areas.
Sourcepub(crate) fn bounds(&self) -> Box2D<f32, LayoutPixel>
pub(crate) fn bounds(&self) -> Box2D<f32, LayoutPixel>
The smallest box containing every rect in this region.
Sourcepub(crate) fn contains(&self, rect: Box2D<f32, LayoutPixel>) -> bool
pub(crate) fn contains(&self, rect: Box2D<f32, LayoutPixel>) -> bool
Returns true if rect is already entirely covered by this region, i.e.
merging it in would add no new area.
Sourcepub(crate) fn union(&mut self, rect: Box2D<f32, LayoutPixel>)
pub(crate) fn union(&mut self, rect: Box2D<f32, LayoutPixel>)
Merges rect into the region, splitting it against existing rects so the
region remains disjoint. (matches Chromium’s use of
gfx::ToEnclosingRect before touching cc::Region).
pub(crate) fn merge(&mut self, other: &PaintedRegion)
Trait Implementations§
Source§impl Clone for PaintedRegion
impl Clone for PaintedRegion
Source§fn clone(&self) -> PaintedRegion
fn clone(&self) -> PaintedRegion
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PaintedRegion
impl Debug for PaintedRegion
Source§impl Default for PaintedRegion
impl Default for PaintedRegion
Source§fn default() -> PaintedRegion
fn default() -> PaintedRegion
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PaintedRegion
impl RefUnwindSafe for PaintedRegion
impl Send for PaintedRegion
impl Sync for PaintedRegion
impl Unpin for PaintedRegion
impl UnsafeUnpin for PaintedRegion
impl UnwindSafe for PaintedRegion
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
Converts
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> ⓘ
Converts
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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert