mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
scene: add support for color-management-v1 transfer functions
This commit is contained in:
parent
4efec11721
commit
7a1161438c
1 changed files with 21 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <wlr/types/wlr_alpha_modifier_v1.h>
|
||||
#include <wlr/types/wlr_color_management_v1.h>
|
||||
#include <wlr/types/wlr_compositor.h>
|
||||
#include <wlr/types/wlr_scene.h>
|
||||
#include <wlr/types/wlr_fractional_scale_v1.h>
|
||||
|
|
@ -186,11 +187,31 @@ static void surface_reconfigure(struct wlr_scene_surface *scene_surface) {
|
|||
opacity = (float)alpha_modifier_state->multiplier;
|
||||
}
|
||||
|
||||
enum wlr_color_transfer_function tf = WLR_COLOR_TRANSFER_FUNCTION_SRGB;
|
||||
const struct wlr_image_description_v1_data *img_desc =
|
||||
wlr_surface_get_image_description_v1_data(surface);
|
||||
if (img_desc != NULL) {
|
||||
switch (img_desc->tf_named) {
|
||||
case WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB:
|
||||
tf = WLR_COLOR_TRANSFER_FUNCTION_SRGB;
|
||||
break;
|
||||
case WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_ST2084_PQ:
|
||||
tf = WLR_COLOR_TRANSFER_FUNCTION_ST2084_PQ;
|
||||
break;
|
||||
case WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR:
|
||||
tf = WLR_COLOR_TRANSFER_FUNCTION_EXT_LINEAR;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
wlr_scene_buffer_set_opaque_region(scene_buffer, &opaque);
|
||||
wlr_scene_buffer_set_source_box(scene_buffer, &src_box);
|
||||
wlr_scene_buffer_set_dest_size(scene_buffer, width, height);
|
||||
wlr_scene_buffer_set_transform(scene_buffer, state->transform);
|
||||
wlr_scene_buffer_set_opacity(scene_buffer, opacity);
|
||||
wlr_scene_buffer_set_transfer_function(scene_buffer, tf);
|
||||
|
||||
scene_buffer_unmark_client_buffer(scene_buffer);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue