aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/wlr/types/wlr_gamma_control_v1.h2
-rw-r--r--types/wlr_gamma_control_v1.c13
2 files changed, 15 insertions, 0 deletions
diff --git a/include/wlr/types/wlr_gamma_control_v1.h b/include/wlr/types/wlr_gamma_control_v1.h
index fa08586a..7a03a73e 100644
--- a/include/wlr/types/wlr_gamma_control_v1.h
+++ b/include/wlr/types/wlr_gamma_control_v1.h
@@ -41,5 +41,7 @@ struct wlr_gamma_control_manager_v1 *wlr_gamma_control_manager_v1_create(
struct wl_display *display);
struct wlr_gamma_control_v1 *wlr_gamma_control_manager_v1_get_control(
struct wlr_gamma_control_manager_v1 *manager, struct wlr_output *output);
+bool wlr_gamma_control_v1_apply(struct wlr_gamma_control_v1 *gamma_control,
+ struct wlr_output_state *output_state);
#endif
diff --git a/types/wlr_gamma_control_v1.c b/types/wlr_gamma_control_v1.c
index 4494b9da..5f3b750b 100644
--- a/types/wlr_gamma_control_v1.c
+++ b/types/wlr_gamma_control_v1.c
@@ -307,3 +307,16 @@ struct wlr_gamma_control_v1 *wlr_gamma_control_manager_v1_get_control(
}
return NULL;
}
+
+bool wlr_gamma_control_v1_apply(struct wlr_gamma_control_v1 *gamma_control,
+ struct wlr_output_state *output_state) {
+ if (gamma_control == NULL || gamma_control->table == NULL) {
+ return wlr_output_state_set_gamma_lut(output_state, 0, NULL, NULL, NULL);
+ }
+
+ const uint16_t *r = gamma_control->table;
+ const uint16_t *g = gamma_control->table + gamma_control->ramp_size;
+ const uint16_t *b = gamma_control->table + 2 * gamma_control->ramp_size;
+ return wlr_output_state_set_gamma_lut(output_state,
+ gamma_control->ramp_size, r, g, b);
+}