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 14 matching lines...) Expand all Loading... |
25 #include "SVGNames.h" | 25 #include "SVGNames.h" |
26 #include "core/platform/graphics/filters/FilterEffect.h" | 26 #include "core/platform/graphics/filters/FilterEffect.h" |
27 #include "core/svg/SVGElementInstance.h" | 27 #include "core/svg/SVGElementInstance.h" |
28 #include "core/svg/graphics/filters/SVGFilterBuilder.h" | 28 #include "core/svg/graphics/filters/SVGFilterBuilder.h" |
29 | 29 |
30 namespace WebCore { | 30 namespace WebCore { |
31 | 31 |
32 // Animated property definitions | 32 // Animated property definitions |
33 DEFINE_ANIMATED_STRING(SVGFECompositeElement, SVGNames::inAttr, In1, in1) | 33 DEFINE_ANIMATED_STRING(SVGFECompositeElement, SVGNames::inAttr, In1, in1) |
34 DEFINE_ANIMATED_STRING(SVGFECompositeElement, SVGNames::in2Attr, In2, in2) | 34 DEFINE_ANIMATED_STRING(SVGFECompositeElement, SVGNames::in2Attr, In2, in2) |
35 DEFINE_ANIMATED_ENUMERATION(SVGFECompositeElement, SVGNames::operatorAttr, _oper
ator, _operator, CompositeOperationType) | 35 DEFINE_ANIMATED_ENUMERATION(SVGFECompositeElement, SVGNames::operatorAttr, SVGOp
erator, svgOperator, CompositeOperationType) |
36 DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k1Attr, K1, k1) | 36 DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k1Attr, K1, k1) |
37 DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k2Attr, K2, k2) | 37 DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k2Attr, K2, k2) |
38 DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k3Attr, K3, k3) | 38 DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k3Attr, K3, k3) |
39 DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k4Attr, K4, k4) | 39 DEFINE_ANIMATED_NUMBER(SVGFECompositeElement, SVGNames::k4Attr, K4, k4) |
40 | 40 |
41 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFECompositeElement) | 41 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFECompositeElement) |
42 REGISTER_LOCAL_ANIMATED_PROPERTY(in1) | 42 REGISTER_LOCAL_ANIMATED_PROPERTY(in1) |
43 REGISTER_LOCAL_ANIMATED_PROPERTY(in2) | 43 REGISTER_LOCAL_ANIMATED_PROPERTY(in2) |
44 REGISTER_LOCAL_ANIMATED_PROPERTY(_operator) | 44 REGISTER_LOCAL_ANIMATED_PROPERTY(svgOperator) |
45 REGISTER_LOCAL_ANIMATED_PROPERTY(k1) | 45 REGISTER_LOCAL_ANIMATED_PROPERTY(k1) |
46 REGISTER_LOCAL_ANIMATED_PROPERTY(k2) | 46 REGISTER_LOCAL_ANIMATED_PROPERTY(k2) |
47 REGISTER_LOCAL_ANIMATED_PROPERTY(k3) | 47 REGISTER_LOCAL_ANIMATED_PROPERTY(k3) |
48 REGISTER_LOCAL_ANIMATED_PROPERTY(k4) | 48 REGISTER_LOCAL_ANIMATED_PROPERTY(k4) |
49 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) | 49 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) |
50 END_REGISTER_ANIMATED_PROPERTIES | 50 END_REGISTER_ANIMATED_PROPERTIES |
51 | 51 |
52 inline SVGFECompositeElement::SVGFECompositeElement(const QualifiedName& tagName
, Document* document) | 52 inline SVGFECompositeElement::SVGFECompositeElement(const QualifiedName& tagName
, Document* document) |
53 : SVGFilterPrimitiveStandardAttributes(tagName, document) | 53 : SVGFilterPrimitiveStandardAttributes(tagName, document) |
54 , m__operator(FECOMPOSITE_OPERATOR_OVER) | 54 , m_svgOperator(FECOMPOSITE_OPERATOR_OVER) |
55 { | 55 { |
56 ASSERT(hasTagName(SVGNames::feCompositeTag)); | 56 ASSERT(hasTagName(SVGNames::feCompositeTag)); |
57 ScriptWrappable::init(this); | 57 ScriptWrappable::init(this); |
58 registerAnimatedPropertiesForSVGFECompositeElement(); | 58 registerAnimatedPropertiesForSVGFECompositeElement(); |
59 } | 59 } |
60 | 60 |
61 PassRefPtr<SVGFECompositeElement> SVGFECompositeElement::create(const QualifiedN
ame& tagName, Document* document) | 61 PassRefPtr<SVGFECompositeElement> SVGFECompositeElement::create(const QualifiedN
ame& tagName, Document* document) |
62 { | 62 { |
63 return adoptRef(new SVGFECompositeElement(tagName, document)); | 63 return adoptRef(new SVGFECompositeElement(tagName, document)); |
64 } | 64 } |
(...skipping 16 matching lines...) Expand all Loading... |
81 void SVGFECompositeElement::parseAttribute(const QualifiedName& name, const Atom
icString& value) | 81 void SVGFECompositeElement::parseAttribute(const QualifiedName& name, const Atom
icString& value) |
82 { | 82 { |
83 if (!isSupportedAttribute(name)) { | 83 if (!isSupportedAttribute(name)) { |
84 SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value); | 84 SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value); |
85 return; | 85 return; |
86 } | 86 } |
87 | 87 |
88 if (name == SVGNames::operatorAttr) { | 88 if (name == SVGNames::operatorAttr) { |
89 CompositeOperationType propertyValue = SVGPropertyTraits<CompositeOperat
ionType>::fromString(value); | 89 CompositeOperationType propertyValue = SVGPropertyTraits<CompositeOperat
ionType>::fromString(value); |
90 if (propertyValue > 0) | 90 if (propertyValue > 0) |
91 set_operatorBaseValue(propertyValue); | 91 setSVGOperatorBaseValue(propertyValue); |
92 return; | 92 return; |
93 } | 93 } |
94 | 94 |
95 if (name == SVGNames::inAttr) { | 95 if (name == SVGNames::inAttr) { |
96 setIn1BaseValue(value); | 96 setIn1BaseValue(value); |
97 return; | 97 return; |
98 } | 98 } |
99 | 99 |
100 if (name == SVGNames::in2Attr) { | 100 if (name == SVGNames::in2Attr) { |
101 setIn2BaseValue(value); | 101 setIn2BaseValue(value); |
(...skipping 20 matching lines...) Expand all Loading... |
122 return; | 122 return; |
123 } | 123 } |
124 | 124 |
125 ASSERT_NOT_REACHED(); | 125 ASSERT_NOT_REACHED(); |
126 } | 126 } |
127 | 127 |
128 bool SVGFECompositeElement::setFilterEffectAttribute(FilterEffect* effect, const
QualifiedName& attrName) | 128 bool SVGFECompositeElement::setFilterEffectAttribute(FilterEffect* effect, const
QualifiedName& attrName) |
129 { | 129 { |
130 FEComposite* composite = static_cast<FEComposite*>(effect); | 130 FEComposite* composite = static_cast<FEComposite*>(effect); |
131 if (attrName == SVGNames::operatorAttr) | 131 if (attrName == SVGNames::operatorAttr) |
132 return composite->setOperation(_operatorCurrentValue()); | 132 return composite->setOperation(svgOperatorCurrentValue()); |
133 if (attrName == SVGNames::k1Attr) | 133 if (attrName == SVGNames::k1Attr) |
134 return composite->setK1(k1CurrentValue()); | 134 return composite->setK1(k1CurrentValue()); |
135 if (attrName == SVGNames::k2Attr) | 135 if (attrName == SVGNames::k2Attr) |
136 return composite->setK2(k2CurrentValue()); | 136 return composite->setK2(k2CurrentValue()); |
137 if (attrName == SVGNames::k3Attr) | 137 if (attrName == SVGNames::k3Attr) |
138 return composite->setK3(k3CurrentValue()); | 138 return composite->setK3(k3CurrentValue()); |
139 if (attrName == SVGNames::k4Attr) | 139 if (attrName == SVGNames::k4Attr) |
140 return composite->setK4(k4CurrentValue()); | 140 return composite->setK4(k4CurrentValue()); |
141 | 141 |
142 ASSERT_NOT_REACHED(); | 142 ASSERT_NOT_REACHED(); |
(...skipping 28 matching lines...) Expand all Loading... |
171 } | 171 } |
172 | 172 |
173 PassRefPtr<FilterEffect> SVGFECompositeElement::build(SVGFilterBuilder* filterBu
ilder, Filter* filter) | 173 PassRefPtr<FilterEffect> SVGFECompositeElement::build(SVGFilterBuilder* filterBu
ilder, Filter* filter) |
174 { | 174 { |
175 FilterEffect* input1 = filterBuilder->getEffectById(in1CurrentValue()); | 175 FilterEffect* input1 = filterBuilder->getEffectById(in1CurrentValue()); |
176 FilterEffect* input2 = filterBuilder->getEffectById(in2CurrentValue()); | 176 FilterEffect* input2 = filterBuilder->getEffectById(in2CurrentValue()); |
177 | 177 |
178 if (!input1 || !input2) | 178 if (!input1 || !input2) |
179 return 0; | 179 return 0; |
180 | 180 |
181 RefPtr<FilterEffect> effect = FEComposite::create(filter, _operatorCurrentVa
lue(), k1CurrentValue(), k2CurrentValue(), k3CurrentValue(), k4CurrentValue()); | 181 RefPtr<FilterEffect> effect = FEComposite::create(filter, svgOperatorCurrent
Value(), k1CurrentValue(), k2CurrentValue(), k3CurrentValue(), k4CurrentValue())
; |
182 FilterEffectVector& inputEffects = effect->inputEffects(); | 182 FilterEffectVector& inputEffects = effect->inputEffects(); |
183 inputEffects.reserveCapacity(2); | 183 inputEffects.reserveCapacity(2); |
184 inputEffects.append(input1); | 184 inputEffects.append(input1); |
185 inputEffects.append(input2); | 185 inputEffects.append(input2); |
186 return effect.release(); | 186 return effect.release(); |
187 } | 187 } |
188 | 188 |
189 } | 189 } |
OLD | NEW |