render/color: add wlr_color_transform_init()

This commit is contained in:
Simon Ser 2025-01-28 09:57:41 +01:00 committed by Kenny Levinsen
parent c6133f9912
commit d421538b4a
3 changed files with 13 additions and 6 deletions

View file

@ -21,14 +21,20 @@ static const struct wlr_color_primaries COLOR_PRIMARIES_BT2020 = { // code point
.white = { 0.3127, 0.3290 },
};
void wlr_color_transform_init(struct wlr_color_transform *tr, enum wlr_color_transform_type type) {
*tr = (struct wlr_color_transform){
.type = type,
.ref_count = 1,
};
wlr_addon_set_init(&tr->addons);
}
struct wlr_color_transform *wlr_color_transform_init_srgb(void) {
struct wlr_color_transform *tx = calloc(1, sizeof(struct wlr_color_transform));
if (!tx) {
return NULL;
}
tx->type = COLOR_TRANSFORM_SRGB;
tx->ref_count = 1;
wlr_addon_set_init(&tx->addons);
wlr_color_transform_init(tx, COLOR_TRANSFORM_SRGB);
return tx;
}