summaryrefslogblamecommitdiffstats
path: root/wgpu/src/image/atlas/entry.rs
blob: 7e4c92a2c777d0b00b303906df0966ffb76dcc97 (plain) (tree)
1
2
3
4
5
6
7
8
                      
                        
 



                                  
                        



                                 


                                     











                                                               
use crate::core::Size;
use crate::image::atlas;

#[derive(Debug)]
pub enum Entry {
    Contiguous(atlas::Allocation),
    Fragmented {
        size: Size<u32>,
        fragments: Vec<Fragment>,
    },
}

impl Entry {
    #[cfg(feature = "image")]
    pub fn size(&self) -> Size<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,
}