pub use drmkit_planes::{ColorEncoding, ColorRange, Rect};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
#[allow(
clippy::exhaustive_structs,
reason = "a value defined by its fields; there is nothing to add to it"
)]
pub struct FixedRect {
pub x: u32,
pub y: u32,
pub w: u32,
pub h: u32,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
#[allow(
clippy::exhaustive_structs,
reason = "built by callers with `..Default::default()`, which a new field does not break"
)]
pub struct DisplayParams {
pub src_rect: Rect,
pub src_rect_fixed: Option<FixedRect>,
pub dst_rect: Rect,
pub rotation: u64,
pub alpha: Option<u16>,
pub zpos: Option<u64>,
pub color_primaries: Option<crate::signaling::ColorPrimaries>,
pub source_eotf: Option<drmkit_display::TransferFunction>,
pub color_encoding: Option<ColorEncoding>,
pub color_range: Option<ColorRange>,
}
impl DisplayParams {
#[must_use]
pub fn ycbcr(&self) -> Ycbcr {
Ycbcr {
encoding: self.color_encoding.unwrap_or(ColorEncoding::Bt709),
range: self.color_range.unwrap_or(ColorRange::Limited),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[allow(
clippy::exhaustive_structs,
reason = "a value defined by its fields; there is nothing to add to it"
)]
pub struct Ycbcr {
pub encoding: ColorEncoding,
pub range: ColorRange,
}
#[must_use]
pub const fn to_16_16(pixels: u32) -> u64 {
(pixels as u64) << 16
}