summaryrefslogtreecommitdiffstats
path: root/wgpu/src/image/atlas/entry.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-02-28 14:38:42 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-02-28 14:38:42 +0100
commit4e7159c22c6be90f61aa715d5eb6811f805cb597 (patch)
tree77faf86bc65142d3c224b240a0c5922b7f4f9025 /wgpu/src/image/atlas/entry.rs
parentfc55e3a3df9e08d361985b01528d2a6095d98aba (diff)
downloadiced-4e7159c22c6be90f61aa715d5eb6811f805cb597.tar.gz
iced-4e7159c22c6be90f61aa715d5eb6811f805cb597.tar.bz2
iced-4e7159c22c6be90f61aa715d5eb6811f805cb597.zip
Stop creating image pipeline when unnecessary
Diffstat (limited to 'wgpu/src/image/atlas/entry.rs')
-rw-r--r--wgpu/src/image/atlas/entry.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/wgpu/src/image/atlas/entry.rs b/wgpu/src/image/atlas/entry.rs
new file mode 100644
index 00000000..0310fc54
--- /dev/null
+++ b/wgpu/src/image/atlas/entry.rs
@@ -0,0 +1,26 @@
+use crate::image::atlas;
+
+#[derive(Debug)]
+pub enum Entry {
+ Contiguous(atlas::Allocation),
+ Fragmented {
+ size: (u32, u32),
+ fragments: Vec<Fragment>,
+ },
+}
+
+impl Entry {
+ #[cfg(feature = "image")]
+ 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,
+}