| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 DEFINE_NODE_FACTORY(SVGFEDiffuseLightingElement) | 58 DEFINE_NODE_FACTORY(SVGFEDiffuseLightingElement) |
| 59 | 59 |
| 60 bool SVGFEDiffuseLightingElement::setFilterEffectAttribute( | 60 bool SVGFEDiffuseLightingElement::setFilterEffectAttribute( |
| 61 FilterEffect* effect, | 61 FilterEffect* effect, |
| 62 const QualifiedName& attrName) { | 62 const QualifiedName& attrName) { |
| 63 FEDiffuseLighting* diffuseLighting = static_cast<FEDiffuseLighting*>(effect); | 63 FEDiffuseLighting* diffuseLighting = static_cast<FEDiffuseLighting*>(effect); |
| 64 | 64 |
| 65 if (attrName == SVGNames::lighting_colorAttr) { | 65 if (attrName == SVGNames::lighting_colorAttr) { |
| 66 LayoutObject* layoutObject = this->layoutObject(); | 66 LayoutObject* layoutObject = this->layoutObject(); |
| 67 ASSERT(layoutObject); | 67 DCHECK(layoutObject); |
| 68 ASSERT(layoutObject->style()); | 68 DCHECK(layoutObject->style()); |
| 69 return diffuseLighting->setLightingColor( | 69 return diffuseLighting->setLightingColor( |
| 70 layoutObject->style()->svgStyle().lightingColor()); | 70 layoutObject->style()->svgStyle().lightingColor()); |
| 71 } | 71 } |
| 72 if (attrName == SVGNames::surfaceScaleAttr) | 72 if (attrName == SVGNames::surfaceScaleAttr) |
| 73 return diffuseLighting->setSurfaceScale( | 73 return diffuseLighting->setSurfaceScale( |
| 74 m_surfaceScale->currentValue()->value()); | 74 m_surfaceScale->currentValue()->value()); |
| 75 if (attrName == SVGNames::diffuseConstantAttr) | 75 if (attrName == SVGNames::diffuseConstantAttr) |
| 76 return diffuseLighting->setDiffuseConstant( | 76 return diffuseLighting->setDiffuseConstant( |
| 77 m_diffuseConstant->currentValue()->value()); | 77 m_diffuseConstant->currentValue()->value()); |
| 78 | 78 |
| 79 LightSource* lightSource = | 79 LightSource* lightSource = |
| 80 const_cast<LightSource*>(diffuseLighting->lightSource()); | 80 const_cast<LightSource*>(diffuseLighting->lightSource()); |
| 81 const SVGFELightElement* lightElement = | 81 const SVGFELightElement* lightElement = |
| 82 SVGFELightElement::findLightElement(*this); | 82 SVGFELightElement::findLightElement(*this); |
| 83 ASSERT(lightSource); | 83 DCHECK(lightSource); |
| 84 ASSERT(lightElement); | 84 DCHECK(lightElement); |
| 85 ASSERT(effect->getFilter()); | 85 DCHECK(effect->getFilter()); |
| 86 | 86 |
| 87 if (attrName == SVGNames::azimuthAttr) | 87 if (attrName == SVGNames::azimuthAttr) |
| 88 return lightSource->setAzimuth( | 88 return lightSource->setAzimuth( |
| 89 lightElement->azimuth()->currentValue()->value()); | 89 lightElement->azimuth()->currentValue()->value()); |
| 90 if (attrName == SVGNames::elevationAttr) | 90 if (attrName == SVGNames::elevationAttr) |
| 91 return lightSource->setElevation( | 91 return lightSource->setElevation( |
| 92 lightElement->elevation()->currentValue()->value()); | 92 lightElement->elevation()->currentValue()->value()); |
| 93 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || | 93 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || |
| 94 attrName == SVGNames::zAttr) | 94 attrName == SVGNames::zAttr) |
| 95 return lightSource->setPosition( | 95 return lightSource->setPosition( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 137 |
| 138 // The light element has different attribute names. | 138 // The light element has different attribute names. |
| 139 primitiveAttributeChanged(attrName); | 139 primitiveAttributeChanged(attrName); |
| 140 } | 140 } |
| 141 | 141 |
| 142 FilterEffect* SVGFEDiffuseLightingElement::build( | 142 FilterEffect* SVGFEDiffuseLightingElement::build( |
| 143 SVGFilterBuilder* filterBuilder, | 143 SVGFilterBuilder* filterBuilder, |
| 144 Filter* filter) { | 144 Filter* filter) { |
| 145 FilterEffect* input1 = filterBuilder->getEffectById( | 145 FilterEffect* input1 = filterBuilder->getEffectById( |
| 146 AtomicString(m_in1->currentValue()->value())); | 146 AtomicString(m_in1->currentValue()->value())); |
| 147 ASSERT(input1); | 147 DCHECK(input1); |
| 148 | 148 |
| 149 LayoutObject* layoutObject = this->layoutObject(); | 149 LayoutObject* layoutObject = this->layoutObject(); |
| 150 if (!layoutObject) | 150 if (!layoutObject) |
| 151 return nullptr; | 151 return nullptr; |
| 152 | 152 |
| 153 ASSERT(layoutObject->style()); | 153 DCHECK(layoutObject->style()); |
| 154 Color color = layoutObject->style()->svgStyle().lightingColor(); | 154 Color color = layoutObject->style()->svgStyle().lightingColor(); |
| 155 | 155 |
| 156 const SVGFELightElement* lightNode = | 156 const SVGFELightElement* lightNode = |
| 157 SVGFELightElement::findLightElement(*this); | 157 SVGFELightElement::findLightElement(*this); |
| 158 RefPtr<LightSource> lightSource = | 158 RefPtr<LightSource> lightSource = |
| 159 lightNode ? lightNode->lightSource(filter) : nullptr; | 159 lightNode ? lightNode->lightSource(filter) : nullptr; |
| 160 | 160 |
| 161 FilterEffect* effect = FEDiffuseLighting::create( | 161 FilterEffect* effect = FEDiffuseLighting::create( |
| 162 filter, color, m_surfaceScale->currentValue()->value(), | 162 filter, color, m_surfaceScale->currentValue()->value(), |
| 163 m_diffuseConstant->currentValue()->value(), std::move(lightSource)); | 163 m_diffuseConstant->currentValue()->value(), std::move(lightSource)); |
| 164 effect->inputEffects().push_back(input1); | 164 effect->inputEffects().push_back(input1); |
| 165 return effect; | 165 return effect; |
| 166 } | 166 } |
| 167 | 167 |
| 168 } // namespace blink | 168 } // namespace blink |
| OLD | NEW |