1
0
Fork 0

wayland/color-management: Add support for NTSC primaries

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4062>
This commit is contained in:
Joan Torres 2024-09-13 13:01:39 +02:00
parent 1d4061f21e
commit f671fea7b9
3 changed files with 20 additions and 0 deletions

View file

@ -134,6 +134,8 @@ clutter_colorspace_to_string (ClutterColorspace colorspace)
return "sRGB"; return "sRGB";
case CLUTTER_COLORSPACE_BT2020: case CLUTTER_COLORSPACE_BT2020:
return "BT.2020"; return "BT.2020";
case CLUTTER_COLORSPACE_NTSC:
return "NTSC";
} }
g_assert_not_reached (); g_assert_not_reached ();
@ -614,6 +616,13 @@ static const ClutterPrimaries srgb_primaries = {
.w_x = 0.3127f, .w_y = 0.3290f, .w_x = 0.3127f, .w_y = 0.3290f,
}; };
static const ClutterPrimaries ntsc_primaries = {
.r_x = 0.63f, .r_y = 0.34f,
.g_x = 0.31f, .g_y = 0.595f,
.b_x = 0.155f, .b_y = 0.07f,
.w_x = 0.3127f, .w_y = 0.3290f,
};
static const ClutterPrimaries bt2020_primaries = { static const ClutterPrimaries bt2020_primaries = {
.r_x = 0.708f, .r_y = 0.292f, .r_x = 0.708f, .r_y = 0.292f,
.g_x = 0.170f, .g_y = 0.797f, .g_x = 0.170f, .g_y = 0.797f,
@ -628,6 +637,8 @@ clutter_colorspace_to_primaries (ClutterColorspace colorspace)
{ {
case CLUTTER_COLORSPACE_SRGB: case CLUTTER_COLORSPACE_SRGB:
return &srgb_primaries; return &srgb_primaries;
case CLUTTER_COLORSPACE_NTSC:
return &ntsc_primaries;
case CLUTTER_COLORSPACE_BT2020: case CLUTTER_COLORSPACE_BT2020:
return &bt2020_primaries; return &bt2020_primaries;
} }

View file

@ -36,6 +36,7 @@ typedef enum
{ {
CLUTTER_COLORSPACE_SRGB, CLUTTER_COLORSPACE_SRGB,
CLUTTER_COLORSPACE_BT2020, CLUTTER_COLORSPACE_BT2020,
CLUTTER_COLORSPACE_NTSC,
} ClutterColorspace; } ClutterColorspace;
typedef enum typedef enum

View file

@ -234,6 +234,10 @@ wayland_primaries_to_clutter (enum xx_color_manager_v4_primaries primaries,
colorimetry->type = CLUTTER_COLORIMETRY_TYPE_COLORSPACE; colorimetry->type = CLUTTER_COLORIMETRY_TYPE_COLORSPACE;
colorimetry->colorspace = CLUTTER_COLORSPACE_BT2020; colorimetry->colorspace = CLUTTER_COLORSPACE_BT2020;
return TRUE; return TRUE;
case XX_COLOR_MANAGER_V4_PRIMARIES_NTSC:
colorimetry->type = CLUTTER_COLORIMETRY_TYPE_COLORSPACE;
colorimetry->colorspace = CLUTTER_COLORSPACE_NTSC;
return TRUE;
default: default:
return FALSE; return FALSE;
} }
@ -248,6 +252,8 @@ clutter_colorspace_to_wayland (ClutterColorspace colorspace)
return XX_COLOR_MANAGER_V4_PRIMARIES_SRGB; return XX_COLOR_MANAGER_V4_PRIMARIES_SRGB;
case CLUTTER_COLORSPACE_BT2020: case CLUTTER_COLORSPACE_BT2020:
return XX_COLOR_MANAGER_V4_PRIMARIES_BT2020; return XX_COLOR_MANAGER_V4_PRIMARIES_BT2020;
case CLUTTER_COLORSPACE_NTSC:
return XX_COLOR_MANAGER_V4_PRIMARIES_NTSC;
} }
g_assert_not_reached (); g_assert_not_reached ();
} }
@ -1441,6 +1447,8 @@ color_manager_send_supported_events (struct wl_resource *resource)
XX_COLOR_MANAGER_V4_PRIMARIES_SRGB); XX_COLOR_MANAGER_V4_PRIMARIES_SRGB);
xx_color_manager_v4_send_supported_primaries_named (resource, xx_color_manager_v4_send_supported_primaries_named (resource,
XX_COLOR_MANAGER_V4_PRIMARIES_BT2020); XX_COLOR_MANAGER_V4_PRIMARIES_BT2020);
xx_color_manager_v4_send_supported_primaries_named (resource,
XX_COLOR_MANAGER_V4_PRIMARIES_NTSC);
} }
static const struct xx_color_manager_v4_interface static const struct xx_color_manager_v4_interface