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

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

Issue 395813002: Resolve light-source position/direction when updated (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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/SVGFEPointLightElement.cpp ('k') | Source/core/svg/SVGFESpotLightElement.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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 return specularLighting->setSurfaceScale(m_surfaceScale->currentValue()- >value()); 101 return specularLighting->setSurfaceScale(m_surfaceScale->currentValue()- >value());
102 if (attrName == SVGNames::specularConstantAttr) 102 if (attrName == SVGNames::specularConstantAttr)
103 return specularLighting->setSpecularConstant(m_specularConstant->current Value()->value()); 103 return specularLighting->setSpecularConstant(m_specularConstant->current Value()->value());
104 if (attrName == SVGNames::specularExponentAttr) 104 if (attrName == SVGNames::specularExponentAttr)
105 return specularLighting->setSpecularExponent(m_specularExponent->current Value()->value()); 105 return specularLighting->setSpecularExponent(m_specularExponent->current Value()->value());
106 106
107 LightSource* lightSource = const_cast<LightSource*>(specularLighting->lightS ource()); 107 LightSource* lightSource = const_cast<LightSource*>(specularLighting->lightS ource());
108 SVGFELightElement* lightElement = SVGFELightElement::findLightElement(*this) ; 108 SVGFELightElement* lightElement = SVGFELightElement::findLightElement(*this) ;
109 ASSERT(lightSource); 109 ASSERT(lightSource);
110 ASSERT(lightElement); 110 ASSERT(lightElement);
111 ASSERT(effect->filter());
111 112
112 if (attrName == SVGNames::azimuthAttr) 113 if (attrName == SVGNames::azimuthAttr)
113 return lightSource->setAzimuth(lightElement->azimuth()->currentValue()-> value()); 114 return lightSource->setAzimuth(lightElement->azimuth()->currentValue()-> value());
114 if (attrName == SVGNames::elevationAttr) 115 if (attrName == SVGNames::elevationAttr)
115 return lightSource->setElevation(lightElement->elevation()->currentValue ()->value()); 116 return lightSource->setElevation(lightElement->elevation()->currentValue ()->value());
116 if (attrName == SVGNames::xAttr) 117 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName = = SVGNames::zAttr)
117 return lightSource->setX(lightElement->x()->currentValue()->value()); 118 return lightSource->setPosition(effect->filter()->resolve3dPoint(lightEl ement->position()));
118 if (attrName == SVGNames::yAttr) 119 if (attrName == SVGNames::pointsAtXAttr || attrName == SVGNames::pointsAtYAt tr || attrName == SVGNames::pointsAtZAttr)
119 return lightSource->setY(lightElement->y()->currentValue()->value()); 120 return lightSource->setPointsAt(effect->filter()->resolve3dPoint(lightEl ement->pointsAt()));
120 if (attrName == SVGNames::zAttr)
121 return lightSource->setZ(lightElement->z()->currentValue()->value());
122 if (attrName == SVGNames::pointsAtXAttr)
123 return lightSource->setPointsAtX(lightElement->pointsAtX()->currentValue ()->value());
124 if (attrName == SVGNames::pointsAtYAttr)
125 return lightSource->setPointsAtY(lightElement->pointsAtY()->currentValue ()->value());
126 if (attrName == SVGNames::pointsAtZAttr)
127 return lightSource->setPointsAtZ(lightElement->pointsAtZ()->currentValue ()->value());
128 if (attrName == SVGNames::specularExponentAttr) 121 if (attrName == SVGNames::specularExponentAttr)
129 return lightSource->setSpecularExponent(lightElement->specularExponent() ->currentValue()->value()); 122 return lightSource->setSpecularExponent(lightElement->specularExponent() ->currentValue()->value());
130 if (attrName == SVGNames::limitingConeAngleAttr) 123 if (attrName == SVGNames::limitingConeAngleAttr)
131 return lightSource->setLimitingConeAngle(lightElement->limitingConeAngle ()->currentValue()->value()); 124 return lightSource->setLimitingConeAngle(lightElement->limitingConeAngle ()->currentValue()->value());
132 125
133 ASSERT_NOT_REACHED(); 126 ASSERT_NOT_REACHED();
134 return false; 127 return false;
135 } 128 }
136 129
137 void SVGFESpecularLightingElement::svgAttributeChanged(const QualifiedName& attr Name) 130 void SVGFESpecularLightingElement::svgAttributeChanged(const QualifiedName& attr Name)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 Color color = renderer->style()->svgStyle().lightingColor(); 180 Color color = renderer->style()->svgStyle().lightingColor();
188 181
189 RefPtr<LightSource> lightSource = lightNode->lightSource(filter); 182 RefPtr<LightSource> lightSource = lightNode->lightSource(filter);
190 RefPtr<FilterEffect> effect = FESpecularLighting::create(filter, color, m_su rfaceScale->currentValue()->value(), m_specularConstant->currentValue()->value() , 183 RefPtr<FilterEffect> effect = FESpecularLighting::create(filter, color, m_su rfaceScale->currentValue()->value(), m_specularConstant->currentValue()->value() ,
191 m_specularExponent->currentValue()->value(), kernelUnitLengthX()->curren tValue()->value(), kernelUnitLengthY()->currentValue()->value(), lightSource.rel ease()); 184 m_specularExponent->currentValue()->value(), kernelUnitLengthX()->curren tValue()->value(), kernelUnitLengthY()->currentValue()->value(), lightSource.rel ease());
192 effect->inputEffects().append(input1); 185 effect->inputEffects().append(input1);
193 return effect.release(); 186 return effect.release();
194 } 187 }
195 188
196 } 189 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGFEPointLightElement.cpp ('k') | Source/core/svg/SVGFESpotLightElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698