2020-02-28 14:38:42 +01:00
|
|
|
use crate::image::atlas;
|
2022-10-31 13:37:56 -07:00
|
|
|
use iced_graphics::image::TextureStoreEntry;
|
2020-02-26 12:34:34 +01:00
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
|
pub enum Entry {
|
|
|
|
|
Contiguous(atlas::Allocation),
|
|
|
|
|
Fragmented {
|
|
|
|
|
size: (u32, u32),
|
|
|
|
|
fragments: Vec<Fragment>,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-31 13:37:56 -07:00
|
|
|
impl TextureStoreEntry for Entry {
|
|
|
|
|
fn size(&self) -> (u32, u32) {
|
2020-02-26 12:34:34 +01:00
|
|
|
match self {
|
|
|
|
|
Entry::Contiguous(allocation) => allocation.size(),
|
|
|
|
|
Entry::Fragmented { size, .. } => *size,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
|
pub struct Fragment {
|
|
|
|
|
pub position: (u32, u32),
|
|
|
|
|
pub allocation: atlas::Allocation,
|
|
|
|
|
}
|