OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz> | 2 * Copyright (C) 2005 Oliver Hunt <ojh16@student.canterbury.ac.nz> |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 94 } |
95 if (attrName == SVGNames::surfaceScaleAttr) | 95 if (attrName == SVGNames::surfaceScaleAttr) |
96 return diffuseLighting->setSurfaceScale(m_surfaceScale->currentValue()->
value()); | 96 return diffuseLighting->setSurfaceScale(m_surfaceScale->currentValue()->
value()); |
97 if (attrName == SVGNames::diffuseConstantAttr) | 97 if (attrName == SVGNames::diffuseConstantAttr) |
98 return diffuseLighting->setDiffuseConstant(m_diffuseConstant->currentVal
ue()->value()); | 98 return diffuseLighting->setDiffuseConstant(m_diffuseConstant->currentVal
ue()->value()); |
99 | 99 |
100 LightSource* lightSource = const_cast<LightSource*>(diffuseLighting->lightSo
urce()); | 100 LightSource* lightSource = const_cast<LightSource*>(diffuseLighting->lightSo
urce()); |
101 const SVGFELightElement* lightElement = SVGFELightElement::findLightElement(
*this); | 101 const SVGFELightElement* lightElement = SVGFELightElement::findLightElement(
*this); |
102 ASSERT(lightSource); | 102 ASSERT(lightSource); |
103 ASSERT(lightElement); | 103 ASSERT(lightElement); |
| 104 ASSERT(effect->filter()); |
104 | 105 |
105 if (attrName == SVGNames::azimuthAttr) | 106 if (attrName == SVGNames::azimuthAttr) |
106 return lightSource->setAzimuth(lightElement->azimuth()->currentValue()->
value()); | 107 return lightSource->setAzimuth(lightElement->azimuth()->currentValue()->
value()); |
107 if (attrName == SVGNames::elevationAttr) | 108 if (attrName == SVGNames::elevationAttr) |
108 return lightSource->setElevation(lightElement->elevation()->currentValue
()->value()); | 109 return lightSource->setElevation(lightElement->elevation()->currentValue
()->value()); |
109 if (attrName == SVGNames::xAttr) | 110 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName =
= SVGNames::zAttr) |
110 return lightSource->setX(lightElement->x()->currentValue()->value()); | 111 return lightSource->setPosition(effect->filter()->resolve3dPoint(lightEl
ement->position())); |
111 if (attrName == SVGNames::yAttr) | 112 if (attrName == SVGNames::pointsAtXAttr || attrName == SVGNames::pointsAtYAt
tr || attrName == SVGNames::pointsAtZAttr) |
112 return lightSource->setY(lightElement->y()->currentValue()->value()); | 113 return lightSource->setPointsAt(effect->filter()->resolve3dPoint(lightEl
ement->pointsAt())); |
113 if (attrName == SVGNames::zAttr) | |
114 return lightSource->setZ(lightElement->z()->currentValue()->value()); | |
115 if (attrName == SVGNames::pointsAtXAttr) | |
116 return lightSource->setPointsAtX(lightElement->pointsAtX()->currentValue
()->value()); | |
117 if (attrName == SVGNames::pointsAtYAttr) | |
118 return lightSource->setPointsAtY(lightElement->pointsAtY()->currentValue
()->value()); | |
119 if (attrName == SVGNames::pointsAtZAttr) | |
120 return lightSource->setPointsAtZ(lightElement->pointsAtZ()->currentValue
()->value()); | |
121 if (attrName == SVGNames::specularExponentAttr) | 114 if (attrName == SVGNames::specularExponentAttr) |
122 return lightSource->setSpecularExponent(lightElement->specularExponent()
->currentValue()->value()); | 115 return lightSource->setSpecularExponent(lightElement->specularExponent()
->currentValue()->value()); |
123 if (attrName == SVGNames::limitingConeAngleAttr) | 116 if (attrName == SVGNames::limitingConeAngleAttr) |
124 return lightSource->setLimitingConeAngle(lightElement->limitingConeAngle
()->currentValue()->value()); | 117 return lightSource->setLimitingConeAngle(lightElement->limitingConeAngle
()->currentValue()->value()); |
125 | 118 |
126 ASSERT_NOT_REACHED(); | 119 ASSERT_NOT_REACHED(); |
127 return false; | 120 return false; |
128 } | 121 } |
129 | 122 |
130 void SVGFEDiffuseLightingElement::svgAttributeChanged(const QualifiedName& attrN
ame) | 123 void SVGFEDiffuseLightingElement::svgAttributeChanged(const QualifiedName& attrN
ame) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 Color color = renderer->style()->svgStyle().lightingColor(); | 173 Color color = renderer->style()->svgStyle().lightingColor(); |
181 | 174 |
182 RefPtr<LightSource> lightSource = lightNode->lightSource(filter); | 175 RefPtr<LightSource> lightSource = lightNode->lightSource(filter); |
183 RefPtr<FilterEffect> effect = FEDiffuseLighting::create(filter, color, m_sur
faceScale->currentValue()->value(), m_diffuseConstant->currentValue()->value(), | 176 RefPtr<FilterEffect> effect = FEDiffuseLighting::create(filter, color, m_sur
faceScale->currentValue()->value(), m_diffuseConstant->currentValue()->value(), |
184 kernelUnitLengthX()->currentValue()->value(), kernelUnitLengthY()->curre
ntValue()->value(), lightSource.release()); | 177 kernelUnitLengthX()->currentValue()->value(), kernelUnitLengthY()->curre
ntValue()->value(), lightSource.release()); |
185 effect->inputEffects().append(input1); | 178 effect->inputEffects().append(input1); |
186 return effect.release(); | 179 return effect.release(); |
187 } | 180 } |
188 | 181 |
189 } | 182 } |
OLD | NEW |