diff --git a/gsk/gpu/gskgpucolormatrixop.c b/gsk/gpu/gskgpucolormatrixop.c index 0e6128abe4..fd39191c69 100644 --- a/gsk/gpu/gskgpucolormatrixop.c +++ b/gsk/gpu/gskgpucolormatrixop.c @@ -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, diff --git a/gsk/gpu/gskgpucolormatrixopprivate.h b/gsk/gpu/gskgpucolormatrixopprivate.h index a2eb5cea20..c8a53d8cc2 100644 --- a/gsk/gpu/gskgpucolormatrixopprivate.h +++ b/gsk/gpu/gskgpucolormatrixopprivate.h @@ -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, diff --git a/gsk/gpu/gskgpunodeprocessor.c b/gsk/gpu/gskgpunodeprocessor.c index d589766471..36614ef636 100644 --- a/gsk/gpu/gskgpunodeprocessor.c +++ b/gsk/gpu/gskgpunodeprocessor.c @@ -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, diff --git a/gsk/gpu/shaders/gskgpucolormatrix.glsl b/gsk/gpu/shaders/gskgpucolormatrix.glsl index 0b9d428103..9955c924e5 100644 --- a/gsk/gpu/shaders/gskgpucolormatrix.glsl +++ b/gsk/gpu/shaders/gskgpucolormatrix.glsl @@ -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; }