gecko-dev/gfx/cairo/quartz-mask-non-OVER.patch

81 lines
2.9 KiB
Diff
Raw Normal View History

From: Robert O'Callahan <robert@ocallahan.org>
Bug 579985. Using CGContextSetAlpha to implement mask alpha doesn't work for some operators. r=jrmuizel,a=blocking
diff --git a/gfx/cairo/cairo/src/cairo-quartz-surface.c b/gfx/cairo/cairo/src/cairo-quartz-surface.c
--- a/gfx/cairo/cairo/src/cairo-quartz-surface.c
+++ b/gfx/cairo/cairo/src/cairo-quartz-surface.c
@@ -2734,17 +2734,19 @@ _cairo_quartz_surface_mask (void *abstra
if (IS_EMPTY(surface))
return CAIRO_STATUS_SUCCESS;
rv = _cairo_surface_clipper_set_clip (&surface->clipper, clip);
if (unlikely (rv))
return rv;
- if (mask->type == CAIRO_PATTERN_TYPE_SOLID) {
+ /* Using CGContextSetAlpha to implement mask alpha doesn't work for all operators. */
+ if (mask->type == CAIRO_PATTERN_TYPE_SOLID &&
+ op == CAIRO_OPERATOR_OVER) {
/* This is easy; we just need to paint with the alpha. */
cairo_solid_pattern_t *solid_mask = (cairo_solid_pattern_t *) mask;
CGContextSetAlpha (surface->cgContext, solid_mask->color.alpha);
rv = _cairo_quartz_surface_paint (surface, op, source, clip);
CGContextSetAlpha (surface->cgContext, 1.0);
return rv;
diff --git a/layout/reftests/bugs/579985-1-ref.html b/layout/reftests/bugs/579985-1-ref.html
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/579985-1-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<div style="width:100px; height:100px; background:blue; opacity:0.5;">Hello</div>
+</body>
+</html>
diff --git a/layout/reftests/bugs/579985-1.html b/layout/reftests/bugs/579985-1.html
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/579985-1.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<head>
+<script>
+function doTest() {
+ var d = document.getElementById("d");
+ d.style.opacity = 0.75;
+ document.documentElement.removeAttribute("class");
+}
+window.addEventListener("MozReftestInvalidate", doTest, false);
+</script>
+</head>
+<body>
+<div id="d" style="width:100px; height:100px; background:blue;">Hello</div>
+</body>
+</html>
diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1499,16 +1499,17 @@ random-if(layersGPUAccelerated) == 56499
== 571347-3.html 571347-3-ref.html
== 572598-1.html 572598-ref.html
== 574898-1.html 574898-ref.html
== 579655-1.html 579655-1-ref.html
== 577838-1.html 577838-1-ref.html
== 577838-2.html 577838-2-ref.html
random-if(layersGPUAccelerated) == 579323-1.html 579323-1-ref.html
== 579349-1.html 579349-1-ref.html
+== 579985-1.html 579985-1-ref.html
== 580160-1.html 580160-1-ref.html
HTTP(..) == 580863-1.html 580863-1-ref.html
random-if(layersGPUAccelerated) == 581317-1.html 581317-1-ref.html
== 581579-1.html 581579-1-ref.html
== 582037-1a.html 582037-1-ref.html
== 582037-1b.html 582037-1-ref.html
== 582037-2a.html 582037-2-ref.html
== 582037-2b.html 582037-2-ref.html