pub fn scissor_to_local(
scissor: Option<Rect>,
origin: [f32; 2],
local_size: [u32; 2],
) -> Option<Rect>Expand description
Convert global physical scissor to local coordinates inside offscreen pass.
None remains None. Position is translated by origin and clamped to
zero; width and height are capped independently to local_size. Empty
results return None.
ยงExamples
use ailloli_ui_core::Rect;
use ailloli_ui_render_wgpu::cmd_bounds::scissor_to_local;
let local = scissor_to_local(Some(Rect::new(50.0, 50.0, 20.0, 10.0)),
[40.0, 45.0], [100, 100]);
assert_eq!(local, Some(Rect::new(10.0, 5.0, 20.0, 10.0)));