Bug 1577566 - Enforce appropriate output channel clamping in D2D1 ColorMatrix filters. r=bas

Differential Revision: https://phabricator.services.mozilla.com/D45142

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Markus Stange 2019-10-09 15:38:21 +00:00
parent afdeed7927
commit f2eaddfc8f
4 changed files with 57 additions and 0 deletions

View File

@ -648,6 +648,9 @@ already_AddRefed<FilterNode> FilterNodeD2D1::Create(ID2D1DeviceContext* aDC,
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);

View File

@ -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>

View File

@ -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>

View File

@ -2111,4 +2111,5 @@ fuzzy-if(!webrender||!winWidget,251-255,464-1613) fuzzy-if(geckoview&&webrender,
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