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