Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SkSVGContainer Class Reference

#include <SkSVGContainer.h>

Inheritance diagram for SkSVGContainer:
SkSVGTransformableNode SkSVGNode SkRefCnt SkRefCntBase SkSVGG SkSVGHiddenContainer SkSVGSVG SkSVGClipPath SkSVGDefs SkSVGFe SkSVGFeFunc SkSVGFeLightSource SkSVGFeMergeNode SkSVGFilter SkSVGGradient SkSVGMask SkSVGPattern SkSVGStop

Public Member Functions

void appendChild (sk_sp< SkSVGNode >) override
 
- Public Member Functions inherited from SkSVGTransformableNode
void setTransform (const SkSVGTransformType &t)
 
- Public Member Functions inherited from SkSVGNode
 ~SkSVGNode () override
 
SkSVGTag tag () const
 
virtual void appendChild (sk_sp< SkSVGNode >)=0
 
void render (const SkSVGRenderContext &) const
 
bool asPaint (const SkSVGRenderContext &, SkPaint *) const
 
SkPath asPath (const SkSVGRenderContext &) const
 
SkRect objectBoundingBox (const SkSVGRenderContext &) const
 
void setAttribute (SkSVGAttribute, const SkSVGValue &)
 
bool setAttribute (const char *attributeName, const char *attributeValue)
 
virtual bool parseAndSetAttribute (const char *name, const char *value)
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Protected Member Functions

 SkSVGContainer (SkSVGTag)
 
void onRender (const SkSVGRenderContext &) const override
 
SkPath onAsPath (const SkSVGRenderContext &) const override
 
SkRect onObjectBoundingBox (const SkSVGRenderContext &) const override
 
bool hasChildren () const final
 
template<typename NodeType , typename Func >
void forEachChild (Func func) const
 
- Protected Member Functions inherited from SkSVGTransformableNode
 SkSVGTransformableNode (SkSVGTag)
 
bool onPrepareToRender (SkSVGRenderContext *) const override
 
void onSetAttribute (SkSVGAttribute, const SkSVGValue &) override
 
void mapToParent (SkPath *) const
 
void mapToParent (SkRect *) const
 
- Protected Member Functions inherited from SkSVGNode
 SkSVGNode (SkSVGTag)
 
virtual bool onPrepareToRender (SkSVGRenderContext *) const
 
virtual void onRender (const SkSVGRenderContext &) const =0
 
virtual bool onAsPaint (const SkSVGRenderContext &, SkPaint *) const
 
virtual SkPath onAsPath (const SkSVGRenderContext &) const =0
 
virtual void onSetAttribute (SkSVGAttribute, const SkSVGValue &)
 
virtual bool hasChildren () const
 
virtual SkRect onObjectBoundingBox (const SkSVGRenderContext &) const
 

Protected Attributes

skia_private::STArray< 1, sk_sp< SkSVGNode >, truefChildren
 

Additional Inherited Members

- Static Protected Member Functions inherited from SkSVGNode
static SkMatrix ComputeViewboxMatrix (const SkRect &, const SkRect &, SkSVGPreserveAspectRatio)
 

Detailed Description

Definition at line 14 of file SkSVGContainer.h.

Constructor & Destructor Documentation

◆ SkSVGContainer()

SkSVGContainer::SkSVGContainer ( SkSVGTag  t)
explicitprotected

Definition at line 13 of file SkSVGContainer.cpp.

13: INHERITED(t) { }

Member Function Documentation

◆ appendChild()

void SkSVGContainer::appendChild ( sk_sp< SkSVGNode node)
overridevirtual

Implements SkSVGNode.

Reimplemented in SkSVGFeLightSource.

Definition at line 15 of file SkSVGContainer.cpp.

15 {
16 SkASSERT(node);
17 fChildren.push_back(std::move(node));
18}
#define SkASSERT(cond)
Definition: SkAssert.h:116
skia_private::STArray< 1, sk_sp< SkSVGNode >, true > fChildren

◆ forEachChild()

template<typename NodeType , typename Func >
void SkSVGContainer::forEachChild ( Func  func) const
inlineprotected

Definition at line 30 of file SkSVGContainer.h.

30 {
31 for (const auto& child : fChildren) {
32 if (child->tag() == NodeType::tag) {
33 func(static_cast<const NodeType*>(child.get()));
34 }
35 }
36 }

◆ hasChildren()

bool SkSVGContainer::hasChildren ( ) const
finalprotectedvirtual

Reimplemented from SkSVGNode.

Definition at line 20 of file SkSVGContainer.cpp.

20 {
21 return !fChildren.empty();
22}
bool empty() const
Definition: SkTArray.h:199

◆ onAsPath()

SkPath SkSVGContainer::onAsPath ( const SkSVGRenderContext ctx) const
overrideprotectedvirtual

Implements SkSVGNode.

Definition at line 30 of file SkSVGContainer.cpp.

30 {
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}
@ kUnion_SkPathOp
union (inclusive-or) the two paths
Definition: SkPathOps.h:25
Definition: SkPath.h:59
void mapToParent(SkPath *) const
int size() const
Definition: SkTArray.h:421
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57

◆ onObjectBoundingBox()

SkRect SkSVGContainer::onObjectBoundingBox ( const SkSVGRenderContext ctx) const
overrideprotectedvirtual

Reimplemented from SkSVGNode.

Definition at line 43 of file SkSVGContainer.cpp.

43 {
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}
Optional< SkRect > bounds
Definition: SkRecords.h:189
static constexpr SkRect MakeEmpty()
Definition: SkRect.h:595

◆ onRender()

void SkSVGContainer::onRender ( const SkSVGRenderContext ctx) const
overrideprotectedvirtual

Implements SkSVGNode.

Reimplemented in SkSVGHiddenContainer.

Definition at line 24 of file SkSVGContainer.cpp.

24 {
25 for (int i = 0; i < fChildren.size(); ++i) {
26 fChildren[i]->render(ctx);
27 }
28}

Member Data Documentation

◆ fChildren

skia_private::STArray<1, sk_sp<SkSVGNode>, true> SkSVGContainer::fChildren
protected

Definition at line 39 of file SkSVGContainer.h.


The documentation for this class was generated from the following files: