Bug 1343436 - Fix filter result for baseFrequency="0" type="fractalNoise". r=longsonr+218550

MozReview-Commit-ID: LLAr9ifux98

--HG--
extra : rebase_source : 7e70fa361b2377ba180f96862d19ce22a2725438
This commit is contained in:
Markus Stange 2017-03-01 10:03:15 -05:00
Родитель 776140ce79
Коммит fa5619d298
4 изменённых файлов: 45 добавлений и 1 удалений

Просмотреть файл

@ -133,7 +133,14 @@ SVGFETurbulenceElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
uint16_t stitch = mEnumAttributes[STITCHTILES].GetAnimValue();
if (fX == 0 || fY == 0) {
return FilterPrimitiveDescription(PrimitiveType::Empty);
// A base frequency of zero results in transparent black for
// type="turbulence" and in 50% alpha 50% gray for type="fractalNoise".
if (type == SVG_TURBULENCE_TYPE_TURBULENCE) {
return FilterPrimitiveDescription(PrimitiveType::Empty);
}
FilterPrimitiveDescription descr(PrimitiveType::Flood);
descr.Attributes().Set(eFloodColor, Color(0.5, 0.5, 0.5, 0.5));
return descr;
}
// We interpret the base frequency as relative to user space units. In other

Просмотреть файл

@ -0,0 +1,13 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!--
This is the reference image for feTurbulence-zero-baseFreq.svg.
-->
<svg xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="400" height="100" fill="blue"/>
<rect x="0" y="100" width="400" height="100" fill="lime"/>
<!-- nothing in place of the type="turbulence" filter -->
<rect x="200" y="50" width="100" height="100" fill="rgba(128, 128, 128, 0.5)"/>
</svg>

После

Ширина:  |  Высота:  |  Размер: 506 B

Просмотреть файл

@ -0,0 +1,23 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!--
This test verifies that feTurbulence with baseFrequency="0" creates
a transparent black result for type="turbulence" and a 50% alpha
50% gray result for type="fractalNoise".
-->
<svg xmlns="http://www.w3.org/2000/svg">
<filter id="filterTurbulence" primitiveUnits="objectBoundingBox" color-interpolation-filters="sRGB">
<feTurbulence type="turbulence" baseFrequency="0" numOctaves="1"
x="0%" y="0%" width="100%" height="100%"/>
</filter>
<filter id="filterFractalNoise" primitiveUnits="objectBoundingBox" color-interpolation-filters="sRGB">
<feTurbulence type="fractalNoise" baseFrequency="0" numOctaves="1"
x="0%" y="0%" width="100%" height="100%"/>
</filter>
<rect x="0" y="0" width="400" height="100" fill="blue"/>
<rect x="0" y="100" width="400" height="100" fill="lime"/>
<rect x="50" y="50" width="100" height="100" filter="url(#filterTurbulence)"/>
<rect x="200" y="50" width="100" height="100" filter="url(#filterFractalNoise)"/>
</svg>

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Просмотреть файл

@ -119,6 +119,7 @@ fuzzy(2,2659) skip-if(d2d) == feSpecularLighting-1.svg feSpecularLighting-1-ref.
== fePointLight-zoomed-page.svg fePointLight-zoomed-page-ref.svg
== feTurbulence-offset.svg feTurbulence-offset-ref.svg
fuzzy(1,10000) == feTurbulence-zero-baseFreq.svg feTurbulence-zero-baseFreq-ref.svg
== outside-sourcegraphic-1.svg outside-sourcegraphic-ref.svg
== outside-sourcegraphic-2.svg outside-sourcegraphic-ref.svg