/src/skia/modules/svg/include/SkSVGContainer.h
Line | Count | Source |
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 | | |
11 | | #include "include/private/base/SkTArray.h" |
12 | | #include "modules/svg/include/SkSVGTransformableNode.h" |
13 | | |
14 | | class SK_API SkSVGContainer : public SkSVGTransformableNode { |
15 | | public: |
16 | | void appendChild(sk_sp<SkSVGNode>) override; |
17 | | |
18 | | protected: |
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 | 373 | void forEachChild(Func func) const { |
31 | 1.36k | for (const auto& child : fChildren) { |
32 | 1.36k | if (child->tag() == NodeType::tag) { |
33 | 410 | func(static_cast<const NodeType*>(child.get())); |
34 | 410 | } |
35 | 1.36k | } |
36 | 373 | } SkSVGFeMerge.cpp:void SkSVGContainer::forEachChild<SkSVGFeMergeNode, SkSVGFeMerge::onMakeImageFilter(SkSVGRenderContext const&, SkSVGFilterContext const&) const::$_0>(SkSVGFeMerge::onMakeImageFilter(SkSVGRenderContext const&, SkSVGFilterContext const&) const::$_0) const Line | Count | Source | 30 | 11 | void forEachChild(Func func) const { | 31 | 55 | for (const auto& child : fChildren) { | 32 | 55 | if (child->tag() == NodeType::tag) { | 33 | 22 | func(static_cast<const NodeType*>(child.get())); | 34 | 22 | } | 35 | 55 | } | 36 | 11 | } |
SkSVGFeMerge.cpp:void SkSVGContainer::forEachChild<SkSVGFeMergeNode, SkSVGFeMerge::getInputs() const::$_0>(SkSVGFeMerge::getInputs() const::$_0) const Line | Count | Source | 30 | 22 | void forEachChild(Func func) const { | 31 | 110 | for (const auto& child : fChildren) { | 32 | 110 | if (child->tag() == NodeType::tag) { | 33 | 44 | func(static_cast<const NodeType*>(child.get())); | 34 | 44 | } | 35 | 110 | } | 36 | 22 | } |
SkSVGGradient.cpp:void SkSVGContainer::forEachChild<SkSVGStop, SkSVGGradient::collectColorStops(SkSVGRenderContext const&, skia_private::STArray<2, float, true>*, skia_private::STArray<2, SkRGBA4f<(SkAlphaType)3>, true>*) const::$_0>(SkSVGGradient::collectColorStops(SkSVGRenderContext const&, skia_private::STArray<2, float, true>*, skia_private::STArray<2, SkRGBA4f<(SkAlphaType)3>, true>*) const::$_0) const Line | Count | Source | 30 | 340 | void forEachChild(Func func) const { | 31 | 1.20k | for (const auto& child : fChildren) { | 32 | 1.20k | if (child->tag() == NodeType::tag) { | 33 | 344 | func(static_cast<const NodeType*>(child.get())); | 34 | 344 | } | 35 | 1.20k | } | 36 | 340 | } |
|
37 | | |
38 | | // TODO: convert remaining direct users to iterators, and make the container private. |
39 | | skia_private::STArray<1, sk_sp<SkSVGNode>, true> fChildren; |
40 | | |
41 | | private: |
42 | | using INHERITED = SkSVGTransformableNode; |
43 | | }; |
44 | | |
45 | | #endif // SkSVGContainer_DEFINED |