/src/mozilla-central/dom/svg/SVGFEDiffuseLightingElement.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #include "mozilla/dom/SVGFEDiffuseLightingElement.h" |
8 | | #include "mozilla/dom/SVGFEDiffuseLightingElementBinding.h" |
9 | | #include "nsSVGUtils.h" |
10 | | #include "nsSVGFilterInstance.h" |
11 | | |
12 | | NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FEDiffuseLighting) |
13 | | |
14 | | using namespace mozilla::gfx; |
15 | | |
16 | | namespace mozilla { |
17 | | namespace dom { |
18 | | |
19 | | JSObject* |
20 | | SVGFEDiffuseLightingElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) |
21 | 0 | { |
22 | 0 | return SVGFEDiffuseLightingElement_Binding::Wrap(aCx, this, aGivenProto); |
23 | 0 | } |
24 | | |
25 | | //---------------------------------------------------------------------- |
26 | | // nsINode methods |
27 | | |
28 | | NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEDiffuseLightingElement) |
29 | | |
30 | | //---------------------------------------------------------------------- |
31 | | |
32 | | already_AddRefed<SVGAnimatedString> |
33 | | SVGFEDiffuseLightingElement::In1() |
34 | 0 | { |
35 | 0 | return mStringAttributes[IN1].ToDOMAnimatedString(this); |
36 | 0 | } |
37 | | |
38 | | already_AddRefed<SVGAnimatedNumber> |
39 | | SVGFEDiffuseLightingElement::SurfaceScale() |
40 | 0 | { |
41 | 0 | return mNumberAttributes[SURFACE_SCALE].ToDOMAnimatedNumber(this); |
42 | 0 | } |
43 | | |
44 | | already_AddRefed<SVGAnimatedNumber> |
45 | | SVGFEDiffuseLightingElement::DiffuseConstant() |
46 | 0 | { |
47 | 0 | return mNumberAttributes[DIFFUSE_CONSTANT].ToDOMAnimatedNumber(this); |
48 | 0 | } |
49 | | |
50 | | already_AddRefed<SVGAnimatedNumber> |
51 | | SVGFEDiffuseLightingElement::KernelUnitLengthX() |
52 | 0 | { |
53 | 0 | return mNumberPairAttributes[KERNEL_UNIT_LENGTH].ToDOMAnimatedNumber( |
54 | 0 | nsSVGNumberPair::eFirst, this); |
55 | 0 | } |
56 | | |
57 | | already_AddRefed<SVGAnimatedNumber> |
58 | | SVGFEDiffuseLightingElement::KernelUnitLengthY() |
59 | 0 | { |
60 | 0 | return mNumberPairAttributes[KERNEL_UNIT_LENGTH].ToDOMAnimatedNumber( |
61 | 0 | nsSVGNumberPair::eSecond, this); |
62 | 0 | } |
63 | | |
64 | | FilterPrimitiveDescription |
65 | | SVGFEDiffuseLightingElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance, |
66 | | const IntRect& aFilterSubregion, |
67 | | const nsTArray<bool>& aInputsAreTainted, |
68 | | nsTArray<RefPtr<SourceSurface>>& aInputImages) |
69 | 0 | { |
70 | 0 | float diffuseConstant = mNumberAttributes[DIFFUSE_CONSTANT].GetAnimValue(); |
71 | 0 |
|
72 | 0 | DiffuseLightingAttributes atts; |
73 | 0 | atts.mLightingConstant = diffuseConstant; |
74 | 0 | if (!AddLightingAttributes(&atts, aInstance)) { |
75 | 0 | return FilterPrimitiveDescription(); |
76 | 0 | } |
77 | 0 | |
78 | 0 | return FilterPrimitiveDescription(AsVariant(std::move(atts))); |
79 | 0 | } |
80 | | |
81 | | bool |
82 | | SVGFEDiffuseLightingElement::AttributeAffectsRendering(int32_t aNameSpaceID, |
83 | | nsAtom* aAttribute) const |
84 | 0 | { |
85 | 0 | return SVGFEDiffuseLightingElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) || |
86 | 0 | (aNameSpaceID == kNameSpaceID_None && |
87 | 0 | aAttribute == nsGkAtoms::diffuseConstant); |
88 | 0 | } |
89 | | |
90 | | } // namespace dom |
91 | | } // namespace mozilla |