| 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 24 matching lines...) Expand all Loading... |
| 35 , m_surfaceScale(SVGAnimatedNumber::create(this, SVGNames::surfaceScaleAttr,
SVGNumber::create(1))) | 35 , m_surfaceScale(SVGAnimatedNumber::create(this, SVGNames::surfaceScaleAttr,
SVGNumber::create(1))) |
| 36 , m_kernelUnitLength(SVGAnimatedNumberOptionalNumber::create(this, SVGNames:
:kernelUnitLengthAttr)) | 36 , m_kernelUnitLength(SVGAnimatedNumberOptionalNumber::create(this, SVGNames:
:kernelUnitLengthAttr)) |
| 37 , m_in1(SVGAnimatedString::create(this, SVGNames::inAttr, SVGString::create(
))) | 37 , m_in1(SVGAnimatedString::create(this, SVGNames::inAttr, SVGString::create(
))) |
| 38 { | 38 { |
| 39 addToPropertyMap(m_diffuseConstant); | 39 addToPropertyMap(m_diffuseConstant); |
| 40 addToPropertyMap(m_surfaceScale); | 40 addToPropertyMap(m_surfaceScale); |
| 41 addToPropertyMap(m_kernelUnitLength); | 41 addToPropertyMap(m_kernelUnitLength); |
| 42 addToPropertyMap(m_in1); | 42 addToPropertyMap(m_in1); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void SVGFEDiffuseLightingElement::trace(Visitor* visitor) |
| 46 { |
| 47 visitor->trace(m_diffuseConstant); |
| 48 visitor->trace(m_surfaceScale); |
| 49 visitor->trace(m_kernelUnitLength); |
| 50 visitor->trace(m_in1); |
| 51 SVGFilterPrimitiveStandardAttributes::trace(visitor); |
| 52 } |
| 53 |
| 45 DEFINE_NODE_FACTORY(SVGFEDiffuseLightingElement) | 54 DEFINE_NODE_FACTORY(SVGFEDiffuseLightingElement) |
| 46 | 55 |
| 47 bool SVGFEDiffuseLightingElement::isSupportedAttribute(const QualifiedName& attr
Name) | 56 bool SVGFEDiffuseLightingElement::isSupportedAttribute(const QualifiedName& attr
Name) |
| 48 { | 57 { |
| 49 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 58 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 50 if (supportedAttributes.isEmpty()) { | 59 if (supportedAttributes.isEmpty()) { |
| 51 supportedAttributes.add(SVGNames::inAttr); | 60 supportedAttributes.add(SVGNames::inAttr); |
| 52 supportedAttributes.add(SVGNames::diffuseConstantAttr); | 61 supportedAttributes.add(SVGNames::diffuseConstantAttr); |
| 53 supportedAttributes.add(SVGNames::surfaceScaleAttr); | 62 supportedAttributes.add(SVGNames::surfaceScaleAttr); |
| 54 supportedAttributes.add(SVGNames::kernelUnitLengthAttr); | 63 supportedAttributes.add(SVGNames::kernelUnitLengthAttr); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 136 |
| 128 void SVGFEDiffuseLightingElement::lightElementAttributeChanged(const SVGFELightE
lement* lightElement, const QualifiedName& attrName) | 137 void SVGFEDiffuseLightingElement::lightElementAttributeChanged(const SVGFELightE
lement* lightElement, const QualifiedName& attrName) |
| 129 { | 138 { |
| 130 if (SVGFELightElement::findLightElement(*this) != lightElement) | 139 if (SVGFELightElement::findLightElement(*this) != lightElement) |
| 131 return; | 140 return; |
| 132 | 141 |
| 133 // The light element has different attribute names. | 142 // The light element has different attribute names. |
| 134 primitiveAttributeChanged(attrName); | 143 primitiveAttributeChanged(attrName); |
| 135 } | 144 } |
| 136 | 145 |
| 137 PassRefPtr<FilterEffect> SVGFEDiffuseLightingElement::build(SVGFilterBuilder* fi
lterBuilder, Filter* filter) | 146 PassRefPtrWillBeRawPtr<FilterEffect> SVGFEDiffuseLightingElement::build(SVGFilte
rBuilder* filterBuilder, Filter* filter) |
| 138 { | 147 { |
| 139 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); | 148 FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->curr
entValue()->value())); |
| 140 | 149 |
| 141 if (!input1) | 150 if (!input1) |
| 142 return nullptr; | 151 return nullptr; |
| 143 | 152 |
| 144 SVGFELightElement* lightNode = SVGFELightElement::findLightElement(*this); | 153 SVGFELightElement* lightNode = SVGFELightElement::findLightElement(*this); |
| 145 if (!lightNode) | 154 if (!lightNode) |
| 146 return nullptr; | 155 return nullptr; |
| 147 | 156 |
| 148 RenderObject* renderer = this->renderer(); | 157 RenderObject* renderer = this->renderer(); |
| 149 if (!renderer) | 158 if (!renderer) |
| 150 return nullptr; | 159 return nullptr; |
| 151 | 160 |
| 152 ASSERT(renderer->style()); | 161 ASSERT(renderer->style()); |
| 153 Color color = renderer->style()->svgStyle().lightingColor(); | 162 Color color = renderer->style()->svgStyle().lightingColor(); |
| 154 | 163 |
| 155 RefPtr<LightSource> lightSource = lightNode->lightSource(filter); | 164 RefPtr<LightSource> lightSource = lightNode->lightSource(filter); |
| 156 RefPtr<FilterEffect> effect = FEDiffuseLighting::create(filter, color, m_sur
faceScale->currentValue()->value(), m_diffuseConstant->currentValue()->value(), | 165 RefPtrWillBeRawPtr<FilterEffect> effect = FEDiffuseLighting::create(filter,
color, m_surfaceScale->currentValue()->value(), m_diffuseConstant->currentValue(
)->value(), |
| 157 kernelUnitLengthX()->currentValue()->value(), kernelUnitLengthY()->curre
ntValue()->value(), lightSource.release()); | 166 kernelUnitLengthX()->currentValue()->value(), kernelUnitLengthY()->curre
ntValue()->value(), lightSource.release()); |
| 158 effect->inputEffects().append(input1); | 167 effect->inputEffects().append(input1); |
| 159 return effect.release(); | 168 return effect.release(); |
| 160 } | 169 } |
| 161 | 170 |
| 162 } // namespace blink | 171 } // namespace blink |
| OLD | NEW |