pub struct Tile { /* private fields */ }Expand description
One tile the allocator handed out, and the only thing that names it.
A level and a node of that level, which is a pure description of a
rectangle — Tile::rect needs no allocator to answer and so cannot
disagree with one. What the allocator holds is whether the tile is still
out; giving it back is AtlasAllocator::release, which takes this by
value so a caller cannot go on holding the handle it just returned.
Implementations§
Source§impl Tile
impl Tile
Sourcepub const fn level(self) -> usize
pub const fn level(self) -> usize
Which of TILE_LEVELS sizes this tile is: 0 a whole root cell, each
one below a halving of it.
Read by Selection::lay_out to decide whether the
tile a slot already holds is the size that slot wants this frame — which
is the whole of the static-caching rung’s retention rule, and the reason
a level is readable off a handle at all.
Sourcepub fn rect(self) -> TileRect
pub fn rect(self) -> TileRect
Where this tile is in the atlas.
A function of the handle alone. The root cell is tile_origin’s — so
a level-0 tile is exactly the cell the fixed grid had — and the node’s
column and row inside it are the offset from there.