mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-03-10 05:34:08 -04:00
color_management_v1: expose try_* enum converters in internal header
This will be useful for the Wayland backend.
This commit is contained in:
parent
106f0f9506
commit
ab5d3148b9
2 changed files with 28 additions and 6 deletions
9
include/types/wlr_color_management_v1.h
Normal file
9
include/types/wlr_color_management_v1.h
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
#ifndef TYPES_WLR_COLOR_MANAGEMENT_V1_H
|
||||||
|
#define TYPES_WLR_COLOR_MANAGEMENT_V1_H
|
||||||
|
|
||||||
|
#include <wlr/types/wlr_color_management_v1.h>
|
||||||
|
|
||||||
|
uint32_t transfer_function_try_to_wlr(enum wp_color_manager_v1_transfer_function tf);
|
||||||
|
uint32_t named_primaries_try_to_wlr(enum wp_color_manager_v1_primaries primaries);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "color-management-v1-protocol.h"
|
#include "color-management-v1-protocol.h"
|
||||||
#include "render/color.h"
|
#include "render/color.h"
|
||||||
|
#include "types/wlr_color_management_v1.h"
|
||||||
#include "util/mem.h"
|
#include "util/mem.h"
|
||||||
|
|
||||||
#define COLOR_MANAGEMENT_V1_VERSION 1
|
#define COLOR_MANAGEMENT_V1_VERSION 1
|
||||||
|
|
@ -984,8 +985,7 @@ void wlr_color_manager_v1_set_surface_preferred_image_description(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum wlr_color_transfer_function
|
uint32_t transfer_function_try_to_wlr(enum wp_color_manager_v1_transfer_function tf) {
|
||||||
wlr_color_manager_v1_transfer_function_to_wlr(enum wp_color_manager_v1_transfer_function tf) {
|
|
||||||
switch (tf) {
|
switch (tf) {
|
||||||
case WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB:
|
case WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB:
|
||||||
return WLR_COLOR_TRANSFER_FUNCTION_SRGB;
|
return WLR_COLOR_TRANSFER_FUNCTION_SRGB;
|
||||||
|
|
@ -998,10 +998,17 @@ wlr_color_manager_v1_transfer_function_to_wlr(enum wp_color_manager_v1_transfer_
|
||||||
case WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_BT1886:
|
case WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_BT1886:
|
||||||
return WLR_COLOR_TRANSFER_FUNCTION_BT1886;
|
return WLR_COLOR_TRANSFER_FUNCTION_BT1886;
|
||||||
default:
|
default:
|
||||||
abort();
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum wlr_color_transfer_function
|
||||||
|
wlr_color_manager_v1_transfer_function_to_wlr(enum wp_color_manager_v1_transfer_function tf) {
|
||||||
|
uint32_t wlr_tf = transfer_function_try_to_wlr(tf);
|
||||||
|
assert(wlr_tf != 0);
|
||||||
|
return wlr_tf;
|
||||||
|
}
|
||||||
|
|
||||||
enum wp_color_manager_v1_transfer_function
|
enum wp_color_manager_v1_transfer_function
|
||||||
wlr_color_manager_v1_transfer_function_from_wlr(enum wlr_color_transfer_function tf) {
|
wlr_color_manager_v1_transfer_function_from_wlr(enum wlr_color_transfer_function tf) {
|
||||||
switch (tf) {
|
switch (tf) {
|
||||||
|
|
@ -1019,18 +1026,24 @@ wlr_color_manager_v1_transfer_function_from_wlr(enum wlr_color_transfer_function
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
enum wlr_color_named_primaries
|
uint32_t named_primaries_try_to_wlr(enum wp_color_manager_v1_primaries primaries) {
|
||||||
wlr_color_manager_v1_primaries_to_wlr(enum wp_color_manager_v1_primaries primaries) {
|
|
||||||
switch (primaries) {
|
switch (primaries) {
|
||||||
case WP_COLOR_MANAGER_V1_PRIMARIES_SRGB:
|
case WP_COLOR_MANAGER_V1_PRIMARIES_SRGB:
|
||||||
return WLR_COLOR_NAMED_PRIMARIES_SRGB;
|
return WLR_COLOR_NAMED_PRIMARIES_SRGB;
|
||||||
case WP_COLOR_MANAGER_V1_PRIMARIES_BT2020:
|
case WP_COLOR_MANAGER_V1_PRIMARIES_BT2020:
|
||||||
return WLR_COLOR_NAMED_PRIMARIES_BT2020;
|
return WLR_COLOR_NAMED_PRIMARIES_BT2020;
|
||||||
default:
|
default:
|
||||||
abort();
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum wlr_color_named_primaries
|
||||||
|
wlr_color_manager_v1_primaries_to_wlr(enum wp_color_manager_v1_primaries primaries) {
|
||||||
|
uint32_t wlr_primaries = named_primaries_try_to_wlr(primaries);
|
||||||
|
assert(wlr_primaries != 0);
|
||||||
|
return wlr_primaries;
|
||||||
|
}
|
||||||
|
|
||||||
enum wp_color_manager_v1_primaries
|
enum wp_color_manager_v1_primaries
|
||||||
wlr_color_manager_v1_primaries_from_wlr(enum wlr_color_named_primaries primaries) {
|
wlr_color_manager_v1_primaries_from_wlr(enum wlr_color_named_primaries primaries) {
|
||||||
switch (primaries) {
|
switch (primaries) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue