Flutter Engine
The Flutter Engine
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
11#include "include/core/SkRect.h"
14
15#include <cstddef>
16#include <utility>
17#include <vector>
18
19class SkCanvas;
20class SkMatrix;
21struct SkPoint;
22
23namespace sksg {
24class InvalidationController;
25
26/**
27 * Concrete node, grouping together multiple descendants.
28 */
29class Group : public RenderNode {
30public:
31 static sk_sp<Group> Make() {
32 return sk_sp<Group>(new Group(std::vector<sk_sp<RenderNode>>()));
33 }
34
35 static sk_sp<Group> Make(std::vector<sk_sp<RenderNode>> children) {
36 return sk_sp<Group>(new Group(std::move(children)));
37 }
38
40 void removeChild(const sk_sp<RenderNode>&);
41
42 size_t size() const { return fChildren.size(); }
43 bool empty() const { return fChildren.empty(); }
44 void clear();
45
46protected:
48 explicit Group(std::vector<sk_sp<RenderNode>>);
49 ~Group() override;
50
51 void onRender(SkCanvas*, const RenderContext*) const override;
52 const RenderNode* onNodeAt(const SkPoint&) const override;
53
55
56private:
57 std::vector<sk_sp<RenderNode>> fChildren;
58 bool fRequiresIsolation = true;
59
60 using INHERITED = RenderNode;
61};
62
63} // namespace sksg
64
65#endif // SkSGGroup_DEFINED
SkRect onRevalidate(InvalidationController *, const SkMatrix &) override
Definition: SkSGGroup.cpp:88
void removeChild(const sk_sp< RenderNode > &)
Definition: SkSGGroup.cpp:59
void onRender(SkCanvas *, const RenderContext *) const override
Definition: SkSGGroup.cpp:68
~Group() override
Definition: SkSGGroup.cpp:32
void addChild(sk_sp< RenderNode >)
Definition: SkSGGroup.cpp:45
const RenderNode * onNodeAt(const SkPoint &) const override
Definition: SkSGGroup.cpp:78
bool empty() const
Definition: SkSGGroup.h:43
static sk_sp< Group > Make(std::vector< sk_sp< RenderNode > > children)
Definition: SkSGGroup.h:35
static sk_sp< Group > Make()
Definition: SkSGGroup.h:31
size_t size() const
Definition: SkSGGroup.h:42
void clear()
Definition: SkSGGroup.cpp:38
friend class RenderNode
Definition: SkSGNode.h:94
Definition: Skottie.h:32