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 * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com> | 4 * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com> |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 27 matching lines...) Expand all Loading... |
38 , m_kernelUnitLength(SVGAnimatedNumberOptionalNumber::create(this, SVGNames:
:surfaceScaleAttr)) | 38 , m_kernelUnitLength(SVGAnimatedNumberOptionalNumber::create(this, SVGNames:
:surfaceScaleAttr)) |
39 , m_in1(SVGAnimatedString::create(this, SVGNames::inAttr, SVGString::create(
))) | 39 , m_in1(SVGAnimatedString::create(this, SVGNames::inAttr, SVGString::create(
))) |
40 { | 40 { |
41 addToPropertyMap(m_specularConstant); | 41 addToPropertyMap(m_specularConstant); |
42 addToPropertyMap(m_specularExponent); | 42 addToPropertyMap(m_specularExponent); |
43 addToPropertyMap(m_surfaceScale); | 43 addToPropertyMap(m_surfaceScale); |
44 addToPropertyMap(m_kernelUnitLength); | 44 addToPropertyMap(m_kernelUnitLength); |
45 addToPropertyMap(m_in1); | 45 addToPropertyMap(m_in1); |
46 } | 46 } |
47 | 47 |
| 48 void SVGFESpecularLightingElement::trace(Visitor* visitor) |
| 49 { |
| 50 visitor->trace(m_specularConstant); |
| 51 visitor->trace(m_specularExponent); |
| 52 visitor->trace(m_surfaceScale); |
| 53 visitor->trace(m_kernelUnitLength); |
| 54 visitor->trace(m_in1); |
| 55 SVGFilterPrimitiveStandardAttributes::trace(visitor); |
| 56 } |
| 57 |
48 DEFINE_NODE_FACTORY(SVGFESpecularLightingElement) | 58 DEFINE_NODE_FACTORY(SVGFESpecularLightingElement) |
49 | 59 |
50 bool SVGFESpecularLightingElement::isSupportedAttribute(const QualifiedName& att
rName) | 60 bool SVGFESpecularLightingElement::isSupportedAttribute(const QualifiedName& att
rName) |
51 { | 61 { |
52 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 62 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
53 if (supportedAttributes.isEmpty()) { | 63 if (supportedAttributes.isEmpty()) { |
54 supportedAttributes.add(SVGNames::inAttr); | 64 supportedAttributes.add(SVGNames::inAttr); |
55 supportedAttributes.add(SVGNames::specularConstantAttr); | 65 supportedAttributes.add(SVGNames::specularConstantAttr); |
56 supportedAttributes.add(SVGNames::specularExponentAttr); | 66 supportedAttributes.add(SVGNames::specularExponentAttr); |
57 supportedAttributes.add(SVGNames::surfaceScaleAttr); | 67 supportedAttributes.add(SVGNames::surfaceScaleAttr); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 162 |
153 void SVGFESpecularLightingElement::lightElementAttributeChanged(const SVGFELight
Element* lightElement, const QualifiedName& attrName) | 163 void SVGFESpecularLightingElement::lightElementAttributeChanged(const SVGFELight
Element* lightElement, const QualifiedName& attrName) |
154 { | 164 { |
155 if (SVGFELightElement::findLightElement(*this) != lightElement) | 165 if (SVGFELightElement::findLightElement(*this) != lightElement) |
156 return; | 166 return; |
157 | 167 |
158 // The light element has different attribute names so attrName can identify
the requested attribute. | 168 // The light element has different attribute names so attrName can identify
the requested attribute. |
159 primitiveAttributeChanged(attrName); | 169 primitiveAttributeChanged(attrName); |
160 } | 170 } |
161 | 171 |
162 PassRefPtr<FilterEffect> SVGFESpecularLightingElement::build(SVGFilterBuilder* f
ilterBuilder, Filter* filter) | 172 PassRefPtrWillBeRawPtr<FilterEffect> SVGFESpecularLightingElement::build(SVGFilt
erBuilder* filterBuilder, Filter* filter) |
163 { | 173 { |
164 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); | 174 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); |
165 | 175 |
166 if (!input1) | 176 if (!input1) |
167 return nullptr; | 177 return nullptr; |
168 | 178 |
169 SVGFELightElement* lightNode = SVGFELightElement::findLightElement(*this); | 179 SVGFELightElement* lightNode = SVGFELightElement::findLightElement(*this); |
170 if (!lightNode) | 180 if (!lightNode) |
171 return nullptr; | 181 return nullptr; |
172 | 182 |
173 RenderObject* renderer = this->renderer(); | 183 RenderObject* renderer = this->renderer(); |
174 if (!renderer) | 184 if (!renderer) |
175 return nullptr; | 185 return nullptr; |
176 | 186 |
177 ASSERT(renderer->style()); | 187 ASSERT(renderer->style()); |
178 Color color = renderer->style()->svgStyle().lightingColor(); | 188 Color color = renderer->style()->svgStyle().lightingColor(); |
179 | 189 |
180 RefPtr<LightSource> lightSource = lightNode->lightSource(filter); | 190 RefPtr<LightSource> lightSource = lightNode->lightSource(filter); |
181 RefPtr<FilterEffect> effect = FESpecularLighting::create(filter, color, m_su
rfaceScale->currentValue()->value(), m_specularConstant->currentValue()->value()
, | 191 RefPtrWillBeRawPtr<FilterEffect> effect = FESpecularLighting::create(filter,
color, m_surfaceScale->currentValue()->value(), m_specularConstant->currentValu
e()->value(), |
182 m_specularExponent->currentValue()->value(), kernelUnitLengthX()->curren
tValue()->value(), kernelUnitLengthY()->currentValue()->value(), lightSource.rel
ease()); | 192 m_specularExponent->currentValue()->value(), kernelUnitLengthX()->curren
tValue()->value(), kernelUnitLengthY()->currentValue()->value(), lightSource.rel
ease()); |
183 effect->inputEffects().append(input1); | 193 effect->inputEffects().append(input1); |
184 return effect.release(); | 194 return effect.release(); |
185 } | 195 } |
186 | 196 |
187 } // namespace blink | 197 } // namespace blink |
OLD | NEW |