1/*
2 * Copyright 2017 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkSGEffectNode_DEFINED
9#define SkSGEffectNode_DEFINED
10
11#include "modules/sksg/include/SkSGRenderNode.h"
12
13namespace sksg {
14
15/**
16 * Base class for nodes which apply some transformation when rendering
17 * their descendants.
18 *
19 * This includes transforms, clipping, filters, etc.
20 */
21class EffectNode : public RenderNode {
22protected:
23 explicit EffectNode(sk_sp<RenderNode>, uint32_t inval_traits = 0);
24 ~EffectNode() override;
25
26 void onRender(SkCanvas*, const RenderContext*) const override;
27 const RenderNode* onNodeAt(const SkPoint&) const override;
28
29 SkRect onRevalidate(InvalidationController*, const SkMatrix&) override;
30
31 const sk_sp<RenderNode>& getChild() const { return fChild; }
32
33private:
34 sk_sp<RenderNode> fChild;
35
36 typedef RenderNode INHERITED;
37};
38
39} // namespace sksg
40
41#endif // SkSGEffectNode_DEFINED
42