1
0
Fork 0
forked from wry/wry

cmm: add support for relative_bpc intent

This commit is contained in:
Julian Orth 2026-03-29 15:36:31 +02:00
parent dca0df2555
commit 4d5675916b
2 changed files with 11 additions and 2 deletions

View file

@ -1,15 +1,20 @@
use crate::{ifs::color_management::RENDER_INTENT_PERCEPTUAL, object::Version};
use crate::{
ifs::color_management::{RENDER_INTENT_PERCEPTUAL, RENDER_INTENT_RELATIVE_BPC},
object::Version,
};
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Default)]
pub enum RenderIntent {
#[default]
Perceptual,
RelativeBpc,
}
impl RenderIntent {
pub fn from_wayland(intent: u32, _version: Version) -> Option<Self> {
let res = match intent {
RENDER_INTENT_PERCEPTUAL => Self::Perceptual,
RENDER_INTENT_RELATIVE_BPC => Self::RelativeBpc,
_ => return None,
};
Some(res)
@ -18,12 +23,14 @@ impl RenderIntent {
pub fn black_point_compensation(self) -> bool {
match self {
RenderIntent::Perceptual => true,
RenderIntent::RelativeBpc => true,
}
}
pub fn bradford_adjustment(self) -> bool {
match self {
RenderIntent::Perceptual => true,
RenderIntent::RelativeBpc => true,
}
}
}

View file

@ -6,7 +6,8 @@ use {
color_management::{
COMPOUND_POWER_2_4_SINCE, FEATURE_EXTENDED_TARGET_VOLUME,
FEATURE_SET_MASTERING_DISPLAY_PRIMARIES, FEATURE_SET_TF_POWER,
SRGB_DEPRECATED_SINCE, TRANSFER_FUNCTION_COMPOUND_POWER_2_4,
RENDER_INTENT_RELATIVE_BPC, SRGB_DEPRECATED_SINCE,
TRANSFER_FUNCTION_COMPOUND_POWER_2_4,
consts::{
FEATURE_PARAMETRIC, FEATURE_SET_LUMINANCES, FEATURE_SET_PRIMARIES,
FEATURE_WINDOWS_SCRGB, PRIMARIES_ADOBE_RGB, PRIMARIES_BT2020,
@ -77,6 +78,7 @@ pub struct WpColorManagerV1 {
impl WpColorManagerV1 {
fn send_capabilities(&self) {
self.send_supported_intent(RENDER_INTENT_PERCEPTUAL);
self.send_supported_intent(RENDER_INTENT_RELATIVE_BPC);
self.send_supported_feature(FEATURE_PARAMETRIC);
self.send_supported_feature(FEATURE_SET_PRIMARIES);
self.send_supported_feature(FEATURE_SET_LUMINANCES);