2020-02-28 14:38:42 +01:00
|
|
|
use crate::image::atlas::Allocator;
|
2020-02-26 12:34:34 +01:00
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
|
pub enum Layer {
|
|
|
|
|
Empty,
|
|
|
|
|
Busy(Allocator),
|
|
|
|
|
Full,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Layer {
|
|
|
|
|
pub fn is_empty(&self) -> bool {
|
2022-07-04 01:17:29 +02:00
|
|
|
matches!(self, Layer::Empty)
|
2020-02-26 12:34:34 +01:00
|
|
|
}
|
2024-04-24 21:29:30 +02:00
|
|
|
|
|
|
|
|
pub fn allocations(&self) -> usize {
|
|
|
|
|
match self {
|
|
|
|
|
Layer::Empty => 0,
|
|
|
|
|
Layer::Busy(allocator) => allocator.allocations(),
|
|
|
|
|
Layer::Full => 1,
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-02-26 12:34:34 +01:00
|
|
|
}
|