gpu: Make colormatrix op obey ccs
The colormatrix needs to be applied to unpremultiplied values, so we use the alternative colorstate for that.
This commit is contained in:
@@ -50,6 +50,7 @@ static const GskGpuShaderOpClass GSK_GPU_COLOR_MATRIX_OP_CLASS = {
|
||||
void
|
||||
gsk_gpu_color_matrix_op (GskGpuFrame *frame,
|
||||
GskGpuShaderClip clip,
|
||||
GskGpuColorStates color_states,
|
||||
GskGpuDescriptors *desc,
|
||||
guint32 descriptor,
|
||||
const graphene_rect_t *rect,
|
||||
@@ -62,7 +63,7 @@ gsk_gpu_color_matrix_op (GskGpuFrame *frame,
|
||||
|
||||
gsk_gpu_shader_op_alloc (frame,
|
||||
&GSK_GPU_COLOR_MATRIX_OP_CLASS,
|
||||
DEFAULT_COLOR_STATES,
|
||||
color_states,
|
||||
0,
|
||||
clip,
|
||||
desc,
|
||||
|
||||
@@ -8,6 +8,7 @@ G_BEGIN_DECLS
|
||||
|
||||
void gsk_gpu_color_matrix_op (GskGpuFrame *frame,
|
||||
GskGpuShaderClip clip,
|
||||
GskGpuColorStates color_states,
|
||||
GskGpuDescriptors *desc,
|
||||
guint32 descriptor,
|
||||
const graphene_rect_t *rect,
|
||||
|
||||
@@ -2742,6 +2742,7 @@ gsk_gpu_node_processor_add_color_matrix_node (GskGpuNodeProcessor *self,
|
||||
|
||||
gsk_gpu_color_matrix_op (self->frame,
|
||||
gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, &node->bounds),
|
||||
gsk_gpu_node_processor_color_states_explicit (self, self->ccs, FALSE),
|
||||
self->desc,
|
||||
descriptor,
|
||||
&node->bounds,
|
||||
|
||||
@@ -41,16 +41,15 @@ void
|
||||
run (out vec4 color,
|
||||
out vec2 position)
|
||||
{
|
||||
#if 0
|
||||
vec4 pixel = gsk_texture_straight_alpha (_tex_id, _tex_coord);
|
||||
#else
|
||||
vec4 pixel = gsk_texture (_tex_id, _tex_coord);
|
||||
pixel = color_unpremultiply (pixel);
|
||||
#endif
|
||||
pixel = alt_color_from_output (pixel);
|
||||
|
||||
pixel = _color_matrix * pixel + _color_offset;
|
||||
pixel = clamp (pixel, 0.0, 1.0);
|
||||
|
||||
color = color_premultiply (pixel) * rect_coverage (_rect, _pos);
|
||||
pixel = output_color_from_alt (pixel);
|
||||
|
||||
color = output_color_alpha (pixel, rect_coverage (_rect, _pos));
|
||||
position = _pos;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user