cmm: add support for absolute_no_adaptation intent
This commit is contained in:
parent
154438f7dc
commit
e3be3ca41e
3 changed files with 16 additions and 4 deletions
|
|
@ -1,5 +1,6 @@
|
|||
use crate::{
|
||||
ifs::color_management::{
|
||||
ABSOLUTE_NO_ADAPTATION_SINCE, RENDER_INTENT_ABSOLUTE_NO_ADAPTATION,
|
||||
RENDER_INTENT_PERCEPTUAL, RENDER_INTENT_RELATIVE, RENDER_INTENT_RELATIVE_BPC,
|
||||
},
|
||||
object::Version,
|
||||
|
|
@ -11,14 +12,18 @@ pub enum RenderIntent {
|
|||
Perceptual,
|
||||
Relative,
|
||||
RelativeBpc,
|
||||
AbsoluteNoAdaptation,
|
||||
}
|
||||
|
||||
impl RenderIntent {
|
||||
pub fn from_wayland(intent: u32, _version: Version) -> Option<Self> {
|
||||
pub fn from_wayland(intent: u32, version: Version) -> Option<Self> {
|
||||
let res = match intent {
|
||||
RENDER_INTENT_PERCEPTUAL => Self::Perceptual,
|
||||
RENDER_INTENT_RELATIVE => Self::Relative,
|
||||
RENDER_INTENT_RELATIVE_BPC => Self::RelativeBpc,
|
||||
RENDER_INTENT_ABSOLUTE_NO_ADAPTATION if version >= ABSOLUTE_NO_ADAPTATION_SINCE => {
|
||||
Self::AbsoluteNoAdaptation
|
||||
}
|
||||
_ => return None,
|
||||
};
|
||||
Some(res)
|
||||
|
|
@ -29,6 +34,7 @@ impl RenderIntent {
|
|||
RenderIntent::Perceptual => true,
|
||||
RenderIntent::RelativeBpc => true,
|
||||
RenderIntent::Relative => false,
|
||||
RenderIntent::AbsoluteNoAdaptation => false,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -37,6 +43,7 @@ impl RenderIntent {
|
|||
RenderIntent::Perceptual => true,
|
||||
RenderIntent::RelativeBpc => true,
|
||||
RenderIntent::Relative => true,
|
||||
RenderIntent::AbsoluteNoAdaptation => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ pub mod wp_image_description_v1;
|
|||
const UNIQUE_CM_IDS_SINCE: Version = Version(2);
|
||||
const SRGB_DEPRECATED_SINCE: Version = Version(2);
|
||||
const COMPOUND_POWER_2_4_SINCE: Version = Version(2);
|
||||
pub const ABSOLUTE_NO_ADAPTATION_SINCE: Version = Version(2);
|
||||
|
||||
const PRIMARIES_MUL: f64 = 1_000_000.0;
|
||||
const PRIMARIES_MUL_INV: f64 = 1.0 / PRIMARIES_MUL;
|
||||
|
|
|
|||
|
|
@ -4,9 +4,10 @@ use {
|
|||
globals::{Global, GlobalName},
|
||||
ifs::{
|
||||
color_management::{
|
||||
COMPOUND_POWER_2_4_SINCE, FEATURE_EXTENDED_TARGET_VOLUME,
|
||||
FEATURE_SET_MASTERING_DISPLAY_PRIMARIES, FEATURE_SET_TF_POWER,
|
||||
RENDER_INTENT_RELATIVE, RENDER_INTENT_RELATIVE_BPC, SRGB_DEPRECATED_SINCE,
|
||||
ABSOLUTE_NO_ADAPTATION_SINCE, COMPOUND_POWER_2_4_SINCE,
|
||||
FEATURE_EXTENDED_TARGET_VOLUME, FEATURE_SET_MASTERING_DISPLAY_PRIMARIES,
|
||||
FEATURE_SET_TF_POWER, RENDER_INTENT_ABSOLUTE_NO_ADAPTATION, RENDER_INTENT_RELATIVE,
|
||||
RENDER_INTENT_RELATIVE_BPC, SRGB_DEPRECATED_SINCE,
|
||||
TRANSFER_FUNCTION_COMPOUND_POWER_2_4,
|
||||
consts::{
|
||||
FEATURE_PARAMETRIC, FEATURE_SET_LUMINANCES, FEATURE_SET_PRIMARIES,
|
||||
|
|
@ -80,6 +81,9 @@ impl WpColorManagerV1 {
|
|||
self.send_supported_intent(RENDER_INTENT_PERCEPTUAL);
|
||||
self.send_supported_intent(RENDER_INTENT_RELATIVE);
|
||||
self.send_supported_intent(RENDER_INTENT_RELATIVE_BPC);
|
||||
if self.version >= ABSOLUTE_NO_ADAPTATION_SINCE {
|
||||
self.send_supported_intent(RENDER_INTENT_ABSOLUTE_NO_ADAPTATION);
|
||||
}
|
||||
self.send_supported_feature(FEATURE_PARAMETRIC);
|
||||
self.send_supported_feature(FEATURE_SET_PRIMARIES);
|
||||
self.send_supported_feature(FEATURE_SET_LUMINANCES);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue