diff options
author | 2020-02-26 12:34:34 +0100 | |
---|---|---|
committer | 2020-02-26 12:34:34 +0100 | |
commit | 59d45a5440aaa46c7dc8f3dc70c8518167c10418 (patch) | |
tree | 2b5ad3d2c577e9ebb7fcac7452a74680174f8108 /wgpu/src/texture/atlas/entry.rs | |
parent | 82f0a49062d10f3cbf202a5379c061a2509ec97b (diff) | |
download | iced-59d45a5440aaa46c7dc8f3dc70c8518167c10418.tar.gz iced-59d45a5440aaa46c7dc8f3dc70c8518167c10418.tar.bz2 iced-59d45a5440aaa46c7dc8f3dc70c8518167c10418.zip |
Refactor texture atlas
- Split into multiple modules
- Rename some concepts
- Change API details
Diffstat (limited to 'wgpu/src/texture/atlas/entry.rs')
-rw-r--r-- | wgpu/src/texture/atlas/entry.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/wgpu/src/texture/atlas/entry.rs b/wgpu/src/texture/atlas/entry.rs new file mode 100644 index 00000000..2c064665 --- /dev/null +++ b/wgpu/src/texture/atlas/entry.rs @@ -0,0 +1,25 @@ +use crate::texture::atlas; + +#[derive(Debug)] +pub enum Entry { + Contiguous(atlas::Allocation), + Fragmented { + size: (u32, u32), + fragments: Vec<Fragment>, + }, +} + +impl Entry { + pub fn size(&self) -> (u32, u32) { + match self { + Entry::Contiguous(allocation) => allocation.size(), + Entry::Fragmented { size, .. } => *size, + } + } +} + +#[derive(Debug)] +pub struct Fragment { + pub position: (u32, u32), + pub allocation: atlas::Allocation, +} |