SkSGEffectNode.h 993 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. #ifndef SkSGEffectNode_DEFINED
  8. #define SkSGEffectNode_DEFINED
  9. #include "modules/sksg/include/SkSGRenderNode.h"
  10. namespace sksg {
  11. /**
  12. * Base class for nodes which apply some transformation when rendering
  13. * their descendants.
  14. *
  15. * This includes transforms, clipping, filters, etc.
  16. */
  17. class EffectNode : public RenderNode {
  18. protected:
  19. explicit EffectNode(sk_sp<RenderNode>, uint32_t inval_traits = 0);
  20. ~EffectNode() override;
  21. void onRender(SkCanvas*, const RenderContext*) const override;
  22. const RenderNode* onNodeAt(const SkPoint&) const override;
  23. SkRect onRevalidate(InvalidationController*, const SkMatrix&) override;
  24. const sk_sp<RenderNode>& getChild() const { return fChild; }
  25. private:
  26. sk_sp<RenderNode> fChild;
  27. typedef RenderNode INHERITED;
  28. };
  29. } // namespace sksg
  30. #endif // SkSGEffectNode_DEFINED