1
0
Fork 0
forked from wry/wry

cmm: add support for absolute_no_adaptation intent

This commit is contained in:
Julian Orth 2026-03-29 15:51:33 +02:00
parent 154438f7dc
commit e3be3ca41e
3 changed files with 16 additions and 4 deletions

View file

@ -1,5 +1,6 @@
use crate::{ use crate::{
ifs::color_management::{ ifs::color_management::{
ABSOLUTE_NO_ADAPTATION_SINCE, RENDER_INTENT_ABSOLUTE_NO_ADAPTATION,
RENDER_INTENT_PERCEPTUAL, RENDER_INTENT_RELATIVE, RENDER_INTENT_RELATIVE_BPC, RENDER_INTENT_PERCEPTUAL, RENDER_INTENT_RELATIVE, RENDER_INTENT_RELATIVE_BPC,
}, },
object::Version, object::Version,
@ -11,14 +12,18 @@ pub enum RenderIntent {
Perceptual, Perceptual,
Relative, Relative,
RelativeBpc, RelativeBpc,
AbsoluteNoAdaptation,
} }
impl RenderIntent { 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 { let res = match intent {
RENDER_INTENT_PERCEPTUAL => Self::Perceptual, RENDER_INTENT_PERCEPTUAL => Self::Perceptual,
RENDER_INTENT_RELATIVE => Self::Relative, RENDER_INTENT_RELATIVE => Self::Relative,
RENDER_INTENT_RELATIVE_BPC => Self::RelativeBpc, RENDER_INTENT_RELATIVE_BPC => Self::RelativeBpc,
RENDER_INTENT_ABSOLUTE_NO_ADAPTATION if version >= ABSOLUTE_NO_ADAPTATION_SINCE => {
Self::AbsoluteNoAdaptation
}
_ => return None, _ => return None,
}; };
Some(res) Some(res)
@ -29,6 +34,7 @@ impl RenderIntent {
RenderIntent::Perceptual => true, RenderIntent::Perceptual => true,
RenderIntent::RelativeBpc => true, RenderIntent::RelativeBpc => true,
RenderIntent::Relative => false, RenderIntent::Relative => false,
RenderIntent::AbsoluteNoAdaptation => false,
} }
} }
@ -37,6 +43,7 @@ impl RenderIntent {
RenderIntent::Perceptual => true, RenderIntent::Perceptual => true,
RenderIntent::RelativeBpc => true, RenderIntent::RelativeBpc => true,
RenderIntent::Relative => true, RenderIntent::Relative => true,
RenderIntent::AbsoluteNoAdaptation => false,
} }
} }
} }

View file

@ -13,6 +13,7 @@ pub mod wp_image_description_v1;
const UNIQUE_CM_IDS_SINCE: Version = Version(2); const UNIQUE_CM_IDS_SINCE: Version = Version(2);
const SRGB_DEPRECATED_SINCE: Version = Version(2); const SRGB_DEPRECATED_SINCE: Version = Version(2);
const COMPOUND_POWER_2_4_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: f64 = 1_000_000.0;
const PRIMARIES_MUL_INV: f64 = 1.0 / PRIMARIES_MUL; const PRIMARIES_MUL_INV: f64 = 1.0 / PRIMARIES_MUL;

View file

@ -4,9 +4,10 @@ use {
globals::{Global, GlobalName}, globals::{Global, GlobalName},
ifs::{ ifs::{
color_management::{ color_management::{
COMPOUND_POWER_2_4_SINCE, FEATURE_EXTENDED_TARGET_VOLUME, ABSOLUTE_NO_ADAPTATION_SINCE, COMPOUND_POWER_2_4_SINCE,
FEATURE_SET_MASTERING_DISPLAY_PRIMARIES, FEATURE_SET_TF_POWER, FEATURE_EXTENDED_TARGET_VOLUME, FEATURE_SET_MASTERING_DISPLAY_PRIMARIES,
RENDER_INTENT_RELATIVE, RENDER_INTENT_RELATIVE_BPC, SRGB_DEPRECATED_SINCE, 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, TRANSFER_FUNCTION_COMPOUND_POWER_2_4,
consts::{ consts::{
FEATURE_PARAMETRIC, FEATURE_SET_LUMINANCES, FEATURE_SET_PRIMARIES, 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_PERCEPTUAL);
self.send_supported_intent(RENDER_INTENT_RELATIVE); self.send_supported_intent(RENDER_INTENT_RELATIVE);
self.send_supported_intent(RENDER_INTENT_RELATIVE_BPC); 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_PARAMETRIC);
self.send_supported_feature(FEATURE_SET_PRIMARIES); self.send_supported_feature(FEATURE_SET_PRIMARIES);
self.send_supported_feature(FEATURE_SET_LUMINANCES); self.send_supported_feature(FEATURE_SET_LUMINANCES);