| 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 |
|
| 21 |
EffectNode::EffectNode(sk_sp<RenderNode> child, uint32_t inval_traits) |
| 22 |
: INHERITED(inval_traits) |
| 23 |
, fChild(std::move(child)) { |
| 24 |
this->observeInval(fChild); |
| 25 |
} |
| 26 |
|
| 27 |
EffectNode::~EffectNode() { |
| 28 |
this->unobserveInval(fChild); |
| 29 |
} |
| 30 |
|
| 31 |
void EffectNode::onRender(SkCanvas* canvas, const RenderContext* ctx) const { |
| 32 |
fChild->render(canvas, ctx); |
| 33 |
} |
| 34 |
|
| 35 |
const RenderNode* EffectNode::onNodeAt(const SkPoint& p) const { |
| 36 |
return fChild->nodeAt(p); |
| 37 |
} |
| 38 |
|
| 39 |
SkRect EffectNode::onRevalidate(InvalidationController* ic, const SkMatrix& ctm) { |
| 40 |
SkASSERT(this->hasInval()); |
| 41 |
|
| 42 |
return fChild->revalidate(ic, ctm); |
| 43 |
} |
| 44 |
|
| 45 |
} // namespace sksg |