mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-31 22:25:21 -04:00
color_management_v1: add helpers to convert TF/primaries enums
This makes it easier for protocol implementers to tie everything together with wlroots backends and renderers.
This commit is contained in:
parent
db5e9ca04c
commit
47a90d6f1a
2 changed files with 40 additions and 0 deletions
|
|
@ -89,4 +89,18 @@ void wlr_color_manager_v1_set_surface_preferred_image_description(
|
||||||
struct wlr_color_manager_v1 *manager, struct wlr_surface *surface,
|
struct wlr_color_manager_v1 *manager, struct wlr_surface *surface,
|
||||||
const struct wlr_image_description_v1_data *data);
|
const struct wlr_image_description_v1_data *data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a protocol transfer function to enum wlr_color_transfer_function.
|
||||||
|
* Aborts if there is no matching wlroots entry.
|
||||||
|
*/
|
||||||
|
enum wlr_color_transfer_function
|
||||||
|
wlr_color_manager_v1_transfer_function_to_wlr(enum wp_color_manager_v1_transfer_function tf);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a protocol named primaries to enum wlr_color_named_primaries.
|
||||||
|
* Aborts if there is no matching wlroots entry.
|
||||||
|
*/
|
||||||
|
enum wlr_color_named_primaries
|
||||||
|
wlr_color_manager_v1_primaries_to_wlr(enum wp_color_manager_v1_primaries primaries);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -992,3 +992,29 @@ void wlr_color_manager_v1_set_surface_preferred_image_description(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum wlr_color_transfer_function
|
||||||
|
wlr_color_manager_v1_transfer_function_to_wlr(enum wp_color_manager_v1_transfer_function tf) {
|
||||||
|
switch (tf) {
|
||||||
|
case WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB:
|
||||||
|
return WLR_COLOR_TRANSFER_FUNCTION_SRGB;
|
||||||
|
case WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_ST2084_PQ:
|
||||||
|
return WLR_COLOR_TRANSFER_FUNCTION_ST2084_PQ;
|
||||||
|
case WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR:
|
||||||
|
return WLR_COLOR_TRANSFER_FUNCTION_EXT_LINEAR;
|
||||||
|
default:
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum wlr_color_named_primaries
|
||||||
|
wlr_color_manager_v1_primaries_to_wlr(enum wp_color_manager_v1_primaries primaries) {
|
||||||
|
switch (primaries) {
|
||||||
|
case WP_COLOR_MANAGER_V1_PRIMARIES_SRGB:
|
||||||
|
return WLR_COLOR_NAMED_PRIMARIES_SRGB;
|
||||||
|
case WP_COLOR_MANAGER_V1_PRIMARIES_BT2020:
|
||||||
|
return WLR_COLOR_NAMED_PRIMARIES_BT2020;
|
||||||
|
default:
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue