Make make not fallback match GL
authorMatthias Clasen <mclasen@redhat.com>
Wed, 15 Feb 2023 02:46:58 +0000 (21:46 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 15 Feb 2023 02:47:54 +0000 (21:47 -0500)
We were not handling the inverted-luminance
case the same way, and it caused a test to
fail. Yay for tests.

gsk/gskrendernodeimpl.c

index 819446e88e09deae529dcadfed989272518e9cee..c823c8c5c0cd2304d0ccdec66959c1a693976bc3 100644 (file)
@@ -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);