Bug 1577566 - Enforce appropriate output channel clamping in D2D1 ColorMatrix filters. r=bas
authorMarkus Stange <mstange@themasta.com>
Wed, 09 Oct 2019 15:38:21 +0000
changeset 497003 672050b0b4fd1ec8ce024d384d187e20060627d7
parent 497002 479097530e46f2ee9aa1420d0283979582117e0a
child 497004 f33ba9f39ad0caf032555c0a98d1458ba53811cc
push id36674
push userccoroiu@mozilla.com
push dateThu, 10 Oct 2019 09:26:37 +0000
treeherdermozilla-central@f20fa8068ec2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbas
bugs1577566
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1577566 - Enforce appropriate output channel clamping in D2D1 ColorMatrix filters. r=bas Differential Revision: https://phabricator.services.mozilla.com/D45142
gfx/2d/FilterNodeD2D1.cpp
layout/reftests/bugs/1577566-1-ref.html
layout/reftests/bugs/1577566-1.html
layout/reftests/bugs/reftest.list
--- a/gfx/2d/FilterNodeD2D1.cpp
+++ b/gfx/2d/FilterNodeD2D1.cpp
@@ -643,16 +643,19 @@ already_AddRefed<FilterNode> FilterNodeD
     filter = new FilterNodePremultiplyAdapterD2D1(aDC, filter, aType);
   }
 
   return filter.forget();
 }
 
 void FilterNodeD2D1::InitUnmappedProperties() {
   switch (mType) {
+    case FilterType::COLOR_MATRIX:
+      mEffect->SetValue(D2D1_COLORMATRIX_PROP_CLAMP_OUTPUT, TRUE);
+      break;
     case FilterType::TRANSFORM:
       mEffect->SetValue(D2D1_2DAFFINETRANSFORM_PROP_BORDER_MODE,
                         D2D1_BORDER_MODE_HARD);
       break;
     default:
       break;
   }
 }
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1577566-1-ref.html
@@ -0,0 +1,20 @@
+<!--
+     Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8">
+<title>Bug 1577566, reference: The alpha channel should be clamped at the right time so that it doesn't bright colors.</title>
+
+<style>
+
+#box {
+  width: 100px;
+  height: 100px;
+  background-color: rgb(0, 204, 0); /* 0, 0.8, 0 */
+}
+
+</style>
+
+<div id="box"></div>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1577566-1.html
@@ -0,0 +1,33 @@
+<!--
+     Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8">
+<title>Bug 1577566: The alpha channel should be clamped at the right time so that it doesn't bright colors.</title>
+
+<style>
+
+#box {
+  width: 100px;
+  height: 100px;
+  background-color: black;
+  filter: url(#filter);
+}
+
+</style>
+
+<div id="box"></div>
+
+<svg height="0">
+  <defs>
+    <filter id="filter" color-interpolation-filters="sRGB">
+      <feColorMatrix type="matrix"
+                     values="0 0 0 0 0
+                             0 0 0 0 0.8
+                             0 0 0 0 0
+                             0 0 0 2 0"/>
+    </filter>
+  </defs>
+</svg>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -2106,9 +2106,10 @@ skip-if(!asyncPan) == 1544895.html 15448
 pref(image.downscale-during-decode.enabled,true) == 1553571-1.html 1553571-1-ref.html
 == 1558937-1.html 1558937-1-ref.html
 != 1563484.html 1563484-notref.html
 == 1563484.html 1563484-ref.html
 fuzzy-if(!webrender||!winWidget,251-255,464-1613) fuzzy-if(geckoview&&webrender,251-253,1392-1401) == 1562733-rotated-nastaliq-1.html 1562733-rotated-nastaliq-1-ref.html
 fuzzy-if(winWidget&&webrender,0-31,0-3) fuzzy-if(geckoview&&webrender,0-93,0-87) == 1562733-rotated-nastaliq-2.html 1562733-rotated-nastaliq-2-ref.html
 test-pref(plain_text.wrap_long_lines,false) != 1565129.txt 1565129.txt
 fuzzy(0-32,0-8) fuzzy-if(Android&&webrender,0-32,0-1458) == 1576553-1.html 1576553-1-ref.html
+fuzzy(0-1,0-10000) == 1577566-1.html 1577566-1-ref.html
 == 1579953-2.html 1579953-2-ref.html