SVGFEOffsetElement.cpp [plain text]
#include "config.h"
#if ENABLE(SVG) && ENABLE(SVG_FILTERS)
#include "SVGFEOffsetElement.h"
#include "Attr.h"
#include "MappedAttribute.h"
#include "SVGResourceFilter.h"
namespace WebCore {
SVGFEOffsetElement::SVGFEOffsetElement(const QualifiedName& tagName, Document* doc)
: SVGFilterPrimitiveStandardAttributes(tagName, doc)
, m_in1(this, SVGNames::inAttr)
, m_dx(this, SVGNames::dxAttr)
, m_dy(this, SVGNames::dyAttr)
, m_filterEffect(0)
{
}
SVGFEOffsetElement::~SVGFEOffsetElement()
{
}
void SVGFEOffsetElement::parseMappedAttribute(MappedAttribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::dxAttr)
setDxBaseValue(value.toFloat());
else if (attr->name() == SVGNames::dyAttr)
setDyBaseValue(value.toFloat());
else if (attr->name() == SVGNames::inAttr)
setIn1BaseValue(value);
else
SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
}
SVGFilterEffect* SVGFEOffsetElement::filterEffect(SVGResourceFilter* filter) const
{
ASSERT_NOT_REACHED();
return 0;
}
bool SVGFEOffsetElement::build(FilterBuilder* builder)
{
FilterEffect* input1 = builder->getEffectById(in1());
if(!input1)
return false;
builder->add(result(), FEOffset::create(input1, dx(), dy()));
return true;
}
}
#endif // ENABLE(SVG)