Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkSVGContainer.cpp
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
9
10#include "include/core/SkPath.h"
12
14
16 SkASSERT(node);
17 fChildren.push_back(std::move(node));
18}
19
21 return !fChildren.empty();
22}
23
25 for (int i = 0; i < fChildren.size(); ++i) {
26 fChildren[i]->render(ctx);
27 }
28}
29
31 SkPath path;
32
33 for (int i = 0; i < fChildren.size(); ++i) {
34 const SkPath childPath = fChildren[i]->asPath(ctx);
35
36 Op(path, childPath, kUnion_SkPathOp, &path);
37 }
38
39 this->mapToParent(&path);
40 return path;
41}
42
44 SkRect bounds = SkRect::MakeEmpty();
45
46 for (int i = 0; i < fChildren.size(); ++i) {
47 const SkRect childBounds = fChildren[i]->objectBoundingBox(ctx);
48 bounds.join(childBounds);
49 }
50
51 return bounds;
52}
#define SkASSERT(cond)
Definition SkAssert.h:116
@ kUnion_SkPathOp
union (inclusive-or) the two paths
Definition SkPathOps.h:25
SkSVGTag
Definition SkSVGNode.h:23
void onRender(const SkSVGRenderContext &) const override
SkRect onObjectBoundingBox(const SkSVGRenderContext &) const override
bool hasChildren() const final
void appendChild(sk_sp< SkSVGNode >) override
SkPath onAsPath(const SkSVGRenderContext &) const override
skia_private::STArray< 1, sk_sp< SkSVGNode >, true > fChildren
SkSVGContainer(SkSVGTag)
void mapToParent(SkPath *) const
bool empty() const
Definition SkTArray.h:194
int size() const
Definition SkTArray.h:416
static constexpr SkRect MakeEmpty()
Definition SkRect.h:595