mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-03-21 05:34:09 -04:00
render/color: add wlr_color_transform_init()
This commit is contained in:
parent
c6133f9912
commit
d421538b4a
3 changed files with 13 additions and 6 deletions
|
|
@ -38,6 +38,9 @@ struct wlr_color_transform_lut3d {
|
||||||
size_t dim_len;
|
size_t dim_len;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void wlr_color_transform_init(struct wlr_color_transform *tr,
|
||||||
|
enum wlr_color_transform_type type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a wlr_color_transform_lut3d from a generic wlr_color_transform.
|
* Gets a wlr_color_transform_lut3d from a generic wlr_color_transform.
|
||||||
* Asserts that the base type is COLOR_TRANSFORM_LUT_3D
|
* Asserts that the base type is COLOR_TRANSFORM_LUT_3D
|
||||||
|
|
|
||||||
|
|
@ -21,14 +21,20 @@ static const struct wlr_color_primaries COLOR_PRIMARIES_BT2020 = { // code point
|
||||||
.white = { 0.3127, 0.3290 },
|
.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 *wlr_color_transform_init_srgb(void) {
|
||||||
struct wlr_color_transform *tx = calloc(1, sizeof(struct wlr_color_transform));
|
struct wlr_color_transform *tx = calloc(1, sizeof(struct wlr_color_transform));
|
||||||
if (!tx) {
|
if (!tx) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
tx->type = COLOR_TRANSFORM_SRGB;
|
wlr_color_transform_init(tx, COLOR_TRANSFORM_SRGB);
|
||||||
tx->ref_count = 1;
|
|
||||||
wlr_addon_set_init(&tx->addons);
|
|
||||||
return tx;
|
return tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,11 +99,9 @@ struct wlr_color_transform *wlr_color_transform_init_linear_to_icc(
|
||||||
if (!tx) {
|
if (!tx) {
|
||||||
goto out_lcms_tr;
|
goto out_lcms_tr;
|
||||||
}
|
}
|
||||||
tx->base.type = COLOR_TRANSFORM_LUT_3D;
|
wlr_color_transform_init(&tx->base, COLOR_TRANSFORM_LUT_3D);
|
||||||
tx->dim_len = dim_len;
|
tx->dim_len = dim_len;
|
||||||
tx->lut_3d = lut_3d;
|
tx->lut_3d = lut_3d;
|
||||||
tx->base.ref_count = 1;
|
|
||||||
wlr_addon_set_init(&tx->base.addons);
|
|
||||||
|
|
||||||
out_lcms_tr:
|
out_lcms_tr:
|
||||||
cmsDeleteTransform(lcms_tr);
|
cmsDeleteTransform(lcms_tr);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue