summaryrefslogtreecommitdiffstats
path: root/WebCore/svg/SVGFEDiffuseLightingElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/svg/SVGFEDiffuseLightingElement.cpp')
-rw-r--r--WebCore/svg/SVGFEDiffuseLightingElement.cpp62
1 files changed, 34 insertions, 28 deletions
diff --git a/WebCore/svg/SVGFEDiffuseLightingElement.cpp b/WebCore/svg/SVGFEDiffuseLightingElement.cpp
index a3db66d..81144c6 100644
--- a/WebCore/svg/SVGFEDiffuseLightingElement.cpp
+++ b/WebCore/svg/SVGFEDiffuseLightingElement.cpp
@@ -1,20 +1,20 @@
/*
- Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#include "config.h"
@@ -23,15 +23,12 @@
#include "SVGFEDiffuseLightingElement.h"
#include "Attr.h"
-#include "MappedAttribute.h"
-#include "RenderObject.h"
#include "SVGColor.h"
#include "SVGFEDiffuseLighting.h"
#include "SVGFELightElement.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
#include "SVGRenderStyle.h"
-#include "SVGResourceFilter.h"
namespace WebCore {
@@ -49,7 +46,7 @@ SVGFEDiffuseLightingElement::~SVGFEDiffuseLightingElement()
{
}
-void SVGFEDiffuseLightingElement::parseMappedAttribute(MappedAttribute *attr)
+void SVGFEDiffuseLightingElement::parseMappedAttribute(Attribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::inAttr)
@@ -57,7 +54,7 @@ void SVGFEDiffuseLightingElement::parseMappedAttribute(MappedAttribute *attr)
else if (attr->name() == SVGNames::surfaceScaleAttr)
setSurfaceScaleBaseValue(value.toFloat());
else if (attr->name() == SVGNames::diffuseConstantAttr)
- setDiffuseConstantBaseValue(value.toInt());
+ setDiffuseConstantBaseValue(value.toFloat());
else if (attr->name() == SVGNames::kernelUnitLengthAttr) {
float x, y;
if (parseNumberOptionalNumber(value, x, y)) {
@@ -68,6 +65,18 @@ void SVGFEDiffuseLightingElement::parseMappedAttribute(MappedAttribute *attr)
SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
}
+void SVGFEDiffuseLightingElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+ SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName);
+
+ if (attrName == SVGNames::inAttr
+ || attrName == SVGNames::surfaceScaleAttr
+ || attrName == SVGNames::diffuseConstantAttr
+ || attrName == SVGNames::kernelUnitLengthAttr
+ || attrName == SVGNames::lighting_colorAttr)
+ SVGFilterElement::invalidateFilter(this);
+}
+
void SVGFEDiffuseLightingElement::synchronizeProperty(const QualifiedName& attrName)
{
SVGFilterPrimitiveStandardAttributes::synchronizeProperty(attrName);
@@ -93,21 +102,18 @@ void SVGFEDiffuseLightingElement::synchronizeProperty(const QualifiedName& attrN
}
}
-bool SVGFEDiffuseLightingElement::build(SVGResourceFilter* filterResource)
+PassRefPtr<FilterEffect> SVGFEDiffuseLightingElement::build(SVGFilterBuilder* filterBuilder)
{
- FilterEffect* input1 = filterResource->builder()->getEffectById(in1());
+ FilterEffect* input1 = filterBuilder->getEffectById(in1());
if (!input1)
- return false;
+ return 0;
RefPtr<RenderStyle> filterStyle = styleForRenderer();
Color color = filterStyle->svgStyle()->lightingColor();
- RefPtr<FilterEffect> effect = FEDiffuseLighting::create(input1, color, surfaceScale(), diffuseConstant(),
+ return FEDiffuseLighting::create(input1, color, surfaceScale(), diffuseConstant(),
kernelUnitLengthX(), kernelUnitLengthY(), findLights());
- filterResource->addFilterEffect(this, effect.release());
-
- return true;
}
PassRefPtr<LightSource> SVGFEDiffuseLightingElement::findLights() const