Bug 630657 - masks should respect color-interpolation. r=jwatt

--HG--
extra : rebase_source : d8ec90b0a18444be4890dbe127a1e0e7d70f9ede
This commit is contained in:
Robert Longson 2011-09-29 15:03:21 +01:00
parent a85e51e02a
commit 8b2778952e
6 changed files with 43 additions and 1 deletions

View File

@ -157,6 +157,7 @@ nsSVGMaskElement::IsAttributeMapped(const nsIAtom* name) const
sFiltersMap,
sFontSpecificationMap,
sGradientStopMap,
sGraphicsMap,
sMarkersMap,
sTextContentElementsMap,
sViewportsMap

View File

@ -0,0 +1,11 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg">
<title>Reference that mask defaults to sRGB</title>
<rect width="100" height="100" x="100" y="100" fill="#FFC0C0"/>
</svg>

After

Width:  |  Height:  |  Size: 290 B

View File

@ -0,0 +1,17 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Testcase that mask defaults to sRGB</title>
<defs>
<mask id="mask" maskContentUnits="objectBoundingBox">
<rect width="1" height="1" fill="#3f3f3f" />
</mask>
</defs>
<rect width="100" height="100" x="100" y="100" mask="url(#mask)" fill="#FF0000"/>
</svg>

After

Width:  |  Height:  |  Size: 492 B

View File

@ -145,6 +145,7 @@ fails == inline-in-xul-basic-01.xul pass.svg
== marker-attribute-01.svg pass.svg
== marker-viewBox-01.svg marker-viewBox-01-ref.svg
== mask-basic-01.svg pass.svg
== mask-basic-02.svg mask-basic-02-ref.svg
== mask-containing-masked-content-01.svg pass.svg
== mask-transformed-01.svg mask-transformed-01-ref.svg
== nested-viewBox-01.svg pass.svg

View File

@ -138,7 +138,10 @@ nsSVGMaskFrame::ComputeMaskAlpha(nsSVGRenderState *aContext,
nsIntRect rect(0, 0, surfaceSize.width, surfaceSize.height);
nsSVGUtils::UnPremultiplyImageDataAlpha(data, stride, rect);
nsSVGUtils::ConvertImageDataToLinearRGB(data, stride, rect);
if (GetStyleSVG()->mColorInterpolation ==
NS_STYLE_COLOR_INTERPOLATION_LINEARRGB) {
nsSVGUtils::ConvertImageDataToLinearRGB(data, stride, rect);
}
for (PRInt32 y = 0; y < surfaceSize.height; y++)
for (PRInt32 x = 0; x < surfaceSize.width; x++) {
@ -160,6 +163,13 @@ nsSVGMaskFrame::ComputeMaskAlpha(nsSVGRenderState *aContext,
return retval;
}
/* virtual */ void
nsSVGMaskFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
{
nsSVGEffects::InvalidateRenderingObservers(this);
nsSVGMaskFrameBase::DidSetStyleContext(aOldStyleContext);
}
NS_IMETHODIMP
nsSVGMaskFrame::AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,

View File

@ -63,6 +63,8 @@ public:
const gfxMatrix &aMatrix,
float aOpacity = 1.0f);
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType);