pub struct Atlas { /* private fields */ }Expand description
简单的行式(Row-based)glyph atlas
- 维护当前行 y 位置 + 行内 x 位置
- 放不下当前行就换行(y += row_height, x = 0, row_height = 0)
- 整个 atlas 满了就
panic(阶段 3 简化;后续 LRU/扩容) dirty标记:从上次clear_dirty起,是否有新像素写入
Implementations§
Source§impl Atlas
impl Atlas
pub fn new(width: u32, height: u32) -> Atlas
Sourcepub fn get_or_insert(
&mut self,
key: GlyphKey,
bitmap: &[u8],
w: u32,
h: u32,
) -> AtlasEntry
pub fn get_or_insert( &mut self, key: GlyphKey, bitmap: &[u8], w: u32, h: u32, ) -> AtlasEntry
查询或插入一个 glyph
bitmap 是 R8 灰度数据,长度 = w * h
Sourcepub fn glyph_count(&self) -> usize
pub fn glyph_count(&self) -> usize
已有 glyph 数量
Sourcepub fn clear_dirty(&mut self)
pub fn clear_dirty(&mut self)
清 dirty 标记(GPU 已上传后调用)
Auto Trait Implementations§
impl Forget for Atlas
impl Freeze for Atlaswhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<(GlyphKey, AtlasEntry)>: Freeze,
impl Move for Atlas
impl RefUnwindSafe for Atlas
impl Send for Atlas
impl Sync for Atlas
impl Unpin for Atlas
impl UnsafeUnpin for Atlaswhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<(GlyphKey, AtlasEntry)>: UnsafeUnpin,
impl UnwindSafe for Atlas
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