Flutter Engine
The Flutter Engine
SkSVGContainer.h
Go to the documentation of this file.
1/*
2 * Copyright 2016 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 SkSVGContainer_DEFINED
9#define SkSVGContainer_DEFINED
10
13
15public:
16 void appendChild(sk_sp<SkSVGNode>) override;
17
18protected:
19 explicit SkSVGContainer(SkSVGTag);
20
21 void onRender(const SkSVGRenderContext&) const override;
22
23 SkPath onAsPath(const SkSVGRenderContext&) const override;
24
25 SkRect onObjectBoundingBox(const SkSVGRenderContext&) const override;
26
27 bool hasChildren() const final;
28
29 template <typename NodeType, typename Func>
30 void forEachChild(Func func) const {
31 for (const auto& child : fChildren) {
32 if (child->tag() == NodeType::tag) {
33 func(static_cast<const NodeType*>(child.get()));
34 }
35 }
36 }
37
38 // TODO: convert remaining direct users to iterators, and make the container private.
40
41private:
43};
44
45#endif // SkSVGContainer_DEFINED
#define SK_API
Definition: SkAPI.h:35
SkSVGTag
Definition: SkSVGNode.h:23
Definition: SkPath.h:59
skia_private::STArray< 1, sk_sp< SkSVGNode >, true > fChildren
void forEachChild(Func func) const
virtual SkRect onObjectBoundingBox(const SkSVGRenderContext &) const
Definition: SkSVGNode.h:179
virtual void onRender(const SkSVGRenderContext &) const =0
virtual void appendChild(sk_sp< SkSVGNode >)=0
virtual bool hasChildren() const
Definition: SkSVGNode.h:177
virtual SkPath onAsPath(const SkSVGRenderContext &) const =0