wayland/color-management: When sending colorspace info send primaries too
clutter_primaries_to_wayland made sense when there only existed ClutterColorspace. Now that ClutterPrimaries also exist, it makes more sense to change that func to clutter_colorspace_to_wayland. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4062>
This commit is contained in:
parent
077eb80a8d
commit
1d4061f21e
@ -621,6 +621,23 @@ static const ClutterPrimaries bt2020_primaries = {
|
|||||||
.w_x = 0.3127f, .w_y = 0.3290f,
|
.w_x = 0.3127f, .w_y = 0.3290f,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ClutterPrimaries *
|
||||||
|
clutter_colorspace_to_primaries (ClutterColorspace colorspace)
|
||||||
|
{
|
||||||
|
switch (colorspace)
|
||||||
|
{
|
||||||
|
case CLUTTER_COLORSPACE_SRGB:
|
||||||
|
return &srgb_primaries;
|
||||||
|
case CLUTTER_COLORSPACE_BT2020:
|
||||||
|
return &bt2020_primaries;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_warning ("Unhandled colorspace %s",
|
||||||
|
clutter_colorspace_to_string (colorspace));
|
||||||
|
|
||||||
|
return &srgb_primaries;
|
||||||
|
}
|
||||||
|
|
||||||
static const ClutterPrimaries *
|
static const ClutterPrimaries *
|
||||||
get_primaries (ClutterColorState *color_state)
|
get_primaries (ClutterColorState *color_state)
|
||||||
{
|
{
|
||||||
@ -633,17 +650,11 @@ get_primaries (ClutterColorState *color_state)
|
|||||||
case CLUTTER_COLORIMETRY_TYPE_PRIMARIES:
|
case CLUTTER_COLORIMETRY_TYPE_PRIMARIES:
|
||||||
return priv->colorimetry.primaries;
|
return priv->colorimetry.primaries;
|
||||||
case CLUTTER_COLORIMETRY_TYPE_COLORSPACE:
|
case CLUTTER_COLORIMETRY_TYPE_COLORSPACE:
|
||||||
switch (priv->colorimetry.colorspace)
|
return clutter_colorspace_to_primaries (priv->colorimetry.colorspace);
|
||||||
{
|
|
||||||
case CLUTTER_COLORSPACE_SRGB:
|
|
||||||
return &srgb_primaries;
|
|
||||||
case CLUTTER_COLORSPACE_BT2020:
|
|
||||||
return &bt2020_primaries;
|
|
||||||
}
|
|
||||||
g_warning ("Unhandled colorspace %s",
|
|
||||||
clutter_colorspace_to_string (priv->colorimetry.colorspace));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_warning ("Unhandled colorimetry when getting primaries");
|
||||||
|
|
||||||
return &srgb_primaries;
|
return &srgb_primaries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,6 +160,9 @@ ClutterColorState * clutter_color_state_get_blending (ClutterColorState *color_s
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
const ClutterLuminance * clutter_eotf_get_default_luminance (ClutterEOTF eotf);
|
const ClutterLuminance * clutter_eotf_get_default_luminance (ClutterEOTF eotf);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
const ClutterPrimaries * clutter_colorspace_to_primaries (ClutterColorspace colorspace);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_primaries_ensure_normalized_range (ClutterPrimaries *primaries);
|
void clutter_primaries_ensure_normalized_range (ClutterPrimaries *primaries);
|
||||||
|
|
||||||
|
@ -240,9 +240,9 @@ wayland_primaries_to_clutter (enum xx_color_manager_v4_primaries primaries,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static enum xx_color_manager_v4_primaries
|
static enum xx_color_manager_v4_primaries
|
||||||
clutter_primaries_to_wayland (ClutterColorspace primaries)
|
clutter_colorspace_to_wayland (ClutterColorspace colorspace)
|
||||||
{
|
{
|
||||||
switch (primaries)
|
switch (colorspace)
|
||||||
{
|
{
|
||||||
case CLUTTER_COLORSPACE_SRGB:
|
case CLUTTER_COLORSPACE_SRGB:
|
||||||
return XX_COLOR_MANAGER_V4_PRIMARIES_SRGB;
|
return XX_COLOR_MANAGER_V4_PRIMARIES_SRGB;
|
||||||
@ -353,9 +353,10 @@ static void
|
|||||||
send_information (struct wl_resource *info_resource,
|
send_information (struct wl_resource *info_resource,
|
||||||
ClutterColorState *color_state)
|
ClutterColorState *color_state)
|
||||||
{
|
{
|
||||||
enum xx_color_manager_v4_primaries primaries;
|
enum xx_color_manager_v4_primaries primaries_named;
|
||||||
enum xx_color_manager_v4_transfer_function tf;
|
enum xx_color_manager_v4_transfer_function tf;
|
||||||
const ClutterColorimetry *colorimetry;
|
const ClutterColorimetry *colorimetry;
|
||||||
|
const ClutterPrimaries *primaries;
|
||||||
const ClutterEOTF *eotf;
|
const ClutterEOTF *eotf;
|
||||||
const ClutterLuminance *lum;
|
const ClutterLuminance *lum;
|
||||||
|
|
||||||
@ -363,9 +364,21 @@ send_information (struct wl_resource *info_resource,
|
|||||||
switch (colorimetry->type)
|
switch (colorimetry->type)
|
||||||
{
|
{
|
||||||
case CLUTTER_COLORIMETRY_TYPE_COLORSPACE:
|
case CLUTTER_COLORIMETRY_TYPE_COLORSPACE:
|
||||||
primaries = clutter_primaries_to_wayland (colorimetry->colorspace);
|
primaries_named = clutter_colorspace_to_wayland (colorimetry->colorspace);
|
||||||
xx_image_description_info_v4_send_primaries_named (info_resource,
|
xx_image_description_info_v4_send_primaries_named (info_resource,
|
||||||
primaries);
|
primaries_named);
|
||||||
|
|
||||||
|
primaries = clutter_colorspace_to_primaries (colorimetry->colorspace);
|
||||||
|
xx_image_description_info_v4_send_primaries (
|
||||||
|
info_resource,
|
||||||
|
float_to_scaled_uint32 (primaries->r_x),
|
||||||
|
float_to_scaled_uint32 (primaries->r_y),
|
||||||
|
float_to_scaled_uint32 (primaries->g_x),
|
||||||
|
float_to_scaled_uint32 (primaries->g_y),
|
||||||
|
float_to_scaled_uint32 (primaries->b_x),
|
||||||
|
float_to_scaled_uint32 (primaries->b_y),
|
||||||
|
float_to_scaled_uint32 (primaries->w_x),
|
||||||
|
float_to_scaled_uint32 (primaries->w_y));
|
||||||
break;
|
break;
|
||||||
case CLUTTER_COLORIMETRY_TYPE_PRIMARIES:
|
case CLUTTER_COLORIMETRY_TYPE_PRIMARIES:
|
||||||
xx_image_description_info_v4_send_primaries (
|
xx_image_description_info_v4_send_primaries (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user