| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 template<> const SVGEnumerationStringEntries& getStaticStringEntries<TurbulenceT
ype>() | 40 template<> const SVGEnumerationStringEntries& getStaticStringEntries<TurbulenceT
ype>() |
| 41 { | 41 { |
| 42 DEFINE_STATIC_LOCAL(SVGEnumerationStringEntries, entries, ()); | 42 DEFINE_STATIC_LOCAL(SVGEnumerationStringEntries, entries, ()); |
| 43 if (entries.isEmpty()) { | 43 if (entries.isEmpty()) { |
| 44 entries.append(std::make_pair(FETURBULENCE_TYPE_FRACTALNOISE, "fractalNo
ise")); | 44 entries.append(std::make_pair(FETURBULENCE_TYPE_FRACTALNOISE, "fractalNo
ise")); |
| 45 entries.append(std::make_pair(FETURBULENCE_TYPE_TURBULENCE, "turbulence"
)); | 45 entries.append(std::make_pair(FETURBULENCE_TYPE_TURBULENCE, "turbulence"
)); |
| 46 } | 46 } |
| 47 return entries; | 47 return entries; |
| 48 } | 48 } |
| 49 | 49 |
| 50 SVGFETurbulenceElement::SVGFETurbulenceElement(Document& document) | 50 inline SVGFETurbulenceElement::SVGFETurbulenceElement(Document& document) |
| 51 : SVGFilterPrimitiveStandardAttributes(SVGNames::feTurbulenceTag, document) | 51 : SVGFilterPrimitiveStandardAttributes(SVGNames::feTurbulenceTag, document) |
| 52 , m_baseFrequency(SVGAnimatedNumberOptionalNumber::create(this, SVGNames::ba
seFrequencyAttr)) | 52 , m_baseFrequency(SVGAnimatedNumberOptionalNumber::create(this, SVGNames::ba
seFrequencyAttr)) |
| 53 , m_seed(SVGAnimatedNumber::create(this, SVGNames::seedAttr, SVGNumber::crea
te(0))) | 53 , m_seed(SVGAnimatedNumber::create(this, SVGNames::seedAttr, SVGNumber::crea
te(0))) |
| 54 , m_stitchTiles(SVGAnimatedEnumeration<SVGStitchOptions>::create(this, SVGNa
mes::stitchTilesAttr, SVG_STITCHTYPE_NOSTITCH)) | 54 , m_stitchTiles(SVGAnimatedEnumeration<SVGStitchOptions>::create(this, SVGNa
mes::stitchTilesAttr, SVG_STITCHTYPE_NOSTITCH)) |
| 55 , m_type(SVGAnimatedEnumeration<TurbulenceType>::create(this, SVGNames::type
Attr, FETURBULENCE_TYPE_TURBULENCE)) | 55 , m_type(SVGAnimatedEnumeration<TurbulenceType>::create(this, SVGNames::type
Attr, FETURBULENCE_TYPE_TURBULENCE)) |
| 56 , m_numOctaves(SVGAnimatedInteger::create(this, SVGNames::numOctavesAttr, SV
GInteger::create(1))) | 56 , m_numOctaves(SVGAnimatedInteger::create(this, SVGNames::numOctavesAttr, SV
GInteger::create(1))) |
| 57 { | 57 { |
| 58 ScriptWrappable::init(this); | 58 ScriptWrappable::init(this); |
| 59 | 59 |
| 60 addToPropertyMap(m_baseFrequency); | 60 addToPropertyMap(m_baseFrequency); |
| 61 addToPropertyMap(m_seed); | 61 addToPropertyMap(m_seed); |
| 62 addToPropertyMap(m_stitchTiles); | 62 addToPropertyMap(m_stitchTiles); |
| 63 addToPropertyMap(m_type); | 63 addToPropertyMap(m_type); |
| 64 addToPropertyMap(m_numOctaves); | 64 addToPropertyMap(m_numOctaves); |
| 65 } | 65 } |
| 66 | 66 |
| 67 DEFINE_NODE_FACTORY(SVGFETurbulenceElement) |
| 68 |
| 67 bool SVGFETurbulenceElement::isSupportedAttribute(const QualifiedName& attrName) | 69 bool SVGFETurbulenceElement::isSupportedAttribute(const QualifiedName& attrName) |
| 68 { | 70 { |
| 69 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 71 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 70 if (supportedAttributes.isEmpty()) { | 72 if (supportedAttributes.isEmpty()) { |
| 71 supportedAttributes.add(SVGNames::baseFrequencyAttr); | 73 supportedAttributes.add(SVGNames::baseFrequencyAttr); |
| 72 supportedAttributes.add(SVGNames::numOctavesAttr); | 74 supportedAttributes.add(SVGNames::numOctavesAttr); |
| 73 supportedAttributes.add(SVGNames::seedAttr); | 75 supportedAttributes.add(SVGNames::seedAttr); |
| 74 supportedAttributes.add(SVGNames::stitchTilesAttr); | 76 supportedAttributes.add(SVGNames::stitchTilesAttr); |
| 75 supportedAttributes.add(SVGNames::typeAttr); | 77 supportedAttributes.add(SVGNames::typeAttr); |
| 76 } | 78 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 147 } |
| 146 | 148 |
| 147 PassRefPtr<FilterEffect> SVGFETurbulenceElement::build(SVGFilterBuilder*, Filter
* filter) | 149 PassRefPtr<FilterEffect> SVGFETurbulenceElement::build(SVGFilterBuilder*, Filter
* filter) |
| 148 { | 150 { |
| 149 if (baseFrequencyX()->currentValue()->value() < 0 || baseFrequencyY()->curre
ntValue()->value() < 0) | 151 if (baseFrequencyX()->currentValue()->value() < 0 || baseFrequencyY()->curre
ntValue()->value() < 0) |
| 150 return nullptr; | 152 return nullptr; |
| 151 return FETurbulence::create(filter, m_type->currentValue()->enumValue(), bas
eFrequencyX()->currentValue()->value(), baseFrequencyY()->currentValue()->value(
), m_numOctaves->currentValue()->value(), m_seed->currentValue()->value(), m_sti
tchTiles->currentValue()->enumValue() == SVG_STITCHTYPE_STITCH); | 153 return FETurbulence::create(filter, m_type->currentValue()->enumValue(), bas
eFrequencyX()->currentValue()->value(), baseFrequencyY()->currentValue()->value(
), m_numOctaves->currentValue()->value(), m_seed->currentValue()->value(), m_sti
tchTiles->currentValue()->enumValue() == SVG_STITCHTYPE_STITCH); |
| 152 } | 154 } |
| 153 | 155 |
| 154 } | 156 } |
| OLD | NEW |