mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 485786. Handle negative and zero erode radii correctly. r=jwatt
This commit is contained in:
parent
68b13a1a71
commit
95cb6389b7
@ -3624,6 +3624,14 @@ nsSVGFEMorphologyElement::Filter(nsSVGFilterInstance *instance,
|
||||
PRInt32 rx, ry;
|
||||
GetRXY(&rx, &ry, *instance);
|
||||
|
||||
if (rx < 0 || ry < 0) {
|
||||
// XXX nsSVGUtils::ReportToConsole()
|
||||
return NS_OK;
|
||||
}
|
||||
if (rx == 0 && ry == 0) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRUint8* sourceData = aSources[0]->mImage->Data();
|
||||
PRUint8* targetData = aTarget->mImage->Data();
|
||||
PRUint32 stride = aTarget->mImage->Stride();
|
||||
@ -3631,10 +3639,6 @@ nsSVGFEMorphologyElement::Filter(nsSVGFilterInstance *instance,
|
||||
PRUint8 extrema[4]; // RGBA magnitude of extrema
|
||||
PRUint16 op = mEnumAttributes[OPERATOR].GetAnimValue();
|
||||
|
||||
if (rx == 0 && ry == 0) {
|
||||
CopyRect(aTarget, aSources[0], rect);
|
||||
return NS_OK;
|
||||
}
|
||||
/* Scan the kernel for each pixel to determine max/min RGBA values. Note that
|
||||
* as we advance in the x direction, each kernel overlaps the previous kernel.
|
||||
* Thus, we can avoid iterating over the entire kernel by comparing the
|
||||
|
@ -0,0 +1,26 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<title>Test 'feMorphology' with a negative value for its 'radius'</title>
|
||||
<!--
|
||||
From https://bugzilla.mozilla.org/show_bug.cgi?id=485786
|
||||
|
||||
The negative value should disable the primitive output, but should
|
||||
not disable the entire filter effect.
|
||||
-->
|
||||
<filter id="f1">
|
||||
<feMorphology operator="erode" radius="-1" result="transparentBlack"/>
|
||||
<feMerge>
|
||||
<feMergeNode in="SourceGraphic"/>
|
||||
<feMergeNode in="transparentBlack"/>
|
||||
</feMerge>
|
||||
</filter>
|
||||
<filter id="f2">
|
||||
<feMorphology operator="erode" radius="-1"/>
|
||||
</filter>
|
||||
<rect width="100%" height="100%" fill="red"/>
|
||||
<rect width="100%" height="100%" fill="lime" filter="url(#f1)"/>
|
||||
<rect width="100%" height="100%" fill="red" filter="url(#f2)"/>
|
||||
</svg>
|
After Width: | Height: | Size: 909 B |
@ -0,0 +1,26 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<title>Test 'feMorphology' with a negative value for its 'radius'</title>
|
||||
<!--
|
||||
From https://bugzilla.mozilla.org/show_bug.cgi?id=485786
|
||||
|
||||
The negative value should disable the primitive output, but should
|
||||
not disable the entire filter effect.
|
||||
-->
|
||||
<filter id="f1">
|
||||
<feMorphology operator="dilate" radius="-1" result="transparentBlack"/>
|
||||
<feMerge>
|
||||
<feMergeNode in="SourceGraphic"/>
|
||||
<feMergeNode in="transparentBlack"/>
|
||||
</feMerge>
|
||||
</filter>
|
||||
<filter id="f2">
|
||||
<feMorphology operator="dilate" radius="-1"/>
|
||||
</filter>
|
||||
<rect width="100%" height="100%" fill="red"/>
|
||||
<rect width="100%" height="100%" fill="lime" filter="url(#f1)"/>
|
||||
<rect width="100%" height="100%" fill="red" filter="url(#f2)"/>
|
||||
</svg>
|
After Width: | Height: | Size: 911 B |
26
layout/reftests/svg/filters/feMorphology-radius-zero-01.svg
Normal file
26
layout/reftests/svg/filters/feMorphology-radius-zero-01.svg
Normal file
@ -0,0 +1,26 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<title>Test 'feMorphology' with a zero value for its 'radius'</title>
|
||||
<!--
|
||||
From https://bugzilla.mozilla.org/show_bug.cgi?id=485786
|
||||
|
||||
The zero value should disable the primitive output, but should
|
||||
not disable the entire filter effect.
|
||||
-->
|
||||
<filter id="f1">
|
||||
<feMorphology operator="erode" radius="0" result="transparentBlack"/>
|
||||
<feMerge>
|
||||
<feMergeNode in="SourceGraphic"/>
|
||||
<feMergeNode in="transparentBlack"/>
|
||||
</feMerge>
|
||||
</filter>
|
||||
<filter id="f2">
|
||||
<feMorphology operator="erode" radius="0"/>
|
||||
</filter>
|
||||
<rect width="100%" height="100%" fill="red"/>
|
||||
<rect width="100%" height="100%" fill="lime" filter="url(#f1)"/>
|
||||
<rect width="100%" height="100%" fill="red" filter="url(#f2)"/>
|
||||
</svg>
|
After Width: | Height: | Size: 899 B |
26
layout/reftests/svg/filters/feMorphology-radius-zero-02.svg
Normal file
26
layout/reftests/svg/filters/feMorphology-radius-zero-02.svg
Normal file
@ -0,0 +1,26 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<title>Test 'feMorphology' with a zero value for its 'radius'</title>
|
||||
<!--
|
||||
From https://bugzilla.mozilla.org/show_bug.cgi?id=485786
|
||||
|
||||
The zero value should disable the primitive output, but should
|
||||
not disable the entire filter effect.
|
||||
-->
|
||||
<filter id="f1">
|
||||
<feMorphology operator="dilate" radius="0" result="transparentBlack"/>
|
||||
<feMerge>
|
||||
<feMergeNode in="SourceGraphic"/>
|
||||
<feMergeNode in="transparentBlack"/>
|
||||
</feMerge>
|
||||
</filter>
|
||||
<filter id="f2">
|
||||
<feMorphology operator="dilate" radius="0"/>
|
||||
</filter>
|
||||
<rect width="100%" height="100%" fill="red"/>
|
||||
<rect width="100%" height="100%" fill="lime" filter="url(#f1)"/>
|
||||
<rect width="100%" height="100%" fill="red" filter="url(#f2)"/>
|
||||
</svg>
|
After Width: | Height: | Size: 901 B |
@ -68,3 +68,8 @@ fails == filter-marked-line-01.svg pass.svg # bug 477704
|
||||
== filter-patterned-rect-02.svg pass.svg
|
||||
|
||||
== feConvolveMatrix-order-01.svg feConvolveMatrix-order-01-ref.svg
|
||||
|
||||
== feMorphology-radius-negative-01.svg pass.svg
|
||||
== feMorphology-radius-negative-02.svg pass.svg
|
||||
== feMorphology-radius-zero-01.svg pass.svg
|
||||
== feMorphology-radius-zero-02.svg pass.svg
|
||||
|
Loading…
Reference in New Issue
Block a user