config: make the blend space configurable
This commit is contained in:
parent
991b212120
commit
39c770f6e2
20 changed files with 257 additions and 15 deletions
|
|
@ -33,7 +33,7 @@ use {
|
|||
logging::LogLevel,
|
||||
status::MessageFormat,
|
||||
theme::Color,
|
||||
video::{ColorSpace, Eotf, Format, GfxApi, TearingMode, Transform, VrrMode},
|
||||
video::{BlendSpace, ColorSpace, Eotf, Format, GfxApi, TearingMode, Transform, VrrMode},
|
||||
window::{ContentType, TileState, WindowType},
|
||||
workspace::WorkspaceDisplayOrder,
|
||||
xwayland::XScalingMode,
|
||||
|
|
@ -349,6 +349,7 @@ pub struct Output {
|
|||
pub color_space: Option<ColorSpace>,
|
||||
pub eotf: Option<Eotf>,
|
||||
pub brightness: Option<Option<f64>>,
|
||||
pub blend_space: Option<BlendSpace>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use {
|
|||
},
|
||||
},
|
||||
indexmap::IndexMap,
|
||||
jay_config::video::{ColorSpace, Eotf, Transform},
|
||||
jay_config::video::{BlendSpace, ColorSpace, Eotf, Transform},
|
||||
thiserror::Error,
|
||||
};
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ impl Parser for OutputParser<'_> {
|
|||
let mut ext = Extractor::new(self.cx, span, table);
|
||||
let (
|
||||
(name, match_val, x, y, scale, transform, mode, vrr_val, tearing_val, format_val),
|
||||
(color_space, eotf, brightness_val),
|
||||
(color_space, eotf, brightness_val, blend_space),
|
||||
) = ext.extract((
|
||||
(
|
||||
opt(str("name")),
|
||||
|
|
@ -69,6 +69,7 @@ impl Parser for OutputParser<'_> {
|
|||
recover(opt(str("color-space"))),
|
||||
recover(opt(str("transfer-function"))),
|
||||
opt(val("brightness")),
|
||||
recover(opt(str("blend-space"))),
|
||||
),
|
||||
))?;
|
||||
let transform = match transform {
|
||||
|
|
@ -177,6 +178,21 @@ impl Parser for OutputParser<'_> {
|
|||
}
|
||||
}
|
||||
}
|
||||
let blend_space = match blend_space {
|
||||
None => None,
|
||||
Some(bs) => match bs.value {
|
||||
"linear" => Some(BlendSpace::LINEAR),
|
||||
"srgb" => Some(BlendSpace::SRGB),
|
||||
_ => {
|
||||
log::warn!(
|
||||
"Unknown blend space {}: {}",
|
||||
bs.value,
|
||||
self.cx.error3(bs.span)
|
||||
);
|
||||
None
|
||||
}
|
||||
},
|
||||
};
|
||||
Ok(Output {
|
||||
name: name.despan().map(|v| v.to_string()),
|
||||
match_: match_val.parse_map(&mut OutputMatchParser(self.cx))?,
|
||||
|
|
@ -191,6 +207,7 @@ impl Parser for OutputParser<'_> {
|
|||
color_space,
|
||||
eotf,
|
||||
brightness,
|
||||
blend_space,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -777,6 +777,9 @@ impl Output {
|
|||
if let Some(brightness) = self.brightness {
|
||||
c.set_brightness(brightness);
|
||||
}
|
||||
if let Some(bs) = self.blend_space {
|
||||
c.set_blend_space(bs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue