/src/skia/modules/svg/include/SkSVGContainer.h
Line | Count | Source (jump to first uncovered line) |
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/core/SkPath.h" |
12 | | #include "include/core/SkRect.h" |
13 | | #include "include/core/SkRefCnt.h" |
14 | | #include "include/private/base/SkAPI.h" |
15 | | #include "include/private/base/SkTArray.h" |
16 | | #include "modules/svg/include/SkSVGNode.h" |
17 | | #include "modules/svg/include/SkSVGTransformableNode.h" |
18 | | |
19 | | class SkSVGRenderContext; |
20 | | |
21 | | class SK_API SkSVGContainer : public SkSVGTransformableNode { |
22 | | public: |
23 | | void appendChild(sk_sp<SkSVGNode>) override; |
24 | | |
25 | | protected: |
26 | | explicit SkSVGContainer(SkSVGTag); |
27 | | |
28 | | void onRender(const SkSVGRenderContext&) const override; |
29 | | |
30 | | SkPath onAsPath(const SkSVGRenderContext&) const override; |
31 | | |
32 | | SkRect onObjectBoundingBox(const SkSVGRenderContext&) const override; |
33 | | |
34 | | bool hasChildren() const final; |
35 | | |
36 | | template <typename NodeType, typename Func> |
37 | 407 | void forEachChild(Func func) const { |
38 | 928 | for (const auto& child : fChildren) { |
39 | 928 | if (child->tag() == NodeType::tag) { |
40 | 0 | func(static_cast<const NodeType*>(child.get())); |
41 | 0 | } |
42 | 928 | } |
43 | 407 | } Unexecuted instantiation: SkSVGFeMerge.cpp:void SkSVGContainer::forEachChild<SkSVGFeMergeNode, SkSVGFeMerge::onMakeImageFilter(SkSVGRenderContext const&, SkSVGFilterContext const&) const::$_0>(SkSVGFeMerge::onMakeImageFilter(SkSVGRenderContext const&, SkSVGFilterContext const&) const::$_0) const Unexecuted instantiation: SkSVGFeMerge.cpp:void SkSVGContainer::forEachChild<SkSVGFeMergeNode, SkSVGFeMerge::getInputs() const::$_0>(SkSVGFeMerge::getInputs() const::$_0) const 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 | 37 | 407 | void forEachChild(Func func) const { | 38 | 928 | for (const auto& child : fChildren) { | 39 | 928 | if (child->tag() == NodeType::tag) { | 40 | 0 | func(static_cast<const NodeType*>(child.get())); | 41 | 0 | } | 42 | 928 | } | 43 | 407 | } |
|
44 | | |
45 | | // TODO: convert remaining direct users to iterators, and make the container private. |
46 | | skia_private::STArray<1, sk_sp<SkSVGNode>, true> fChildren; |
47 | | |
48 | | private: |
49 | | using INHERITED = SkSVGTransformableNode; |
50 | | }; |
51 | | |
52 | | #endif // SkSVGContainer_DEFINED |