Trait webrender::texture_pack::AtlasAllocator

source ·
pub trait AtlasAllocator {
    type Parameters;

    // Required methods
    fn new(size: i32, parameters: &Self::Parameters) -> Self;
    fn allocate(
        &mut self,
        size: DeviceIntSize,
    ) -> Option<(AllocId, DeviceIntRect)>;
    fn deallocate(&mut self, id: AllocId);
    fn is_empty(&self) -> bool;
    fn allocated_space(&self) -> i32;
    fn dump_into_svg(
        &self,
        rect: &Box2D<f32>,
        output: &mut dyn Write,
    ) -> Result<()>;
}

Required Associated Types§

source

type Parameters

Specific parameters of the allocator.

Required Methods§

source

fn new(size: i32, parameters: &Self::Parameters) -> Self

Constructor

source

fn allocate(&mut self, size: DeviceIntSize) -> Option<(AllocId, DeviceIntRect)>

Allocate a rectangle.

source

fn deallocate(&mut self, id: AllocId)

Deallocate a rectangle and return its size.

source

fn is_empty(&self) -> bool

Return true if there is no live allocations.

source

fn allocated_space(&self) -> i32

Allocated area in pixels.

source

fn dump_into_svg(&self, rect: &Box2D<f32>, output: &mut dyn Write) -> Result<()>

Write a debug visualization of the atlas fitting in the provided rectangle.

This is inserted in a larger dump so it shouldn’t contain the xml start/end tags.

Object Safety§

This trait is not object safe.

Implementors§