1
0
Fork 0
forked from wry/wry

cmm: add support for relative intent

This commit is contained in:
Julian Orth 2026-03-29 15:46:59 +02:00
parent 4d5675916b
commit 154438f7dc
2 changed files with 9 additions and 2 deletions

View file

@ -1,5 +1,7 @@
use crate::{ use crate::{
ifs::color_management::{RENDER_INTENT_PERCEPTUAL, RENDER_INTENT_RELATIVE_BPC}, ifs::color_management::{
RENDER_INTENT_PERCEPTUAL, RENDER_INTENT_RELATIVE, RENDER_INTENT_RELATIVE_BPC,
},
object::Version, object::Version,
}; };
@ -7,6 +9,7 @@ use crate::{
pub enum RenderIntent { pub enum RenderIntent {
#[default] #[default]
Perceptual, Perceptual,
Relative,
RelativeBpc, RelativeBpc,
} }
@ -14,6 +17,7 @@ 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_BPC => Self::RelativeBpc, RENDER_INTENT_RELATIVE_BPC => Self::RelativeBpc,
_ => return None, _ => return None,
}; };
@ -24,6 +28,7 @@ impl RenderIntent {
match self { match self {
RenderIntent::Perceptual => true, RenderIntent::Perceptual => true,
RenderIntent::RelativeBpc => true, RenderIntent::RelativeBpc => true,
RenderIntent::Relative => false,
} }
} }
@ -31,6 +36,7 @@ impl RenderIntent {
match self { match self {
RenderIntent::Perceptual => true, RenderIntent::Perceptual => true,
RenderIntent::RelativeBpc => true, RenderIntent::RelativeBpc => true,
RenderIntent::Relative => true,
} }
} }
} }

View file

@ -6,7 +6,7 @@ use {
color_management::{ color_management::{
COMPOUND_POWER_2_4_SINCE, FEATURE_EXTENDED_TARGET_VOLUME, COMPOUND_POWER_2_4_SINCE, FEATURE_EXTENDED_TARGET_VOLUME,
FEATURE_SET_MASTERING_DISPLAY_PRIMARIES, FEATURE_SET_TF_POWER, FEATURE_SET_MASTERING_DISPLAY_PRIMARIES, FEATURE_SET_TF_POWER,
RENDER_INTENT_RELATIVE_BPC, SRGB_DEPRECATED_SINCE, 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,
@ -78,6 +78,7 @@ pub struct WpColorManagerV1 {
impl WpColorManagerV1 { impl WpColorManagerV1 {
fn send_capabilities(&self) { fn send_capabilities(&self) {
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_BPC); self.send_supported_intent(RENDER_INTENT_RELATIVE_BPC);
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);