Function lease_backdrop_slot

Source
pub fn lease_backdrop_slot(
    pool: &mut OffscreenSurfacePool,
    device: &Device,
    rect: Rect,
    format: TextureFormat,
) -> LeasedOffscreen
Expand description

Lease sized for a backdrop capture (no stencil).

Fractional width and height are ceiled and each axis is at least one physical pixel.

ยงExamples

use ailloli_ui_core::Rect;
use ailloli_ui_render_wgpu::{backdrop_capture::lease_backdrop_slot,
    offscreen_pool::OffscreenSurfacePool};
fn lease(pool: &mut OffscreenSurfacePool, device: &wgpu::Device) {
    let slot = lease_backdrop_slot(pool, device, Rect::new(0.0, 0.0, 10.2, 4.1),
        wgpu::TextureFormat::Rgba8Unorm);
    assert_eq!((slot.width, slot.height), (11, 5));
}