| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 SVGFilterPrimitiveStandardAttributes::trace(visitor); | 51 SVGFilterPrimitiveStandardAttributes::trace(visitor); |
| 52 } | 52 } |
| 53 | 53 |
| 54 DEFINE_NODE_FACTORY(SVGFEDiffuseLightingElement) | 54 DEFINE_NODE_FACTORY(SVGFEDiffuseLightingElement) |
| 55 | 55 |
| 56 bool SVGFEDiffuseLightingElement::setFilterEffectAttribute(FilterEffect* effect,
const QualifiedName& attrName) | 56 bool SVGFEDiffuseLightingElement::setFilterEffectAttribute(FilterEffect* effect,
const QualifiedName& attrName) |
| 57 { | 57 { |
| 58 FEDiffuseLighting* diffuseLighting = static_cast<FEDiffuseLighting*>(effect)
; | 58 FEDiffuseLighting* diffuseLighting = static_cast<FEDiffuseLighting*>(effect)
; |
| 59 | 59 |
| 60 if (attrName == SVGNames::lighting_colorAttr) { | 60 if (attrName == SVGNames::lighting_colorAttr) { |
| 61 LayoutObject* renderer = this->layoutObject(); | 61 LayoutObject* layoutObject = this->layoutObject(); |
| 62 ASSERT(renderer); | 62 ASSERT(layoutObject); |
| 63 ASSERT(renderer->style()); | 63 ASSERT(layoutObject->style()); |
| 64 return diffuseLighting->setLightingColor(renderer->style()->svgStyle().l
ightingColor()); | 64 return diffuseLighting->setLightingColor(layoutObject->style()->svgStyle
().lightingColor()); |
| 65 } | 65 } |
| 66 if (attrName == SVGNames::surfaceScaleAttr) | 66 if (attrName == SVGNames::surfaceScaleAttr) |
| 67 return diffuseLighting->setSurfaceScale(m_surfaceScale->currentValue()->
value()); | 67 return diffuseLighting->setSurfaceScale(m_surfaceScale->currentValue()->
value()); |
| 68 if (attrName == SVGNames::diffuseConstantAttr) | 68 if (attrName == SVGNames::diffuseConstantAttr) |
| 69 return diffuseLighting->setDiffuseConstant(m_diffuseConstant->currentVal
ue()->value()); | 69 return diffuseLighting->setDiffuseConstant(m_diffuseConstant->currentVal
ue()->value()); |
| 70 if (attrName == SVGNames::kernelUnitLengthAttr) { | 70 if (attrName == SVGNames::kernelUnitLengthAttr) { |
| 71 bool changedX = diffuseLighting->setKernelUnitLengthX(m_kernelUnitLength
->firstNumber()->currentValue()->value()); | 71 bool changedX = diffuseLighting->setKernelUnitLengthX(m_kernelUnitLength
->firstNumber()->currentValue()->value()); |
| 72 bool changedY = diffuseLighting->setKernelUnitLengthY(m_kernelUnitLength
->secondNumber()->currentValue()->value()); | 72 bool changedY = diffuseLighting->setKernelUnitLengthY(m_kernelUnitLength
->secondNumber()->currentValue()->value()); |
| 73 return changedX || changedY; | 73 return changedX || changedY; |
| 74 } | 74 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 { | 129 { |
| 130 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); | 130 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); |
| 131 | 131 |
| 132 if (!input1) | 132 if (!input1) |
| 133 return nullptr; | 133 return nullptr; |
| 134 | 134 |
| 135 SVGFELightElement* lightNode = SVGFELightElement::findLightElement(*this); | 135 SVGFELightElement* lightNode = SVGFELightElement::findLightElement(*this); |
| 136 if (!lightNode) | 136 if (!lightNode) |
| 137 return nullptr; | 137 return nullptr; |
| 138 | 138 |
| 139 LayoutObject* renderer = this->layoutObject(); | 139 LayoutObject* layoutObject = this->layoutObject(); |
| 140 if (!renderer) | 140 if (!layoutObject) |
| 141 return nullptr; | 141 return nullptr; |
| 142 | 142 |
| 143 ASSERT(renderer->style()); | 143 ASSERT(layoutObject->style()); |
| 144 Color color = renderer->style()->svgStyle().lightingColor(); | 144 Color color = layoutObject->style()->svgStyle().lightingColor(); |
| 145 | 145 |
| 146 RefPtr<LightSource> lightSource = lightNode->lightSource(filter); | 146 RefPtr<LightSource> lightSource = lightNode->lightSource(filter); |
| 147 RefPtrWillBeRawPtr<FilterEffect> effect = FEDiffuseLighting::create(filter,
color, m_surfaceScale->currentValue()->value(), m_diffuseConstant->currentValue(
)->value(), | 147 RefPtrWillBeRawPtr<FilterEffect> effect = FEDiffuseLighting::create(filter,
color, m_surfaceScale->currentValue()->value(), m_diffuseConstant->currentValue(
)->value(), |
| 148 kernelUnitLengthX()->currentValue()->value(), kernelUnitLengthY()->curre
ntValue()->value(), lightSource.release()); | 148 kernelUnitLengthX()->currentValue()->value(), kernelUnitLengthY()->curre
ntValue()->value(), lightSource.release()); |
| 149 effect->inputEffects().append(input1); | 149 effect->inputEffects().append(input1); |
| 150 return effect.release(); | 150 return effect.release(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 } // namespace blink | 153 } // namespace blink |
| OLD | NEW |