Skia
2D Graphics Library
SkSGGroup.h
Go to the documentation of this file.
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 
8 #ifndef SkSGGroup_DEFINED
9 #define SkSGGroup_DEFINED
10 
12 
13 #include <vector>
14 
15 namespace sksg {
16 
20 class Group : public RenderNode {
21 public:
22  static sk_sp<Group> Make() {
23  return sk_sp<Group>(new Group(std::vector<sk_sp<RenderNode>>()));
24  }
25 
26  static sk_sp<Group> Make(std::vector<sk_sp<RenderNode>> children) {
27  return sk_sp<Group>(new Group(std::move(children)));
28  }
29 
32 
33  size_t size() const { return fChildren.size(); }
34  bool empty() const { return fChildren.empty(); }
35  void clear();
36 
37 protected:
38  Group();
39  explicit Group(std::vector<sk_sp<RenderNode>>);
40  ~Group() override;
41 
42  void onRender(SkCanvas*, const RenderContext*) const override;
43  const RenderNode* onNodeAt(const SkPoint&) const override;
44 
46 
47 private:
48  std::vector<sk_sp<RenderNode>> fChildren;
49  bool fRequiresIsolation = true;
50 
51  using INHERITED = RenderNode;
52 };
53 
54 } // namespace sksg
55 
56 #endif // SkSGGroup_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 node, grouping together multiple descendants.
Definition: SkSGGroup.h:20
SkRect onRevalidate(InvalidationController *, const SkMatrix &) override
Group(std::vector< sk_sp< RenderNode >>)
void removeChild(const sk_sp< RenderNode > &)
void onRender(SkCanvas *, const RenderContext *) const override
~Group() override
static sk_sp< Group > Make()
Definition: SkSGGroup.h:22
const RenderNode * onNodeAt(const SkPoint &) const override
void addChild(sk_sp< RenderNode >)
bool empty() const
Definition: SkSGGroup.h:34
static sk_sp< Group > Make(std::vector< sk_sp< RenderNode >> children)
Definition: SkSGGroup.h:26
size_t size() const
Definition: SkSGGroup.h:33
void clear()
Receiver for invalidation events.
Definition: SkSGInvalidationController.h:25
friend class RenderNode
Definition: SkSGNode.h:93
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