color-management: use more consistent naming
This commit is contained in:
parent
32db933242
commit
83e79b68e6
65 changed files with 439 additions and 510 deletions
|
|
@ -2,13 +2,13 @@ mod removed_output;
|
|||
|
||||
use {
|
||||
crate::{
|
||||
backend::{self, BackendColorSpace, BackendLuminance, BackendTransferFunction},
|
||||
backend::{self, BackendColorSpace, BackendEotfs, BackendLuminance},
|
||||
client::{Client, ClientError, ClientId},
|
||||
cmm::{
|
||||
cmm_description::ColorDescription,
|
||||
cmm_eotf::Eotf,
|
||||
cmm_luminance::Luminance,
|
||||
cmm_primaries::{NamedPrimaries, Primaries},
|
||||
cmm_transfer_function::TransferFunction,
|
||||
},
|
||||
damage::DamageMatrix,
|
||||
format::{Format, XRGB8888},
|
||||
|
|
@ -76,7 +76,7 @@ pub struct WlOutputGlobal {
|
|||
pub format: Cell<&'static Format>,
|
||||
pub width_mm: i32,
|
||||
pub height_mm: i32,
|
||||
pub transfer_functions: Vec<BackendTransferFunction>,
|
||||
pub eotfs: Vec<BackendEotfs>,
|
||||
pub color_spaces: Vec<BackendColorSpace>,
|
||||
pub primaries: Primaries,
|
||||
pub luminance: Option<BackendLuminance>,
|
||||
|
|
@ -86,7 +86,7 @@ pub struct WlOutputGlobal {
|
|||
pub persistent: Rc<PersistentOutputState>,
|
||||
pub opt: Rc<OutputGlobalOpt>,
|
||||
pub damage_matrix: Cell<DamageMatrix>,
|
||||
pub btf: Cell<BackendTransferFunction>,
|
||||
pub btf: Cell<BackendEotfs>,
|
||||
pub bcs: Cell<BackendColorSpace>,
|
||||
pub color_description: CloneCell<Rc<ColorDescription>>,
|
||||
pub linear_color_description: CloneCell<Rc<ColorDescription>>,
|
||||
|
|
@ -179,7 +179,7 @@ impl WlOutputGlobal {
|
|||
height_mm: i32,
|
||||
output_id: &Rc<OutputId>,
|
||||
persistent_state: &Rc<PersistentOutputState>,
|
||||
transfer_functions: Vec<BackendTransferFunction>,
|
||||
eotfs: Vec<BackendEotfs>,
|
||||
color_spaces: Vec<BackendColorSpace>,
|
||||
primaries: Primaries,
|
||||
luminance: Option<BackendLuminance>,
|
||||
|
|
@ -205,7 +205,7 @@ impl WlOutputGlobal {
|
|||
format: Cell::new(XRGB8888),
|
||||
width_mm,
|
||||
height_mm,
|
||||
transfer_functions,
|
||||
eotfs,
|
||||
color_spaces,
|
||||
primaries,
|
||||
luminance,
|
||||
|
|
@ -215,9 +215,9 @@ impl WlOutputGlobal {
|
|||
persistent: persistent_state.clone(),
|
||||
opt: Default::default(),
|
||||
damage_matrix: Default::default(),
|
||||
btf: Cell::new(connector_state.transfer_function),
|
||||
btf: Cell::new(connector_state.eotf),
|
||||
bcs: Cell::new(connector_state.color_space),
|
||||
color_description: CloneCell::new(state.color_manager.srgb_srgb().clone()),
|
||||
color_description: CloneCell::new(state.color_manager.srgb_gamma22().clone()),
|
||||
linear_color_description: CloneCell::new(state.color_manager.srgb_linear().clone()),
|
||||
color_description_listeners: Default::default(),
|
||||
};
|
||||
|
|
@ -345,7 +345,7 @@ impl WlOutputGlobal {
|
|||
pub fn update_color_description(&self) -> bool {
|
||||
let mut luminance = Luminance::SRGB;
|
||||
let tf = match self.btf.get() {
|
||||
BackendTransferFunction::Default => {
|
||||
BackendEotfs::Default => {
|
||||
if let Some(brightness) = self.persistent.brightness.get() {
|
||||
let output_max = match self.luminance {
|
||||
None => 80.0,
|
||||
|
|
@ -353,14 +353,14 @@ impl WlOutputGlobal {
|
|||
};
|
||||
luminance.white.0 = luminance.max.0 * brightness / output_max;
|
||||
}
|
||||
TransferFunction::Gamma22
|
||||
Eotf::Gamma22
|
||||
}
|
||||
BackendTransferFunction::Pq => {
|
||||
BackendEotfs::Pq => {
|
||||
luminance = Luminance::ST2084_PQ;
|
||||
if let Some(brightness) = self.persistent.brightness.get() {
|
||||
luminance.white.0 = brightness;
|
||||
}
|
||||
TransferFunction::St2084Pq
|
||||
Eotf::St2084Pq
|
||||
}
|
||||
};
|
||||
let mut target_luminance = luminance.to_target();
|
||||
|
|
@ -386,10 +386,7 @@ impl WlOutputGlobal {
|
|||
max_cll,
|
||||
max_fall,
|
||||
);
|
||||
let cd_linear = self
|
||||
.state
|
||||
.color_manager
|
||||
.get_with_tf(&cd, TransferFunction::Linear);
|
||||
let cd_linear = self.state.color_manager.get_with_tf(&cd, Eotf::Linear);
|
||||
self.linear_color_description.set(cd_linear.clone());
|
||||
self.color_description.set(cd.clone()).id != cd.id
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue