From 351abadee7899675cc2c5b085b1b56119a1008bb Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 14 Feb 2023 21:46:58 -0500 Subject: [PATCH] Make make not fallback match GL We were not handling the inverted-luminance case the same way, and it caused a test to fail. Yay for tests. --- gsk/gskrendernodeimpl.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c index 819446e88e..c823c8c5c0 100644 --- a/gsk/gskrendernodeimpl.c +++ b/gsk/gskrendernodeimpl.c @@ -3418,7 +3418,7 @@ apply_color_matrix_to_pattern (cairo_pattern_t *pattern, cairo_surface_t *surface, *image_surface; guchar *data; gsize x, y, width, height, stride; - float alpha, orig_alpha; + float alpha; graphene_vec4_t pixel; guint32* pixel_data; @@ -3435,7 +3435,7 @@ apply_color_matrix_to_pattern (cairo_pattern_t *pattern, pixel_data = (guint32 *) data; for (x = 0; x < width; x++) { - alpha = orig_alpha = ((pixel_data[x] >> 24) & 0xFF) / 255.0; + alpha = ((pixel_data[x] >> 24) & 0xFF) / 255.0; if (alpha == 0) { @@ -3451,13 +3451,17 @@ apply_color_matrix_to_pattern (cairo_pattern_t *pattern, graphene_matrix_transform_vec4 (color_matrix, &pixel, &pixel); } + if (multiply_alpha) + graphene_vec4_init (&pixel, + graphene_vec4_get_x (&pixel), + graphene_vec4_get_y (&pixel), + graphene_vec4_get_z (&pixel), + alpha * graphene_vec4_get_w (&pixel)); + graphene_vec4_add (&pixel, color_offset, &pixel); alpha = graphene_vec4_get_w (&pixel); - if (multiply_alpha) - alpha *= orig_alpha; - if (alpha > 0.0) { alpha = MIN (alpha, 1.0);