Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: Source/core/svg/SVGFESpecularLightingElement.cpp

Issue 192133002: Use isSVG*Element() helpers more in SVG code (Part 1) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGFELightElement.cpp ('k') | Source/core/svg/SVGFontData.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 return specularLighting->setLightingColor(renderer->style()->svgStyle()- >lightingColor()); 102 return specularLighting->setLightingColor(renderer->style()->svgStyle()- >lightingColor());
103 } 103 }
104 if (attrName == SVGNames::surfaceScaleAttr) 104 if (attrName == SVGNames::surfaceScaleAttr)
105 return specularLighting->setSurfaceScale(m_surfaceScale->currentValue()- >value()); 105 return specularLighting->setSurfaceScale(m_surfaceScale->currentValue()- >value());
106 if (attrName == SVGNames::specularConstantAttr) 106 if (attrName == SVGNames::specularConstantAttr)
107 return specularLighting->setSpecularConstant(m_specularConstant->current Value()->value()); 107 return specularLighting->setSpecularConstant(m_specularConstant->current Value()->value());
108 if (attrName == SVGNames::specularExponentAttr) 108 if (attrName == SVGNames::specularExponentAttr)
109 return specularLighting->setSpecularExponent(m_specularExponent->current Value()->value()); 109 return specularLighting->setSpecularExponent(m_specularExponent->current Value()->value());
110 110
111 LightSource* lightSource = const_cast<LightSource*>(specularLighting->lightS ource()); 111 LightSource* lightSource = const_cast<LightSource*>(specularLighting->lightS ource());
112 SVGFELightElement* lightElement = SVGFELightElement::findLightElement(this); 112 SVGFELightElement* lightElement = SVGFELightElement::findLightElement(*this) ;
113 ASSERT(lightSource); 113 ASSERT(lightSource);
114 ASSERT(lightElement); 114 ASSERT(lightElement);
115 115
116 if (attrName == SVGNames::azimuthAttr) 116 if (attrName == SVGNames::azimuthAttr)
117 return lightSource->setAzimuth(lightElement->azimuth()->currentValue()-> value()); 117 return lightSource->setAzimuth(lightElement->azimuth()->currentValue()-> value());
118 if (attrName == SVGNames::elevationAttr) 118 if (attrName == SVGNames::elevationAttr)
119 return lightSource->setElevation(lightElement->elevation()->currentValue ()->value()); 119 return lightSource->setElevation(lightElement->elevation()->currentValue ()->value());
120 if (attrName == SVGNames::xAttr) 120 if (attrName == SVGNames::xAttr)
121 return lightSource->setX(lightElement->x()->currentValue()->value()); 121 return lightSource->setX(lightElement->x()->currentValue()->value());
122 if (attrName == SVGNames::yAttr) 122 if (attrName == SVGNames::yAttr)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 if (attrName == SVGNames::inAttr) { 158 if (attrName == SVGNames::inAttr) {
159 invalidate(); 159 invalidate();
160 return; 160 return;
161 } 161 }
162 162
163 ASSERT_NOT_REACHED(); 163 ASSERT_NOT_REACHED();
164 } 164 }
165 165
166 void SVGFESpecularLightingElement::lightElementAttributeChanged(const SVGFELight Element* lightElement, const QualifiedName& attrName) 166 void SVGFESpecularLightingElement::lightElementAttributeChanged(const SVGFELight Element* lightElement, const QualifiedName& attrName)
167 { 167 {
168 if (SVGFELightElement::findLightElement(this) != lightElement) 168 if (SVGFELightElement::findLightElement(*this) != lightElement)
169 return; 169 return;
170 170
171 // The light element has different attribute names so attrName can identify the requested attribute. 171 // The light element has different attribute names so attrName can identify the requested attribute.
172 primitiveAttributeChanged(attrName); 172 primitiveAttributeChanged(attrName);
173 } 173 }
174 174
175 PassRefPtr<FilterEffect> SVGFESpecularLightingElement::build(SVGFilterBuilder* f ilterBuilder, Filter* filter) 175 PassRefPtr<FilterEffect> SVGFESpecularLightingElement::build(SVGFilterBuilder* f ilterBuilder, Filter* filter)
176 { 176 {
177 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr entValue()->value())); 177 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr entValue()->value()));
178 178
179 if (!input1) 179 if (!input1)
180 return nullptr; 180 return nullptr;
181 181
182 RefPtr<LightSource> lightSource = SVGFELightElement::findLightSource(this); 182 RefPtr<LightSource> lightSource = SVGFELightElement::findLightSource(*this);
183 if (!lightSource) 183 if (!lightSource)
184 return nullptr; 184 return nullptr;
185 185
186 RenderObject* renderer = this->renderer(); 186 RenderObject* renderer = this->renderer();
187 if (!renderer) 187 if (!renderer)
188 return nullptr; 188 return nullptr;
189 189
190 ASSERT(renderer->style()); 190 ASSERT(renderer->style());
191 Color color = renderer->style()->svgStyle()->lightingColor(); 191 Color color = renderer->style()->svgStyle()->lightingColor();
192 192
193 RefPtr<FilterEffect> effect = FESpecularLighting::create(filter, color, m_su rfaceScale->currentValue()->value(), m_specularConstant->currentValue()->value() , 193 RefPtr<FilterEffect> effect = FESpecularLighting::create(filter, color, m_su rfaceScale->currentValue()->value(), m_specularConstant->currentValue()->value() ,
194 m_specularExponent->currentValue()->value(), kernelUnitLengthX()->curren tValue()->value(), kernelUnitLengthY()->currentValue()->value(), lightSource.rel ease()); 194 m_specularExponent->currentValue()->value(), kernelUnitLengthX()->curren tValue()->value(), kernelUnitLengthY()->currentValue()->value(), lightSource.rel ease());
195 effect->inputEffects().append(input1); 195 effect->inputEffects().append(input1);
196 return effect.release(); 196 return effect.release();
197 } 197 }
198 198
199 } 199 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGFELightElement.cpp ('k') | Source/core/svg/SVGFontData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698