Flutter Engine
The Flutter Engine
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
11#include "include/core/SkRect.h"
16
17#include <utility>
18
19class SkCanvas;
20class SkMatrix;
21struct SkPoint;
22
23namespace sksg {
24class InvalidationController;
25
26/**
27 * Concrete Effect node, applying a clip to its descendants.
28 *
29 */
30class ClipEffect final : public EffectNode {
31public:
33 bool aa = false, bool force_clip = false) {
34 return (child && clip)
35 ? sk_sp<ClipEffect>(new ClipEffect(std::move(child), std::move(clip), aa, force_clip))
36 : nullptr;
37 }
38
39 ~ClipEffect() override;
40
41protected:
42 ClipEffect(sk_sp<RenderNode>, sk_sp<GeometryNode>, bool aa, bool force_clip);
43
44 void onRender(SkCanvas*, const RenderContext*) const override;
45 const RenderNode* onNodeAt(const SkPoint&) const override;
46
48
49private:
50 const sk_sp<GeometryNode> fClipNode;
51 const bool fAntiAlias,
52 fForceClip;
53
54 bool fNoop = false;
55
56 using INHERITED = EffectNode;
57};
58
59} // namespace sksg
60
61#endif // SkSGClipEffect_DEFINED
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
Definition: SkPath.cpp:3892
~ClipEffect() override
void onRender(SkCanvas *, const RenderContext *) const override
static sk_sp< ClipEffect > Make(sk_sp< RenderNode > child, sk_sp< GeometryNode > clip, bool aa=false, bool force_clip=false)
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
EffectNode(sk_sp< RenderNode >, uint32_t inval_traits=0)
Definition: Skottie.h:32