| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com> | 4 * Copyright (C) 2005 Oliver Hunt <oliver@nerget.com> |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 ASSERT(layoutObject); | 66 ASSERT(layoutObject); |
| 67 ASSERT(layoutObject->style()); | 67 ASSERT(layoutObject->style()); |
| 68 return specularLighting->setLightingColor(layoutObject->style()->svgStyl
e().lightingColor()); | 68 return specularLighting->setLightingColor(layoutObject->style()->svgStyl
e().lightingColor()); |
| 69 } | 69 } |
| 70 if (attrName == SVGNames::surfaceScaleAttr) | 70 if (attrName == SVGNames::surfaceScaleAttr) |
| 71 return specularLighting->setSurfaceScale(m_surfaceScale->currentValue()-
>value()); | 71 return specularLighting->setSurfaceScale(m_surfaceScale->currentValue()-
>value()); |
| 72 if (attrName == SVGNames::specularConstantAttr) | 72 if (attrName == SVGNames::specularConstantAttr) |
| 73 return specularLighting->setSpecularConstant(m_specularConstant->current
Value()->value()); | 73 return specularLighting->setSpecularConstant(m_specularConstant->current
Value()->value()); |
| 74 if (attrName == SVGNames::specularExponentAttr) | 74 if (attrName == SVGNames::specularExponentAttr) |
| 75 return specularLighting->setSpecularExponent(m_specularExponent->current
Value()->value()); | 75 return specularLighting->setSpecularExponent(m_specularExponent->current
Value()->value()); |
| 76 if (attrName == SVGNames::kernelUnitLengthAttr) { | |
| 77 bool changedX = specularLighting->setKernelUnitLengthX(m_kernelUnitLengt
h->firstNumber()->currentValue()->value()); | |
| 78 bool changedY = specularLighting->setKernelUnitLengthY(m_kernelUnitLengt
h->secondNumber()->currentValue()->value()); | |
| 79 return changedX || changedY; | |
| 80 } | |
| 81 | 76 |
| 82 LightSource* lightSource = const_cast<LightSource*>(specularLighting->lightS
ource()); | 77 LightSource* lightSource = const_cast<LightSource*>(specularLighting->lightS
ource()); |
| 83 SVGFELightElement* lightElement = SVGFELightElement::findLightElement(*this)
; | 78 SVGFELightElement* lightElement = SVGFELightElement::findLightElement(*this)
; |
| 84 ASSERT(lightSource); | 79 ASSERT(lightSource); |
| 85 ASSERT(lightElement); | 80 ASSERT(lightElement); |
| 86 ASSERT(effect->filter()); | 81 ASSERT(effect->filter()); |
| 87 | 82 |
| 88 if (attrName == SVGNames::azimuthAttr) | 83 if (attrName == SVGNames::azimuthAttr) |
| 89 return lightSource->setAzimuth(lightElement->azimuth()->currentValue()->
value()); | 84 return lightSource->setAzimuth(lightElement->azimuth()->currentValue()->
value()); |
| 90 if (attrName == SVGNames::elevationAttr) | 85 if (attrName == SVGNames::elevationAttr) |
| 91 return lightSource->setElevation(lightElement->elevation()->currentValue
()->value()); | 86 return lightSource->setElevation(lightElement->elevation()->currentValue
()->value()); |
| 92 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName =
= SVGNames::zAttr) | 87 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName =
= SVGNames::zAttr) |
| 93 return lightSource->setPosition(effect->filter()->resolve3dPoint(lightEl
ement->position())); | 88 return lightSource->setPosition(effect->filter()->resolve3dPoint(lightEl
ement->position())); |
| 94 if (attrName == SVGNames::pointsAtXAttr || attrName == SVGNames::pointsAtYAt
tr || attrName == SVGNames::pointsAtZAttr) | 89 if (attrName == SVGNames::pointsAtXAttr || attrName == SVGNames::pointsAtYAt
tr || attrName == SVGNames::pointsAtZAttr) |
| 95 return lightSource->setPointsAt(effect->filter()->resolve3dPoint(lightEl
ement->pointsAt())); | 90 return lightSource->setPointsAt(effect->filter()->resolve3dPoint(lightEl
ement->pointsAt())); |
| 96 if (attrName == SVGNames::specularExponentAttr) | 91 if (attrName == SVGNames::specularExponentAttr) |
| 97 return lightSource->setSpecularExponent(lightElement->specularExponent()
->currentValue()->value()); | 92 return lightSource->setSpecularExponent(lightElement->specularExponent()
->currentValue()->value()); |
| 98 if (attrName == SVGNames::limitingConeAngleAttr) | 93 if (attrName == SVGNames::limitingConeAngleAttr) |
| 99 return lightSource->setLimitingConeAngle(lightElement->limitingConeAngle
()->currentValue()->value()); | 94 return lightSource->setLimitingConeAngle(lightElement->limitingConeAngle
()->currentValue()->value()); |
| 100 | 95 |
| 101 ASSERT_NOT_REACHED(); | 96 ASSERT_NOT_REACHED(); |
| 102 return false; | 97 return false; |
| 103 } | 98 } |
| 104 | 99 |
| 105 void SVGFESpecularLightingElement::svgAttributeChanged(const QualifiedName& attr
Name) | 100 void SVGFESpecularLightingElement::svgAttributeChanged(const QualifiedName& attr
Name) |
| 106 { | 101 { |
| 107 if (attrName == SVGNames::surfaceScaleAttr | 102 if (attrName == SVGNames::surfaceScaleAttr |
| 108 || attrName == SVGNames::specularConstantAttr | 103 || attrName == SVGNames::specularConstantAttr |
| 109 || attrName == SVGNames::specularExponentAttr | 104 || attrName == SVGNames::specularExponentAttr) { |
| 110 || attrName == SVGNames::kernelUnitLengthAttr) { | |
| 111 SVGElement::InvalidationGuard invalidationGuard(this); | 105 SVGElement::InvalidationGuard invalidationGuard(this); |
| 112 primitiveAttributeChanged(attrName); | 106 primitiveAttributeChanged(attrName); |
| 113 return; | 107 return; |
| 114 } | 108 } |
| 115 | 109 |
| 116 if (attrName == SVGNames::inAttr) { | 110 if (attrName == SVGNames::inAttr) { |
| 117 SVGElement::InvalidationGuard invalidationGuard(this); | 111 SVGElement::InvalidationGuard invalidationGuard(this); |
| 118 invalidate(); | 112 invalidate(); |
| 119 return; | 113 return; |
| 120 } | 114 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 144 | 138 |
| 145 LayoutObject* layoutObject = this->layoutObject(); | 139 LayoutObject* layoutObject = this->layoutObject(); |
| 146 if (!layoutObject) | 140 if (!layoutObject) |
| 147 return nullptr; | 141 return nullptr; |
| 148 | 142 |
| 149 ASSERT(layoutObject->style()); | 143 ASSERT(layoutObject->style()); |
| 150 Color color = layoutObject->style()->svgStyle().lightingColor(); | 144 Color color = layoutObject->style()->svgStyle().lightingColor(); |
| 151 | 145 |
| 152 RefPtr<LightSource> lightSource = lightNode->lightSource(filter); | 146 RefPtr<LightSource> lightSource = lightNode->lightSource(filter); |
| 153 RefPtrWillBeRawPtr<FilterEffect> effect = FESpecularLighting::create(filter,
color, m_surfaceScale->currentValue()->value(), m_specularConstant->currentValu
e()->value(), | 147 RefPtrWillBeRawPtr<FilterEffect> effect = FESpecularLighting::create(filter,
color, m_surfaceScale->currentValue()->value(), m_specularConstant->currentValu
e()->value(), |
| 154 m_specularExponent->currentValue()->value(), kernelUnitLengthX()->curren
tValue()->value(), kernelUnitLengthY()->currentValue()->value(), lightSource.rel
ease()); | 148 m_specularExponent->currentValue()->value(), lightSource.release()); |
| 155 effect->inputEffects().append(input1); | 149 effect->inputEffects().append(input1); |
| 156 return effect.release(); | 150 return effect.release(); |
| 157 } | 151 } |
| 158 | 152 |
| 159 } // namespace blink | 153 } // namespace blink |
| OLD | NEW |