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
3 changed files with 41 additions and 14 deletions
|
@ -621,6 +621,23 @@ static const ClutterPrimaries bt2020_primaries = {
|
|||
.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 *
|
||||
get_primaries (ClutterColorState *color_state)
|
||||
{
|
||||
|
@ -633,17 +650,11 @@ get_primaries (ClutterColorState *color_state)
|
|||
case CLUTTER_COLORIMETRY_TYPE_PRIMARIES:
|
||||
return priv->colorimetry.primaries;
|
||||
case CLUTTER_COLORIMETRY_TYPE_COLORSPACE:
|
||||
switch (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));
|
||||
return clutter_colorspace_to_primaries (priv->colorimetry.colorspace);
|
||||
}
|
||||
|
||||
g_warning ("Unhandled colorimetry when getting primaries");
|
||||
|
||||
return &srgb_primaries;
|
||||
}
|
||||
|
||||
|
|
|
@ -160,6 +160,9 @@ ClutterColorState * clutter_color_state_get_blending (ClutterColorState *color_s
|
|||
CLUTTER_EXPORT
|
||||
const ClutterLuminance * clutter_eotf_get_default_luminance (ClutterEOTF eotf);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
const ClutterPrimaries * clutter_colorspace_to_primaries (ClutterColorspace colorspace);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
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
|
||||
clutter_primaries_to_wayland (ClutterColorspace primaries)
|
||||
clutter_colorspace_to_wayland (ClutterColorspace colorspace)
|
||||
{
|
||||
switch (primaries)
|
||||
switch (colorspace)
|
||||
{
|
||||
case CLUTTER_COLORSPACE_SRGB:
|
||||
return XX_COLOR_MANAGER_V4_PRIMARIES_SRGB;
|
||||
|
@ -353,9 +353,10 @@ static void
|
|||
send_information (struct wl_resource *info_resource,
|
||||
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;
|
||||
const ClutterColorimetry *colorimetry;
|
||||
const ClutterPrimaries *primaries;
|
||||
const ClutterEOTF *eotf;
|
||||
const ClutterLuminance *lum;
|
||||
|
||||
|
@ -363,9 +364,21 @@ send_information (struct wl_resource *info_resource,
|
|||
switch (colorimetry->type)
|
||||
{
|
||||
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,
|
||||
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;
|
||||
case CLUTTER_COLORIMETRY_TYPE_PRIMARIES:
|
||||
xx_image_description_info_v4_send_primaries (
|
||||
|
|
Loading…
Reference in a new issue