| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 ASSERT(renderer); | 95 ASSERT(renderer); |
| 96 ASSERT(renderer->style()); | 96 ASSERT(renderer->style()); |
| 97 return diffuseLighting->setLightingColor(renderer->style()->svgStyle()->
lightingColor()); | 97 return diffuseLighting->setLightingColor(renderer->style()->svgStyle()->
lightingColor()); |
| 98 } | 98 } |
| 99 if (attrName == SVGNames::surfaceScaleAttr) | 99 if (attrName == SVGNames::surfaceScaleAttr) |
| 100 return diffuseLighting->setSurfaceScale(m_surfaceScale->currentValue()->
value()); | 100 return diffuseLighting->setSurfaceScale(m_surfaceScale->currentValue()->
value()); |
| 101 if (attrName == SVGNames::diffuseConstantAttr) | 101 if (attrName == SVGNames::diffuseConstantAttr) |
| 102 return diffuseLighting->setDiffuseConstant(m_diffuseConstant->currentVal
ue()->value()); | 102 return diffuseLighting->setDiffuseConstant(m_diffuseConstant->currentVal
ue()->value()); |
| 103 | 103 |
| 104 LightSource* lightSource = const_cast<LightSource*>(diffuseLighting->lightSo
urce()); | 104 LightSource* lightSource = const_cast<LightSource*>(diffuseLighting->lightSo
urce()); |
| 105 const SVGFELightElement* lightElement = SVGFELightElement::findLightElement(
this); | 105 const SVGFELightElement* lightElement = SVGFELightElement::findLightElement(
*this); |
| 106 ASSERT(lightSource); | 106 ASSERT(lightSource); |
| 107 ASSERT(lightElement); | 107 ASSERT(lightElement); |
| 108 | 108 |
| 109 if (attrName == SVGNames::azimuthAttr) | 109 if (attrName == SVGNames::azimuthAttr) |
| 110 return lightSource->setAzimuth(lightElement->azimuth()->currentValue()->
value()); | 110 return lightSource->setAzimuth(lightElement->azimuth()->currentValue()->
value()); |
| 111 if (attrName == SVGNames::elevationAttr) | 111 if (attrName == SVGNames::elevationAttr) |
| 112 return lightSource->setElevation(lightElement->elevation()->currentValue
()->value()); | 112 return lightSource->setElevation(lightElement->elevation()->currentValue
()->value()); |
| 113 if (attrName == SVGNames::xAttr) | 113 if (attrName == SVGNames::xAttr) |
| 114 return lightSource->setX(lightElement->x()->currentValue()->value()); | 114 return lightSource->setX(lightElement->x()->currentValue()->value()); |
| 115 if (attrName == SVGNames::yAttr) | 115 if (attrName == SVGNames::yAttr) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 if (attrName == SVGNames::inAttr) { | 151 if (attrName == SVGNames::inAttr) { |
| 152 invalidate(); | 152 invalidate(); |
| 153 return; | 153 return; |
| 154 } | 154 } |
| 155 | 155 |
| 156 ASSERT_NOT_REACHED(); | 156 ASSERT_NOT_REACHED(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void SVGFEDiffuseLightingElement::lightElementAttributeChanged(const SVGFELightE
lement* lightElement, const QualifiedName& attrName) | 159 void SVGFEDiffuseLightingElement::lightElementAttributeChanged(const SVGFELightE
lement* lightElement, const QualifiedName& attrName) |
| 160 { | 160 { |
| 161 if (SVGFELightElement::findLightElement(this) != lightElement) | 161 if (SVGFELightElement::findLightElement(*this) != lightElement) |
| 162 return; | 162 return; |
| 163 | 163 |
| 164 // The light element has different attribute names. | 164 // The light element has different attribute names. |
| 165 primitiveAttributeChanged(attrName); | 165 primitiveAttributeChanged(attrName); |
| 166 } | 166 } |
| 167 | 167 |
| 168 PassRefPtr<FilterEffect> SVGFEDiffuseLightingElement::build(SVGFilterBuilder* fi
lterBuilder, Filter* filter) | 168 PassRefPtr<FilterEffect> SVGFEDiffuseLightingElement::build(SVGFilterBuilder* fi
lterBuilder, Filter* filter) |
| 169 { | 169 { |
| 170 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); | 170 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); |
| 171 | 171 |
| 172 if (!input1) | 172 if (!input1) |
| 173 return nullptr; | 173 return nullptr; |
| 174 | 174 |
| 175 RefPtr<LightSource> lightSource = SVGFELightElement::findLightSource(this); | 175 RefPtr<LightSource> lightSource = SVGFELightElement::findLightSource(*this); |
| 176 if (!lightSource) | 176 if (!lightSource) |
| 177 return nullptr; | 177 return nullptr; |
| 178 | 178 |
| 179 RenderObject* renderer = this->renderer(); | 179 RenderObject* renderer = this->renderer(); |
| 180 if (!renderer) | 180 if (!renderer) |
| 181 return nullptr; | 181 return nullptr; |
| 182 | 182 |
| 183 ASSERT(renderer->style()); | 183 ASSERT(renderer->style()); |
| 184 Color color = renderer->style()->svgStyle()->lightingColor(); | 184 Color color = renderer->style()->svgStyle()->lightingColor(); |
| 185 | 185 |
| 186 RefPtr<FilterEffect> effect = FEDiffuseLighting::create(filter, color, m_sur
faceScale->currentValue()->value(), m_diffuseConstant->currentValue()->value(), | 186 RefPtr<FilterEffect> effect = FEDiffuseLighting::create(filter, color, m_sur
faceScale->currentValue()->value(), m_diffuseConstant->currentValue()->value(), |
| 187 kernelUnitLengthX()->currentValue()->value(), kernelUnitLengthY()->curre
ntValue()->value(), lightSource.release()); | 187 kernelUnitLengthX()->currentValue()->value(), kernelUnitLengthY()->curre
ntValue()->value(), lightSource.release()); |
| 188 effect->inputEffects().append(input1); | 188 effect->inputEffects().append(input1); |
| 189 return effect.release(); | 189 return effect.release(); |
| 190 } | 190 } |
| 191 | 191 |
| 192 } | 192 } |
| OLD | NEW |