Bug 1195788 - Set arithmetic composite clamp to true for D2D filter node. r=bas

This commit is contained in:
Xidorn Quan 2015-12-29 09:48:37 +11:00
parent a797598062
commit 055d6fade6
3 changed files with 20 additions and 0 deletions

View File

@ -575,6 +575,10 @@ FilterNodeD2D1::Create(ID2D1DeviceContext *aDC, FilterType aType)
return nullptr;
}
if (aType == FilterType::ARITHMETIC_COMBINE) {
effect->SetValue(D2D1_ARITHMETICCOMPOSITE_PROP_CLAMP_OUTPUT, TRUE);
}
RefPtr<FilterNodeD2D1> filter = new FilterNodeD2D1(effect, aType);
if (HasUnboundedOutputRegion(aType)) {

View File

@ -4,4 +4,6 @@
<rect x="0" y="0" width="50" height="100" fill="#ff0000" opacity="0.5"/>
<rect x="50" y="0" width="50" height="100" fill="#ff0000" opacity="0.5"/>
<rect x="100" y="0" width="50" height="100" fill="#808080"/>
</svg>

Before

Width:  |  Height:  |  Size: 256 B

After

Width:  |  Height:  |  Size: 318 B

View File

@ -10,4 +10,18 @@
<rect x="50" y="0" width="50" height="100" fill="#00ff00" opacity="0"/>
</g>
<!-- Test that the arithmetic operator actually clamp the result -->
<filter id="f2" filterUnits="userSpaceOnUse" primitiveUnits="userSpaceOnUse" style="color-interpolation-filters:sRGB">
<feFlood flood-color="#ffffff" result="flood" x="100" y="0" width="50" height="100"/>
<feComposite result="c" in="SourceGraphic" in2="flood" operator="arithmetic" k2="1" k3="1"/>
<feComponentTransfer in="c">
<feFuncR type="linear" slope="0.5"/>
<feFuncG type="linear" slope="0.5"/>
<feFuncB type="linear" slope="0.5"/>
</feComponentTransfer>
</filter>
<g filter="url(#f2)">
<rect x="100" y="0" width="50" height="100" fill="#ff0000"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 540 B

After

Width:  |  Height:  |  Size: 1.2 KiB