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 11 matching lines...) Expand all Loading... |
22 #include "core/svg/SVGFEDiffuseLightingElement.h" | 22 #include "core/svg/SVGFEDiffuseLightingElement.h" |
23 | 23 |
24 #include "core/rendering/style/RenderStyle.h" | 24 #include "core/rendering/style/RenderStyle.h" |
25 #include "core/svg/SVGParserUtilities.h" | 25 #include "core/svg/SVGParserUtilities.h" |
26 #include "core/svg/graphics/filters/SVGFilterBuilder.h" | 26 #include "core/svg/graphics/filters/SVGFilterBuilder.h" |
27 #include "platform/graphics/filters/FEDiffuseLighting.h" | 27 #include "platform/graphics/filters/FEDiffuseLighting.h" |
28 #include "platform/graphics/filters/FilterEffect.h" | 28 #include "platform/graphics/filters/FilterEffect.h" |
29 | 29 |
30 namespace WebCore { | 30 namespace WebCore { |
31 | 31 |
32 SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement(Document& document) | 32 inline SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement(Document& docume
nt) |
33 : SVGFilterPrimitiveStandardAttributes(SVGNames::feDiffuseLightingTag, docum
ent) | 33 : SVGFilterPrimitiveStandardAttributes(SVGNames::feDiffuseLightingTag, docum
ent) |
34 , m_diffuseConstant(SVGAnimatedNumber::create(this, SVGNames::diffuseConstan
tAttr, SVGNumber::create(1))) | 34 , m_diffuseConstant(SVGAnimatedNumber::create(this, SVGNames::diffuseConstan
tAttr, SVGNumber::create(1))) |
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 ScriptWrappable::init(this); | 39 ScriptWrappable::init(this); |
40 | 40 |
41 addToPropertyMap(m_diffuseConstant); | 41 addToPropertyMap(m_diffuseConstant); |
42 addToPropertyMap(m_surfaceScale); | 42 addToPropertyMap(m_surfaceScale); |
43 addToPropertyMap(m_kernelUnitLength); | 43 addToPropertyMap(m_kernelUnitLength); |
44 addToPropertyMap(m_in1); | 44 addToPropertyMap(m_in1); |
45 } | 45 } |
46 | 46 |
| 47 DEFINE_NODE_FACTORY(SVGFEDiffuseLightingElement) |
| 48 |
47 bool SVGFEDiffuseLightingElement::isSupportedAttribute(const QualifiedName& attr
Name) | 49 bool SVGFEDiffuseLightingElement::isSupportedAttribute(const QualifiedName& attr
Name) |
48 { | 50 { |
49 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 51 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
50 if (supportedAttributes.isEmpty()) { | 52 if (supportedAttributes.isEmpty()) { |
51 supportedAttributes.add(SVGNames::inAttr); | 53 supportedAttributes.add(SVGNames::inAttr); |
52 supportedAttributes.add(SVGNames::diffuseConstantAttr); | 54 supportedAttributes.add(SVGNames::diffuseConstantAttr); |
53 supportedAttributes.add(SVGNames::surfaceScaleAttr); | 55 supportedAttributes.add(SVGNames::surfaceScaleAttr); |
54 supportedAttributes.add(SVGNames::kernelUnitLengthAttr); | 56 supportedAttributes.add(SVGNames::kernelUnitLengthAttr); |
55 supportedAttributes.add(SVGNames::lighting_colorAttr); // Even though it
's a SVG-CSS property, we override its handling here. | 57 supportedAttributes.add(SVGNames::lighting_colorAttr); // Even though it
's a SVG-CSS property, we override its handling here. |
56 } | 58 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 ASSERT(renderer->style()); | 179 ASSERT(renderer->style()); |
178 Color color = renderer->style()->svgStyle()->lightingColor(); | 180 Color color = renderer->style()->svgStyle()->lightingColor(); |
179 | 181 |
180 RefPtr<FilterEffect> effect = FEDiffuseLighting::create(filter, color, m_sur
faceScale->currentValue()->value(), m_diffuseConstant->currentValue()->value(), | 182 RefPtr<FilterEffect> effect = FEDiffuseLighting::create(filter, color, m_sur
faceScale->currentValue()->value(), m_diffuseConstant->currentValue()->value(), |
181 kernelUnitLengthX()->currentValue()->value(), kernelUnitLengthY()->curre
ntValue()->value(), lightSource.release()); | 183 kernelUnitLengthX()->currentValue()->value(), kernelUnitLengthY()->curre
ntValue()->value(), lightSource.release()); |
182 effect->inputEffects().append(input1); | 184 effect->inputEffects().append(input1); |
183 return effect.release(); | 185 return effect.release(); |
184 } | 186 } |
185 | 187 |
186 } | 188 } |
OLD | NEW |