зеркало из https://github.com/mozilla/pjs.git
Bug 389746 - implement feDisplacementMap. p=tor,longsonr, r=longsonr, sr=roc, a=dsicore
This commit is contained in:
Родитель
f46dcdaa37
Коммит
2a3f7d0181
|
@ -928,6 +928,7 @@ GK_ATOM(zeroDigit, "zero-digit")
|
|||
|
||||
#ifdef MOZ_SVG
|
||||
GK_ATOM(percentage, "%")
|
||||
GK_ATOM(A, "A")
|
||||
GK_ATOM(alignment_baseline, "alignment-baseline")
|
||||
GK_ATOM(altGlyph, "altGlyph")
|
||||
GK_ATOM(altGlyphDef, "altGlyphDef")
|
||||
|
@ -940,6 +941,7 @@ GK_ATOM(animateTransform, "animateTransform")
|
|||
GK_ATOM(arithmetic, "arithmetic")
|
||||
GK_ATOM(atop, "atop")
|
||||
GK_ATOM(azimuth, "azimuth")
|
||||
GK_ATOM(B, "B")
|
||||
GK_ATOM(baseFrequency, "baseFrequency")
|
||||
GK_ATOM(baseline_shift, "baseline-shift")
|
||||
GK_ATOM(bias, "bias")
|
||||
|
@ -1026,6 +1028,7 @@ GK_ATOM(foreignObject, "foreignObject")
|
|||
GK_ATOM(fractalNoise, "fractalNoise")
|
||||
GK_ATOM(fx, "fx")
|
||||
GK_ATOM(fy, "fy")
|
||||
GK_ATOM(G, "G")
|
||||
GK_ATOM(g, "g")
|
||||
GK_ATOM(gamma, "gamma")
|
||||
GK_ATOM(generic, "generic")
|
||||
|
@ -1110,6 +1113,7 @@ GK_ATOM(preserveAspectRatio, "preserveAspectRatio")
|
|||
GK_ATOM(primitiveUnits, "primitiveUnits")
|
||||
GK_ATOM(pt, "pt")
|
||||
GK_ATOM(px, "px")
|
||||
GK_ATOM(R, "R")
|
||||
GK_ATOM(r, "r")
|
||||
GK_ATOM(rad, "rad")
|
||||
GK_ATOM(radialGradient, "radialGradient")
|
||||
|
@ -1174,9 +1178,11 @@ GK_ATOM(word_spacing, "word-spacing")
|
|||
GK_ATOM(x, "x")
|
||||
GK_ATOM(x1, "x1")
|
||||
GK_ATOM(x2, "x2")
|
||||
GK_ATOM(xChannelSelector, "xChannelSelector")
|
||||
GK_ATOM(y, "y")
|
||||
GK_ATOM(y1, "y1")
|
||||
GK_ATOM(y2, "y2")
|
||||
GK_ATOM(yChannelSelector, "yChannelSelector")
|
||||
GK_ATOM(z, "z")
|
||||
GK_ATOM(zoomAndPan, "zoomAndPan")
|
||||
#endif
|
||||
|
|
|
@ -160,7 +160,8 @@ nsresult
|
|||
NS_NewSVGFESpecularLightingElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
|
||||
nsresult
|
||||
NS_NewSVGFEImageElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
nsresult
|
||||
NS_NewSVGFEDisplacementMapElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
nsresult
|
||||
NS_NewSVGElement(nsIContent** aResult, nsINodeInfo *aNodeInfo)
|
||||
|
@ -284,7 +285,7 @@ NS_NewSVGElement(nsIContent** aResult, nsINodeInfo *aNodeInfo)
|
|||
if (name == nsGkAtoms::feImage)
|
||||
return NS_NewSVGFEImageElement(aResult, aNodeInfo);
|
||||
if (name == nsGkAtoms::feDisplacementMap)
|
||||
return NS_NewSVGFEUnimplementedMOZElement(aResult, aNodeInfo);
|
||||
return NS_NewSVGFEDisplacementMapElement(aResult, aNodeInfo);
|
||||
if (name == nsGkAtoms::pattern)
|
||||
return NS_NewSVGPatternElement(aResult, aNodeInfo);
|
||||
if (name == nsGkAtoms::mask)
|
||||
|
|
|
@ -202,7 +202,7 @@ nsSVGFilterResource::AcquireSourceImage(nsIDOMSVGAnimatedString* aIn,
|
|||
nsRefPtr<gfxImageSurface> surface;
|
||||
mInstance->LookupImage(mInput, getter_AddRefs(surface),
|
||||
&mSourceRegion,
|
||||
mFilter->GetColorModel(aIn));
|
||||
mFilter->GetColorModel(mInstance, aIn));
|
||||
if (!surface) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ nsSVGFilterResource::ReleaseTarget()
|
|||
mInstance->DefineImage(mResult,
|
||||
mTargetImage,
|
||||
mFilterSubregion,
|
||||
mFilter->GetColorModel(nsnull));
|
||||
mFilter->GetColorModel(mInstance, nsnull));
|
||||
|
||||
mTargetImage = nsnull;
|
||||
}
|
||||
|
@ -2681,7 +2681,8 @@ public:
|
|||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
protected:
|
||||
virtual PRBool OperatesOnSRGB(nsIDOMSVGAnimatedString*) { return PR_TRUE; }
|
||||
virtual PRBool OperatesOnSRGB(nsSVGFilterInstance*,
|
||||
nsIDOMSVGAnimatedString*) { return PR_TRUE; }
|
||||
|
||||
nsCOMPtr<nsIDOMSVGAnimatedString> mIn1;
|
||||
};
|
||||
|
@ -5221,7 +5222,8 @@ private:
|
|||
void Invalidate();
|
||||
|
||||
protected:
|
||||
virtual PRBool OperatesOnSRGB(nsIDOMSVGAnimatedString*) { return PR_TRUE; }
|
||||
virtual PRBool OperatesOnSRGB(nsSVGFilterInstance*,
|
||||
nsIDOMSVGAnimatedString*) { return PR_TRUE; }
|
||||
|
||||
nsCOMPtr<nsIDOMSVGAnimatedString> mHref;
|
||||
nsCOMPtr<nsIDOMSVGAnimatedPreserveAspectRatio> mPreserveAspectRatio;
|
||||
|
@ -5485,6 +5487,280 @@ nsSVGFEImageElement::Invalidate()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------Displacement------------------------
|
||||
|
||||
typedef nsSVGFE nsSVGFEDisplacementMapElementBase;
|
||||
|
||||
class nsSVGFEDisplacementMapElement : public nsSVGFEDisplacementMapElementBase,
|
||||
public nsIDOMSVGFEDisplacementMapElement,
|
||||
public nsISVGFilter
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGFEDisplacementMapElement(nsIContent **aResult,
|
||||
nsINodeInfo *aNodeInfo);
|
||||
nsSVGFEDisplacementMapElement(nsINodeInfo* aNodeInfo)
|
||||
: nsSVGFEDisplacementMapElementBase(aNodeInfo) {}
|
||||
nsresult Init();
|
||||
|
||||
public:
|
||||
// interfaces:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// FE Base
|
||||
NS_FORWARD_NSIDOMSVGFILTERPRIMITIVESTANDARDATTRIBUTES(nsSVGFEDisplacementMapElementBase::)
|
||||
|
||||
// nsISVGFilter
|
||||
NS_IMETHOD Filter(nsSVGFilterInstance *instance);
|
||||
NS_IMETHOD GetRequirements(PRUint32 *aRequirements);
|
||||
|
||||
// DisplacementMap
|
||||
NS_DECL_NSIDOMSVGFEDISPLACEMENTMAPELEMENT
|
||||
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEDisplacementMapElementBase::)
|
||||
|
||||
NS_FORWARD_NSIDOMNODE(nsSVGFEDisplacementMapElementBase::)
|
||||
NS_FORWARD_NSIDOMELEMENT(nsSVGFEDisplacementMapElementBase::)
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
protected:
|
||||
virtual PRBool OperatesOnSRGB(nsSVGFilterInstance* aInstance,
|
||||
nsIDOMSVGAnimatedString* aString) {
|
||||
if (aString == mIn1) {
|
||||
nsAutoString input;
|
||||
mIn1->GetAnimVal(input);
|
||||
return aInstance->LookupImageColorModel(input).mColorSpace ==
|
||||
nsSVGFilterInstance::ColorModel::SRGB;
|
||||
}
|
||||
|
||||
return nsSVGFEDisplacementMapElementBase::OperatesOnSRGB(aInstance,
|
||||
aString);
|
||||
}
|
||||
|
||||
virtual NumberAttributesInfo GetNumberInfo();
|
||||
virtual EnumAttributesInfo GetEnumInfo();
|
||||
|
||||
enum { SCALE };
|
||||
nsSVGNumber2 mNumberAttributes[1];
|
||||
static NumberInfo sNumberInfo[1];
|
||||
|
||||
enum { CHANNEL_X, CHANNEL_Y };
|
||||
nsSVGEnum mEnumAttributes[2];
|
||||
static nsSVGEnumMapping sChannelMap[];
|
||||
static EnumInfo sEnumInfo[2];
|
||||
|
||||
nsCOMPtr<nsIDOMSVGAnimatedString> mIn1;
|
||||
nsCOMPtr<nsIDOMSVGAnimatedString> mIn2;
|
||||
};
|
||||
|
||||
nsSVGElement::NumberInfo nsSVGFEDisplacementMapElement::sNumberInfo[1] =
|
||||
{
|
||||
{ &nsGkAtoms::scale, 0 },
|
||||
};
|
||||
|
||||
nsSVGEnumMapping nsSVGFEDisplacementMapElement::sChannelMap[] = {
|
||||
{&nsGkAtoms::R, nsSVGFEDisplacementMapElement::SVG_CHANNEL_R},
|
||||
{&nsGkAtoms::G, nsSVGFEDisplacementMapElement::SVG_CHANNEL_G},
|
||||
{&nsGkAtoms::B, nsSVGFEDisplacementMapElement::SVG_CHANNEL_B},
|
||||
{&nsGkAtoms::A, nsSVGFEDisplacementMapElement::SVG_CHANNEL_A},
|
||||
{nsnull, 0}
|
||||
};
|
||||
|
||||
nsSVGElement::EnumInfo nsSVGFEDisplacementMapElement::sEnumInfo[2] =
|
||||
{
|
||||
{ &nsGkAtoms::xChannelSelector,
|
||||
sChannelMap,
|
||||
nsSVGFEDisplacementMapElement::SVG_CHANNEL_A
|
||||
},
|
||||
{ &nsGkAtoms::yChannelSelector,
|
||||
sChannelMap,
|
||||
nsSVGFEDisplacementMapElement::SVG_CHANNEL_A
|
||||
}
|
||||
};
|
||||
|
||||
NS_IMPL_NS_NEW_SVG_ELEMENT(FEDisplacementMap)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsSVGFEDisplacementMapElement,nsSVGFEDisplacementMapElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(nsSVGFEDisplacementMapElement,nsSVGFEDisplacementMapElementBase)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGFEDisplacementMapElement)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNode)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMElement)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGElement)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGFEDisplacementMapElement)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISVGFilter)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGFEDisplacementMapElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsSVGFEDisplacementMapElementBase)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
||||
nsresult
|
||||
nsSVGFEDisplacementMapElement::Init()
|
||||
{
|
||||
nsresult rv = nsSVGFEDisplacementMapElementBase::Init();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// DOM property: in1 , #IMPLIED attrib: in
|
||||
{
|
||||
rv = NS_NewSVGAnimatedString(getter_AddRefs(mIn1));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = AddMappedSVGValue(nsGkAtoms::in, mIn1);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
// DOM property: in2 , #IMPLIED attrib: in2
|
||||
{
|
||||
rv = NS_NewSVGAnimatedString(getter_AddRefs(mIn2));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = AddMappedSVGValue(nsGkAtoms::in2, mIn2);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEDisplacementMapElement)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGFEDisplacementMapElement methods
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedString in1; */
|
||||
NS_IMETHODIMP nsSVGFEDisplacementMapElement::GetIn1(nsIDOMSVGAnimatedString * *aIn)
|
||||
{
|
||||
*aIn = mIn1;
|
||||
NS_IF_ADDREF(*aIn);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedString in2; */
|
||||
NS_IMETHODIMP nsSVGFEDisplacementMapElement::GetIn2(nsIDOMSVGAnimatedString * *aIn)
|
||||
{
|
||||
*aIn = mIn2;
|
||||
NS_IF_ADDREF(*aIn);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedNumber scale; */
|
||||
NS_IMETHODIMP nsSVGFEDisplacementMapElement::GetScale(nsIDOMSVGAnimatedNumber * *aScale)
|
||||
{
|
||||
return mNumberAttributes[SCALE].ToDOMAnimatedNumber(aScale, this);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedEnumeration xChannelSelector; */
|
||||
NS_IMETHODIMP nsSVGFEDisplacementMapElement::GetXChannelSelector(nsIDOMSVGAnimatedEnumeration * *aChannel)
|
||||
{
|
||||
return mEnumAttributes[CHANNEL_X].ToDOMAnimatedEnum(aChannel, this);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedEnumeration yChannelSelector; */
|
||||
NS_IMETHODIMP nsSVGFEDisplacementMapElement::GetYChannelSelector(nsIDOMSVGAnimatedEnumeration * *aChannel)
|
||||
{
|
||||
return mEnumAttributes[CHANNEL_Y].ToDOMAnimatedEnum(aChannel, this);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGFEDisplacementMapElement::Filter(nsSVGFilterInstance *instance)
|
||||
{
|
||||
nsresult rv;
|
||||
PRUint8 *sourceData, *displacementData, *targetData;
|
||||
nsSVGFilterResource fr(this, instance);
|
||||
|
||||
rv = fr.AcquireSourceImage(mIn1, &sourceData);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = fr.AcquireTargetImage(mResult, &targetData);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsRect rect = fr.GetFilterSubregion();
|
||||
PRInt32 stride = fr.GetDataStride();
|
||||
|
||||
#ifdef DEBUG_tor
|
||||
fprintf(stderr, "FILTER DISPLACEMENT rect: %d,%d %dx%d\n",
|
||||
rect.x, rect.y, rect.width, rect.height);
|
||||
#endif
|
||||
|
||||
float scale = mNumberAttributes[SCALE].GetAnimValue();
|
||||
if (scale == 0.0f) {
|
||||
fr.CopySourceImage();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
rv = fr.AcquireSourceImage(mIn2, &displacementData);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 width, height;
|
||||
width = fr.GetWidth();
|
||||
height = fr.GetHeight();
|
||||
|
||||
nsSVGLength2 val;
|
||||
val.Init(nsSVGUtils::XY, 0xff, scale, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER);
|
||||
scale = instance->GetPrimitiveLength(&val);
|
||||
|
||||
static const PRUint16 channelMap[5] = {
|
||||
0,
|
||||
GFX_ARGB32_OFFSET_R,
|
||||
GFX_ARGB32_OFFSET_G,
|
||||
GFX_ARGB32_OFFSET_B,
|
||||
GFX_ARGB32_OFFSET_A };
|
||||
PRUint16 xChannel = channelMap[mEnumAttributes[CHANNEL_X].GetAnimValue()];
|
||||
PRUint16 yChannel = channelMap[mEnumAttributes[CHANNEL_Y].GetAnimValue()];
|
||||
|
||||
double scaleOver255 = scale / 255.0;
|
||||
double scaleAdjustment = 0.5 - 0.5 * scale;
|
||||
|
||||
for (PRInt32 y = rect.y; y < rect.YMost(); y++) {
|
||||
for (PRInt32 x = rect.x; x < rect.XMost(); x++) {
|
||||
PRUint32 targIndex = y * stride + 4 * x;
|
||||
// At some point we might want to replace this with a bilinear sample.
|
||||
PRInt32 sourceX = x +
|
||||
PRInt32(scaleOver255 * displacementData[targIndex + xChannel] +
|
||||
scaleAdjustment);
|
||||
PRInt32 sourceY = y +
|
||||
PRInt32(scaleOver255 * displacementData[targIndex + yChannel] +
|
||||
scaleAdjustment);
|
||||
if (sourceX < 0 || sourceX >= width ||
|
||||
sourceY < 0 || sourceY >= height) {
|
||||
*(PRUint32*)(targetData + targIndex) = 0;
|
||||
} else {
|
||||
*(PRUint32*)(targetData + targIndex) =
|
||||
*(PRUint32*)(sourceData + sourceY * stride + 4 * sourceX);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGFEDisplacementMapElement::GetRequirements(PRUint32 *aRequirements)
|
||||
{
|
||||
*aRequirements = CheckStandardNames(mIn1) | CheckStandardNames(mIn2);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
nsSVGElement::NumberAttributesInfo
|
||||
nsSVGFEDisplacementMapElement::GetNumberInfo()
|
||||
{
|
||||
return NumberAttributesInfo(mNumberAttributes, sNumberInfo,
|
||||
NS_ARRAY_LENGTH(sNumberInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::EnumAttributesInfo
|
||||
nsSVGFEDisplacementMapElement::GetEnumInfo()
|
||||
{
|
||||
return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
|
||||
NS_ARRAY_LENGTH(sEnumInfo));
|
||||
}
|
||||
|
||||
//---------------------UnimplementedMOZ------------------------
|
||||
|
||||
typedef nsSVGFE nsSVGFEUnimplementedMOZElementBase;
|
||||
|
|
|
@ -76,9 +76,9 @@ protected:
|
|||
|
||||
public:
|
||||
nsSVGFilterInstance::ColorModel
|
||||
GetColorModel(nsIDOMSVGAnimatedString* aIn) {
|
||||
GetColorModel(nsSVGFilterInstance* aInstance, nsIDOMSVGAnimatedString* aIn) {
|
||||
return nsSVGFilterInstance::ColorModel (
|
||||
(OperatesOnSRGB(aIn) ?
|
||||
(OperatesOnSRGB(aInstance, aIn) ?
|
||||
nsSVGFilterInstance::ColorModel::SRGB :
|
||||
nsSVGFilterInstance::ColorModel::LINEAR_RGB),
|
||||
(OperatesOnPremultipledAlpha() ?
|
||||
|
@ -96,7 +96,8 @@ public:
|
|||
protected:
|
||||
virtual PRBool OperatesOnPremultipledAlpha() { return PR_TRUE; }
|
||||
|
||||
virtual PRBool OperatesOnSRGB(nsIDOMSVGAnimatedString*) {
|
||||
virtual PRBool OperatesOnSRGB(nsSVGFilterInstance*,
|
||||
nsIDOMSVGAnimatedString*) {
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
if (!frame) return PR_FALSE;
|
||||
|
||||
|
|
|
@ -311,6 +311,23 @@ interface nsIDOMSVGFEImageElement : nsIDOMSVGFilterPrimitiveStandardAttributes
|
|||
{
|
||||
};
|
||||
|
||||
[scriptable, uuid(80e1ea9c-eff3-490a-8c98-918963d2e7e9)]
|
||||
interface nsIDOMSVGFEDisplacementMapElement : nsIDOMSVGFilterPrimitiveStandardAttributes
|
||||
{
|
||||
// Channel Selectors
|
||||
const unsigned short SVG_CHANNEL_UNKNOWN = 0;
|
||||
const unsigned short SVG_CHANNEL_R = 1;
|
||||
const unsigned short SVG_CHANNEL_G = 2;
|
||||
const unsigned short SVG_CHANNEL_B = 3;
|
||||
const unsigned short SVG_CHANNEL_A = 4;
|
||||
|
||||
readonly attribute nsIDOMSVGAnimatedString in1;
|
||||
readonly attribute nsIDOMSVGAnimatedString in2;
|
||||
readonly attribute nsIDOMSVGAnimatedNumber scale;
|
||||
readonly attribute nsIDOMSVGAnimatedEnumeration xChannelSelector;
|
||||
readonly attribute nsIDOMSVGAnimatedEnumeration yChannelSelector;
|
||||
};
|
||||
|
||||
[scriptable, uuid(8698c635-26c7-468b-905e-494e8825d56b)]
|
||||
interface nsIDOMSVGFEUnimplementedMOZElement : nsIDOMSVGFilterPrimitiveStandardAttributes
|
||||
{
|
||||
|
|
|
@ -247,12 +247,13 @@ enum nsDOMClassInfoID {
|
|||
eDOMClassInfo_SVGDescElement_id,
|
||||
eDOMClassInfo_SVGEllipseElement_id,
|
||||
eDOMClassInfo_SVGFEBlendElement_id,
|
||||
eDOMClassInfo_SVGFEDiffuseLightingElement_id,
|
||||
eDOMClassInfo_SVGFEDistantLightElement_id,
|
||||
eDOMClassInfo_SVGFEColorMatrixElement_id,
|
||||
eDOMClassInfo_SVGFEComponentTransferElement_id,
|
||||
eDOMClassInfo_SVGFECompositeElement_id,
|
||||
eDOMClassInfo_SVGFEConvolveMatrixElement_id,
|
||||
eDOMClassInfo_SVGFEDiffuseLightingElement_id,
|
||||
eDOMClassInfo_SVGFEDisplacementMapElement_id,
|
||||
eDOMClassInfo_SVGFEDistantLightElement_id,
|
||||
eDOMClassInfo_SVGFEFloodElement_id,
|
||||
eDOMClassInfo_SVGFEFuncAElement_id,
|
||||
eDOMClassInfo_SVGFEFuncBElement_id,
|
||||
|
|
|
@ -920,10 +920,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGFEBlendElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGFEDiffuseLightingElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGFEDistantLightElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGFEColorMatrixElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGFEComponentTransferElement, nsElementSH,
|
||||
|
@ -932,6 +928,12 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGFEConvolveMatrixElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGFEDiffuseLightingElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGFEDisplacementMapElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGFEDistantLightElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGFEFloodElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGFEFuncAElement, nsElementSH,
|
||||
|
@ -2676,18 +2678,6 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(SVGFEDiffuseLightingElement, nsIDOMSVGFEDiffuseLightingElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEDiffuseLightingElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
|
||||
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(SVGFEDistantLightElement, nsIDOMSVGFEDistantLightElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEDistantLightElement)
|
||||
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(SVGFEColorMatrixElement, nsIDOMSVGFEColorMatrixElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEColorMatrixElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
|
||||
|
@ -2716,6 +2706,25 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(SVGFEDiffuseLightingElement, nsIDOMSVGFEDiffuseLightingElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEDiffuseLightingElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
|
||||
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(SVGFEDisplacementMapElement, nsIDOMSVGFEDisplacementMapElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEDisplacementMapElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
|
||||
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(SVGFEDistantLightElement, nsIDOMSVGFEDistantLightElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEDistantLightElement)
|
||||
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(SVGFEFloodElement, nsIDOMSVGFEFloodElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEFloodElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
|
||||
|
|
|
@ -554,6 +554,27 @@ nsSVGFilterInstance::LookupImage(const nsAString &aName,
|
|||
}
|
||||
}
|
||||
|
||||
nsSVGFilterInstance::ColorModel
|
||||
nsSVGFilterInstance::LookupImageColorModel(const nsAString &aName)
|
||||
{
|
||||
ImageEntry *entry;
|
||||
|
||||
if (aName.IsEmpty())
|
||||
entry = mLastImage;
|
||||
else
|
||||
mImageDictionary.Get(aName, &entry);
|
||||
|
||||
if (entry)
|
||||
return entry->mColorModel;
|
||||
|
||||
// We'll reach this point if someone specifies a nonexistent input
|
||||
// for a filter, as feDisplacementMap need to find the color model
|
||||
// before the filter element calls AcquireSourceImage() which both
|
||||
// uses the color model and tells us if the input exists.
|
||||
|
||||
return ColorModel(ColorModel::SRGB, ColorModel::PREMULTIPLIED);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFilterInstance::DefineImage(const nsAString &aName,
|
||||
gfxImageSurface *aImage,
|
||||
|
|
|
@ -80,6 +80,7 @@ public:
|
|||
gfxImageSurface **aImage,
|
||||
nsRect *aRegion,
|
||||
const ColorModel &aColorModel);
|
||||
ColorModel LookupImageColorModel(const nsAString &aName);
|
||||
void DefineImage(const nsAString &aName,
|
||||
gfxImageSurface *aImage,
|
||||
const nsRect &aRegion,
|
||||
|
|
Загрузка…
Ссылка в новой задаче