xref: /aosp_15_r20/external/skia/modules/sksg/include/SkSGPlane.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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 SkSGPlane_DEFINED
9 #define SkSGPlane_DEFINED
10 
11 #include "include/core/SkPath.h"
12 #include "include/core/SkRect.h"
13 #include "include/core/SkRefCnt.h"
14 #include "modules/sksg/include/SkSGGeometryNode.h"
15 
16 class SkCanvas;
17 class SkMatrix;
18 class SkPaint;
19 struct SkPoint;
20 
21 namespace sksg {
22 class InvalidationController;
23 
24 /**
25  * Concrete Geometry node, representing the whole canvas.
26  */
27 class Plane final : public GeometryNode {
28 public:
Make()29     static sk_sp<Plane> Make() { return sk_sp<Plane>(new Plane()); }
30 
31 protected:
32     void onClip(SkCanvas*, bool antiAlias) const override;
33     void onDraw(SkCanvas*, const SkPaint&) const override;
34     bool onContains(const SkPoint&)        const override;
35 
36     SkRect onRevalidate(InvalidationController*, const SkMatrix&) override;
37     SkPath onAsPath() const override;
38 
39 private:
40     Plane();
41 
42     using INHERITED = GeometryNode;
43 };
44 
45 } // namespace sksg
46 
47 #endif // SkSGPlane_DEFINED
48