| 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 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 #include "core/SVGNames.h" | 23 #include "core/SVGNames.h" |
| 24 #include "core/svg/SVGParserUtilities.h" | 24 #include "core/svg/SVGParserUtilities.h" |
| 25 | 25 |
| 26 namespace blink { | 26 namespace blink { |
| 27 | 27 |
| 28 template<> const SVGEnumerationStringEntries& getStaticStringEntries<SVGStitchOp
tions>() | 28 template<> const SVGEnumerationStringEntries& getStaticStringEntries<SVGStitchOp
tions>() |
| 29 { | 29 { |
| 30 DEFINE_STATIC_LOCAL(SVGEnumerationStringEntries, entries, ()); | 30 DEFINE_STATIC_LOCAL(SVGEnumerationStringEntries, entries, ()); |
| 31 if (entries.isEmpty()) { | 31 if (entries.isEmpty()) { |
| 32 entries.append(std::make_pair(SVG_STITCHTYPE_STITCH, "stitch")); | 32 entries.append(std::make_pair(kSvgStitchtypeStitch, "stitch")); |
| 33 entries.append(std::make_pair(SVG_STITCHTYPE_NOSTITCH, "noStitch")); | 33 entries.append(std::make_pair(kSvgStitchtypeNostitch, "noStitch")); |
| 34 } | 34 } |
| 35 return entries; | 35 return entries; |
| 36 } | 36 } |
| 37 | 37 |
| 38 template<> const SVGEnumerationStringEntries& getStaticStringEntries<TurbulenceT
ype>() | 38 template<> const SVGEnumerationStringEntries& getStaticStringEntries<TurbulenceT
ype>() |
| 39 { | 39 { |
| 40 DEFINE_STATIC_LOCAL(SVGEnumerationStringEntries, entries, ()); | 40 DEFINE_STATIC_LOCAL(SVGEnumerationStringEntries, entries, ()); |
| 41 if (entries.isEmpty()) { | 41 if (entries.isEmpty()) { |
| 42 entries.append(std::make_pair(FETURBULENCE_TYPE_FRACTALNOISE, "fractalNo
ise")); | 42 entries.append(std::make_pair(FETURBULENCE_TYPE_FRACTALNOISE, "fractalNo
ise")); |
| 43 entries.append(std::make_pair(FETURBULENCE_TYPE_TURBULENCE, "turbulence"
)); | 43 entries.append(std::make_pair(FETURBULENCE_TYPE_TURBULENCE, "turbulence"
)); |
| 44 } | 44 } |
| 45 return entries; | 45 return entries; |
| 46 } | 46 } |
| 47 | 47 |
| 48 inline SVGFETurbulenceElement::SVGFETurbulenceElement(Document& document) | 48 inline SVGFETurbulenceElement::SVGFETurbulenceElement(Document& document) |
| 49 : SVGFilterPrimitiveStandardAttributes(SVGNames::feTurbulenceTag, document) | 49 : SVGFilterPrimitiveStandardAttributes(SVGNames::feTurbulenceTag, document) |
| 50 , m_baseFrequency(SVGAnimatedNumberOptionalNumber::create(this, SVGNames::ba
seFrequencyAttr)) | 50 , m_baseFrequency(SVGAnimatedNumberOptionalNumber::create(this, SVGNames::ba
seFrequencyAttr)) |
| 51 , m_seed(SVGAnimatedNumber::create(this, SVGNames::seedAttr, SVGNumber::crea
te(0))) | 51 , m_seed(SVGAnimatedNumber::create(this, SVGNames::seedAttr, SVGNumber::crea
te(0))) |
| 52 , m_stitchTiles(SVGAnimatedEnumeration<SVGStitchOptions>::create(this, SVGNa
mes::stitchTilesAttr, SVG_STITCHTYPE_NOSTITCH)) | 52 , m_stitchTiles(SVGAnimatedEnumeration<SVGStitchOptions>::create(this, SVGNa
mes::stitchTilesAttr, kSvgStitchtypeNostitch)) |
| 53 , m_type(SVGAnimatedEnumeration<TurbulenceType>::create(this, SVGNames::type
Attr, FETURBULENCE_TYPE_TURBULENCE)) | 53 , m_type(SVGAnimatedEnumeration<TurbulenceType>::create(this, SVGNames::type
Attr, FETURBULENCE_TYPE_TURBULENCE)) |
| 54 , m_numOctaves(SVGAnimatedInteger::create(this, SVGNames::numOctavesAttr, SV
GInteger::create(1))) | 54 , m_numOctaves(SVGAnimatedInteger::create(this, SVGNames::numOctavesAttr, SV
GInteger::create(1))) |
| 55 { | 55 { |
| 56 addToPropertyMap(m_baseFrequency); | 56 addToPropertyMap(m_baseFrequency); |
| 57 addToPropertyMap(m_seed); | 57 addToPropertyMap(m_seed); |
| 58 addToPropertyMap(m_stitchTiles); | 58 addToPropertyMap(m_stitchTiles); |
| 59 addToPropertyMap(m_type); | 59 addToPropertyMap(m_type); |
| 60 addToPropertyMap(m_numOctaves); | 60 addToPropertyMap(m_numOctaves); |
| 61 } | 61 } |
| 62 | 62 |
| 63 DEFINE_TRACE(SVGFETurbulenceElement) | 63 DEFINE_TRACE(SVGFETurbulenceElement) |
| 64 { | 64 { |
| 65 visitor->trace(m_baseFrequency); | 65 visitor->trace(m_baseFrequency); |
| 66 visitor->trace(m_seed); | 66 visitor->trace(m_seed); |
| 67 visitor->trace(m_stitchTiles); | 67 visitor->trace(m_stitchTiles); |
| 68 visitor->trace(m_type); | 68 visitor->trace(m_type); |
| 69 visitor->trace(m_numOctaves); | 69 visitor->trace(m_numOctaves); |
| 70 SVGFilterPrimitiveStandardAttributes::trace(visitor); | 70 SVGFilterPrimitiveStandardAttributes::trace(visitor); |
| 71 } | 71 } |
| 72 | 72 |
| 73 DEFINE_NODE_FACTORY(SVGFETurbulenceElement) | 73 DEFINE_NODE_FACTORY(SVGFETurbulenceElement) |
| 74 | 74 |
| 75 bool SVGFETurbulenceElement::setFilterEffectAttribute(FilterEffect* effect, cons
t QualifiedName& attrName) | 75 bool SVGFETurbulenceElement::setFilterEffectAttribute(FilterEffect* effect, cons
t QualifiedName& attrName) |
| 76 { | 76 { |
| 77 FETurbulence* turbulence = static_cast<FETurbulence*>(effect); | 77 FETurbulence* turbulence = static_cast<FETurbulence*>(effect); |
| 78 if (attrName == SVGNames::typeAttr) | 78 if (attrName == SVGNames::typeAttr) |
| 79 return turbulence->setType(m_type->currentValue()->enumValue()); | 79 return turbulence->setType(m_type->currentValue()->enumValue()); |
| 80 if (attrName == SVGNames::stitchTilesAttr) | 80 if (attrName == SVGNames::stitchTilesAttr) |
| 81 return turbulence->setStitchTiles(m_stitchTiles->currentValue()->enumVal
ue() == SVG_STITCHTYPE_STITCH); | 81 return turbulence->setStitchTiles(m_stitchTiles->currentValue()->enumVal
ue() == kSvgStitchtypeStitch); |
| 82 if (attrName == SVGNames::baseFrequencyAttr) { | 82 if (attrName == SVGNames::baseFrequencyAttr) { |
| 83 bool baseFrequencyXChanged = turbulence->setBaseFrequencyX(baseFrequency
X()->currentValue()->value()); | 83 bool baseFrequencyXChanged = turbulence->setBaseFrequencyX(baseFrequency
X()->currentValue()->value()); |
| 84 bool baseFrequencyYChanged = turbulence->setBaseFrequencyY(baseFrequency
Y()->currentValue()->value()); | 84 bool baseFrequencyYChanged = turbulence->setBaseFrequencyY(baseFrequency
Y()->currentValue()->value()); |
| 85 return (baseFrequencyXChanged || baseFrequencyYChanged); | 85 return (baseFrequencyXChanged || baseFrequencyYChanged); |
| 86 } | 86 } |
| 87 if (attrName == SVGNames::seedAttr) | 87 if (attrName == SVGNames::seedAttr) |
| 88 return turbulence->setSeed(m_seed->currentValue()->value()); | 88 return turbulence->setSeed(m_seed->currentValue()->value()); |
| 89 if (attrName == SVGNames::numOctavesAttr) | 89 if (attrName == SVGNames::numOctavesAttr) |
| 90 return turbulence->setNumOctaves(m_numOctaves->currentValue()->value()); | 90 return turbulence->setNumOctaves(m_numOctaves->currentValue()->value()); |
| 91 | 91 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 108 } | 108 } |
| 109 | 109 |
| 110 FilterEffect* SVGFETurbulenceElement::build(SVGFilterBuilder*, Filter* filter) | 110 FilterEffect* SVGFETurbulenceElement::build(SVGFilterBuilder*, Filter* filter) |
| 111 { | 111 { |
| 112 return FETurbulence::create(filter, | 112 return FETurbulence::create(filter, |
| 113 m_type->currentValue()->enumValue(), | 113 m_type->currentValue()->enumValue(), |
| 114 baseFrequencyX()->currentValue()->value(), | 114 baseFrequencyX()->currentValue()->value(), |
| 115 baseFrequencyY()->currentValue()->value(), | 115 baseFrequencyY()->currentValue()->value(), |
| 116 m_numOctaves->currentValue()->value(), | 116 m_numOctaves->currentValue()->value(), |
| 117 m_seed->currentValue()->value(), | 117 m_seed->currentValue()->value(), |
| 118 m_stitchTiles->currentValue()->enumValue() == SVG_STITCHTYPE_STITCH); | 118 m_stitchTiles->currentValue()->enumValue() == kSvgStitchtypeStitch); |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace blink | 121 } // namespace blink |
| OLD | NEW |