use bytemuck::{Pod, Zeroable};
#[derive(Copy, Clone, Pod, Zeroable, Debug, Default)]
#[repr(C)]
pub struct ClipBic {
pub a: u32,
pub b: u32,
}
#[derive(Copy, Clone, Pod, Zeroable, Debug, Default)]
#[repr(C)]
#[expect(
clippy::partial_pub_fields,
reason = "Padding is meaningless to manipulate directly"
)]
pub struct ClipElement {
pub parent_ix: u32,
_padding: [u8; 12],
pub bbox: [f32; 4],
}
#[derive(Copy, Clone, Pod, Zeroable, Debug, Default)]
#[repr(C)]
pub struct Clip {
pub ix: u32,
pub path_ix: i32,
}
#[derive(Copy, Clone, Pod, Zeroable, Debug, Default)]
#[repr(C)]
pub struct ClipBbox {
pub bbox: [f32; 4],
}
impl ClipBic {
pub fn new(a: u32, b: u32) -> Self {
Self { a, b }
}
#[must_use]
pub fn combine(self, other: Self) -> Self {
let m = self.b.min(other.a);
Self::new(self.a + other.a - m, self.b + other.b - m)
}
}