Trait webrender::texture_pack::AtlasAllocatorList

source ·
pub trait AtlasAllocatorList<TextureParameters> {
    // Required methods
    fn allocate(
        &mut self,
        size: DeviceIntSize,
        texture_alloc_cb: &mut dyn FnMut(DeviceIntSize, &TextureParameters) -> CacheTextureId,
    ) -> (CacheTextureId, AllocId, DeviceIntRect);
    fn set_handle(
        &mut self,
        texture_id: CacheTextureId,
        alloc_id: AllocId,
        handle: &TextureCacheHandle,
    );
    fn deallocate(&mut self, texture_id: CacheTextureId, alloc_id: AllocId);
    fn texture_parameters(&self) -> &TextureParameters;
}

Required Methods§

source

fn allocate( &mut self, size: DeviceIntSize, texture_alloc_cb: &mut dyn FnMut(DeviceIntSize, &TextureParameters) -> CacheTextureId, ) -> (CacheTextureId, AllocId, DeviceIntRect)

Allocate a rectangle.

If allocation fails, call the provided callback, add a new allocator to the list and try again.

source

fn set_handle( &mut self, texture_id: CacheTextureId, alloc_id: AllocId, handle: &TextureCacheHandle, )

source

fn deallocate(&mut self, texture_id: CacheTextureId, alloc_id: AllocId)

Deallocate a rectangle and return its size.

source

fn texture_parameters(&self) -> &TextureParameters

Implementors§

source§

impl<Allocator: AtlasAllocator, TextureParameters> AtlasAllocatorList<TextureParameters> for AllocatorList<Allocator, TextureParameters>