Skip to main content

AtlasSnapshot

Struct AtlasSnapshot 

Source
pub struct AtlasSnapshot<'a> {
    pub dirty: bool,
    pub width: u32,
    pub height: u32,
    pub pixels: &'a [u8],
    pub glyphs_evicted: bool,
}
Expand description

Outcome of a call to TextFontService::atlas_snapshot.

Bundles the four signals a framework adapter needs to upload (or skip uploading) the glyph atlas texture to the GPU:

  • whether the atlas has pending pixel changes since the last snapshot,
  • its current pixel dimensions,
  • a borrow of the raw RGBA pixel buffer, and
  • whether any cached glyphs were evicted during this snapshot — a signal that callers with paint caches holding old atlas UVs must treat as an invalidation even if the atlas itself reports clean afterwards (evicted slots may be reused by future allocations, so any cached UV pointing into them is stale).

Exposed as a struct rather than a tuple so every caller names fields explicitly and can’t swap positions silently.

Fields§

§dirty: bool

True if the atlas texture has pending pixel changes since it was last marked clean. The snapshot call clears this flag, so the caller must either upload pixels now or accept a one-frame delay.

§width: u32

Current atlas texture width in pixels.

§height: u32

Current atlas texture height in pixels.

§pixels: &'a [u8]

Raw RGBA8 pixel buffer backing the atlas texture.

§glyphs_evicted: bool

True if eviction freed at least one glyph slot during this snapshot. Callers that cache glyph positions (e.g. framework paint caches indexed by layout key) must invalidate when this is true — evicted slots may be reused by future allocations and old UVs would then point to the wrong glyph.

Trait Implementations§

Source§

impl<'a> Debug for AtlasSnapshot<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for AtlasSnapshot<'a>

§

impl<'a> RefUnwindSafe for AtlasSnapshot<'a>

§

impl<'a> Send for AtlasSnapshot<'a>

§

impl<'a> Sync for AtlasSnapshot<'a>

§

impl<'a> Unpin for AtlasSnapshot<'a>

§

impl<'a> UnsafeUnpin for AtlasSnapshot<'a>

§

impl<'a> UnwindSafe for AtlasSnapshot<'a>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.