gfx/cairo/premultiply-alpha-solid-gradients.patch
author Sylvestre Ledru <sledru@mozilla.com>
Thu, 12 Oct 2017 15:22:59 +0200
changeset 385816 d14dd0e5c41a54d4c5a82d7c82245c03854e5b5e
parent 37125 4b725bb53baada5ccecf0c37c51042f821413743
permissions -rw-r--r--
Bug 1406668 - Make build/moz.configure/*.configure compliant to the pep8 format + add to the list of directories to check r=glandium MozReview-Commit-ID: 89NxxGUVjHV

Fix single and multi-stop solid gradients by multiplying by the alpha component. r=roc

This cairo commit that caused the problem: 2d790daa957471670f4ae0d3b22da89e4ee7111f.
It was merged into mozilla-central with 1effb72d30cf

diff --git a/gfx/cairo/cairo/src/cairo-pattern.c b/gfx/cairo/cairo/src/cairo-pattern.c
--- a/gfx/cairo/cairo/src/cairo-pattern.c
+++ b/gfx/cairo/cairo/src/cairo-pattern.c
@@ -2262,8 +2262,17 @@ _cairo_pattern_acquire_surface (const ca
 
 	    if (src->n_stops)
 	    {
+		cairo_color_t color;
+
+		/* multiply by alpha */
+		_cairo_color_init_rgba (&color,
+			src->stops->color.red,
+			src->stops->color.green,
+			src->stops->color.blue,
+			src->stops->color.alpha);
+
 		_cairo_pattern_init_solid (&solid,
-					   &src->stops->color,
+					   &color,
 					   CAIRO_CONTENT_COLOR_ALPHA);
 	    }
 	    else
@@ -2295,9 +2304,17 @@ _cairo_pattern_acquire_surface (const ca
 	    }
 	    if (i == src->n_stops) {
 		cairo_solid_pattern_t solid;
+		cairo_color_t color;
+
+		/* multiply by alpha */
+		_cairo_color_init_rgba (&color,
+			src->stops->color.red,
+			src->stops->color.green,
+			src->stops->color.blue,
+			src->stops->color.alpha);
 
 		_cairo_pattern_init_solid (&solid,
-					   &src->stops->color,
+					   &color,
 					   CAIRO_CONTENT_COLOR_ALPHA);
 
 		status =