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 "include/core/SkRect.h" 12 #include "include/core/SkRefCnt.h" 13 #include "modules/sksg/include/SkSGRenderNode.h" 14 15 #include <cstdint> 16 17 class SkCanvas; 18 class SkMatrix; 19 struct SkPoint; 20 21 namespace sksg { 22 class InvalidationController; 23 24 /** 25 * Base class for nodes which apply some transformation when rendering 26 * their descendants. 27 * 28 * This includes transforms, clipping, filters, etc. 29 */ 30 class EffectNode : public RenderNode { 31 protected: 32 explicit EffectNode(sk_sp<RenderNode>, uint32_t inval_traits = 0); 33 ~EffectNode() override; 34 35 void onRender(SkCanvas*, const RenderContext*) const override; 36 const RenderNode* onNodeAt(const SkPoint&) const override; 37 38 SkRect onRevalidate(InvalidationController*, const SkMatrix&) override; 39 getChild()40 const sk_sp<RenderNode>& getChild() const { return fChild; } 41 42 private: 43 sk_sp<RenderNode> fChild; 44 45 using INHERITED = RenderNode; 46 }; 47 48 } // namespace sksg 49 50 #endif // SkSGEffectNode_DEFINED 51