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 #include "modules/sksg/include/SkSGEffectNode.h" 8 9 #include "include/private/base/SkAssert.h" 10 #include "modules/sksg/include/SkSGNode.h" 11 12 #include <utility> 13 14 class SkCanvas; 15 class SkMatrix; 16 struct SkPoint; 17 18 namespace sksg { 19 class InvalidationController; 20 EffectNode(sk_sp<RenderNode> child,uint32_t inval_traits)21EffectNode::EffectNode(sk_sp<RenderNode> child, uint32_t inval_traits) 22 : INHERITED(inval_traits) 23 , fChild(std::move(child)) { 24 this->observeInval(fChild); 25 } 26 ~EffectNode()27EffectNode::~EffectNode() { 28 this->unobserveInval(fChild); 29 } 30 onRender(SkCanvas * canvas,const RenderContext * ctx) const31void EffectNode::onRender(SkCanvas* canvas, const RenderContext* ctx) const { 32 fChild->render(canvas, ctx); 33 } 34 onNodeAt(const SkPoint & p) const35const RenderNode* EffectNode::onNodeAt(const SkPoint& p) const { 36 return fChild->nodeAt(p); 37 } 38 onRevalidate(InvalidationController * ic,const SkMatrix & ctm)39SkRect EffectNode::onRevalidate(InvalidationController* ic, const SkMatrix& ctm) { 40 SkASSERT(this->hasInval()); 41 42 return fChild->revalidate(ic, ctm); 43 } 44 45 } // namespace sksg 46