Skia
2D Graphics Library
SkSGClipEffect.h
Go to the documentation of this file.
1 /*
2  * Copyright 2018 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 SkSGClipEffect_DEFINED
9 #define SkSGClipEffect_DEFINED
10 
12 
13 namespace sksg {
14 
15 class GeometryNode;
16 
21 class ClipEffect final : public EffectNode {
22 public:
24  bool aa = false, bool force_clip = false) {
25  return (child && clip)
26  ? sk_sp<ClipEffect>(new ClipEffect(std::move(child), std::move(clip), aa, force_clip))
27  : nullptr;
28  }
29 
30  ~ClipEffect() override;
31 
32 protected:
33  ClipEffect(sk_sp<RenderNode>, sk_sp<GeometryNode>, bool aa, bool force_clip);
34 
35  void onRender(SkCanvas*, const RenderContext*) const override;
36  const RenderNode* onNodeAt(const SkPoint&) const override;
37 
39 
40 private:
41  const sk_sp<GeometryNode> fClipNode;
42  const bool fAntiAlias,
43  fForceClip;
44 
45  bool fNoop = false;
46 
47  using INHERITED = EffectNode;
48 };
49 
50 } // namespace sksg
51 
52 #endif // SkSGClipEffect_DEFINED
SkCanvas provides an interface for drawing, and how the drawing is clipped and transformed.
Definition: SkCanvas.h:99
SkMatrix holds a 3x3 matrix for transforming coordinates.
Definition: SkMatrix.h:53
Shared pointer class to wrap classes that support a ref()/unref() interface.
Definition: SkRefCnt.h:220
Concrete Effect node, applying a clip to its descendants.
Definition: SkSGClipEffect.h:21
static sk_sp< ClipEffect > Make(sk_sp< RenderNode > child, sk_sp< GeometryNode > clip, bool aa=false, bool force_clip=false)
Definition: SkSGClipEffect.h:23
~ClipEffect() override
void onRender(SkCanvas *, const RenderContext *) const override
SkRect onRevalidate(InvalidationController *, const SkMatrix &) override
ClipEffect(sk_sp< RenderNode >, sk_sp< GeometryNode >, bool aa, bool force_clip)
const RenderNode * onNodeAt(const SkPoint &) const override
Base class for nodes which apply some transformation when rendering their descendants.
Definition: SkSGEffectNode.h:21
EffectNode(sk_sp< RenderNode >, uint32_t inval_traits=0)
Receiver for invalidation events.
Definition: SkSGInvalidationController.h:25
Base class for nodes which can render to a canvas.
Definition: SkSGRenderNode.h:27
Definition: Skottie.h:30
SkRect holds four float coordinates describing the upper and lower bounds of a rectangle.
Definition: SkRect.h:582
Definition: SkSGRenderNode.h:53